In this "Instructable" I'll be showing you how to make a message box in Notepad using VBScript Coding.

Please Note: This is a completely harmless project and if something DOES go wrong, I will not be help responsible.

Step 1: Step One

First thing to do is locate your Notepad.exe.
This application is on every windows computer OS and can be used for loads of interesting things.
Notepad.exe is normally located in Start Menu>All programs>Accessories

<p>i want to have a .bat file write a temp .vbs with the following code:</p><p>Do</p><p>MsgBox&quot;message&quot;,4096,&quot;Message&quot;</p><p>Loop</p><p>is there a way to embed this?</p>
<p>@echo off</p><p>x=msgbox(&quot;message&quot; ,4096, &quot;Message&quot;) &gt; temp.vbs</p><p>:start</p><p>start temp.vbs</p><p>goto start</p><p>I hope I this was what you ment. </p>
<p>I believe you can do this:</p><p>@echo off</p><p>cd %temp%</p><p>echo do &gt;&gt; temp.vbs</p><p>echo MsgBox&quot;message&quot;,4096,&quot;Message&quot; &gt;&gt; temp.vbs</p><p>echo loop &gt;&gt; temp.vbs</p><p>wscript temp.vbs</p><p>del temp.vbs</p><p>exit</p>
<p>how to frame someone.</p>
<p>Thanks for teaching me this new skill lol</p>
Oh, I understand... Hmmm, well I have to think about that scenario as far as I know there isn't a solution for what you'd like to do - would you like to have the end user always receive a message when trying to open a given local folder before they save to that folder? You might be able to create a script and have it monitor if two or more instances of explorer.exe proceses are running (one is always running if someone is logged in, but if two or more are open by the same user then display a message. You won't be able to know what folder they opened that easy and after making the script it would be better to make it a 'service' instead of another process, it could be done.) There also MIGHT be a GPO in which you could set rules on folders or particular folders to run a cha script when launched? I've never had that request yet.
<p>This works perfectly for making the simple (just &quot;OK&quot; reminder) message box I need, but can anyone tell me how to make the message activate? I specifically want the msgbox I created to pop-up when a general folder is opened. Can't seem to find a way to &quot;activate&quot; the msgbox in the folder's settings...</p>
<p>You would have to open a folder using a script to accomplish this, something like this:</p><p>x=msgbox(&quot;Would you like to open the Windows folder?&quot; ,4, &quot;Question:&quot;)</p><p>If x = vbNo Then Wscript.Quit(0)</p><p>If x = VbYes Then</p><p>Set WshShell = CreateObject(&quot;WScript.Shell&quot;)</p><p>X = WshShell.run(&quot;cmd /c explorer.exe &quot;&quot;C:\Windows&quot;&quot;&quot;,0, true)</p><p>End If</p>
Thank you for taking the time to reply. I'm an extreme novice with this stuff, but don't think this is what I was looking for. Let me know if I'm mistaken:<br>- I copied/pasted everything you put into Notepad and saved as a .vbs file. Then when I click on that file, it asks if I want to open the Windows folder (and gives me a yes or no options). When I click &quot;yes&quot; it opens the folder C:/Windows. This all sounds like how the example was designed to work.<br>- However, what I was hoping for was a way to show a pop up message WHEN I CLICK ON A FOLDER. An example would be if when I click on a &quot;Pictures&quot; folder I created, I want a pop up box to trigger and say something like &quot;Reminder:&quot; and &quot;Remember to put new pictures on external hard drive&quot; and then just have an &quot;OK&quot; option. That way, I'll remember to save my pics to my external hard drive every time I click on the &quot;Pictures&quot; folder. This is just an example, I really want to use if for work where I have customer's folders that contact past proposals, reports, documents...and a few of them require certain things like &quot;must include sales tax on proposals,&quot; or &quot;This customer has 10% Discount on all orders&quot; - so I want everyone in my company to see these kinds of reminders when clicking on their folders in Windows Explorer.<br><br>It sounds like what I want is the other way around from what you said, so while your way lets me click on the VBS file, then click yes to open the example folder, my hope is to swap that around (click on a folder and then have a pop-up box show up to remind me certain things). Maybe some minor tweaking is what is needed.<br><br>Thanks again and if you have an answer to my follow up question, please let me know. Appreciate your help.
christophor or anyone, could you please give an example with more lines. <br> <br>I created a batch file that works fine using the single line text format you gave, but I cannot get it to work with 2 or more lines. Your help would be greatly appreciated. <br> <br>Ultimately, I'd like the .bat file to create the msgbox with title and multiple lines.
<p>The only reason I wouldn't use a Batch file to open a VBS file is because you will see the Command window in the background but if you want to relate VBS to Batch File you can do the following:</p><p>strMB = inputbox(&quot;Please enter your message here:&quot;)</p><p>Set WshShell = CreateObject(&quot;WScript.Shell&quot;)</p><p>WshShell.run &quot;cmd /c @echo msgbox &quot; &amp; &quot;&quot;&quot;&quot; &amp; strMB &amp; &quot;&quot;&quot;&quot; &amp; &quot;,4096,&quot;&quot;VBS2CMD2VBS:&quot;&quot;&gt;C:\Message.vbs&quot;,0, true</p><p>WshShell.run &quot;C:\windows\system32\wscript.exe C:\Message.vbs&quot;,0, false</p><p>Wscript.Quit(0)</p><p>Now what we just did was pass the Variable on to another VBS using the Command line, or in essence a Batch file, you could do the same thing, the 1st script then called the VBS you just made. I am just showing you how complex you can make it and that you can execute anything in VBS that you can from a command line, but you can accomplish the same effect with less code like this:</p><p>strMB = inputbox(&quot;Please enter your message here:&quot;)</p><p>msgbox strMB, 4096, &quot;Message&quot;</p>
<p>I selected option as 4. like Yes and No. But I want an website to open if clicked NO.</p><p>Can you please help?</p>
<p>PrasunU,</p><p>you can use any of these methods (I just think it's good to know different ways that work):</p><p>(A)</p><p>x=msgbox(&quot;Would you like to continue?&quot; ,4, &quot;Question:&quot;)</p><p>If x = vbNo Then MsgBox &quot;You selected 'No'&quot;, 4096, &quot;No:&quot;</p><p>If x = VbYes Then MsgBox &quot;You selected 'Yes'&quot;, 4096, &quot;Yes:&quot;</p><p>(B)</p><p>x=msgbox(&quot;Would you like to continue?&quot; ,4, &quot;Question:&quot;)</p><p>If x = vbNo Then</p><p>MsgBox &quot;You selected 'No'&quot;, 4096, &quot;No:&quot;</p><p>Wscript.Quit(0)</p><p>End If</p><p>If x = VbYes Then</p><p>MsgBox &quot;You selected 'Yes'&quot;, 4096, &quot;Yes:&quot;</p><p>Wscript.Quit(0)</p><p>End If</p><p>(C)</p><p>x=msgbox(&quot;Would you like to continue?&quot; ,4, &quot;Question:&quot;)</p><p>If x = vbNo Then</p><p>MsgBox &quot;You selected 'No'&quot;, 4096, &quot;No:&quot;</p><p>Else</p><p>MsgBox &quot;You selected 'Yes'&quot;, 4096, &quot;Yes:&quot;</p><p>End If</p><p>Wscript.Quit(0)</p>
<p>Attached is my vbs script.</p>
<p>Fantastic. But how do I kill it after 1 second?</p>
<p>Good Question DanG13! Here you go the 5 will kill it in 5 seconds:</p><p>Set WshShell = CreateObject(&quot;WScript.Shell&quot;)</p><p>x = WshShell.Popup(&quot;Would you like to continue?&quot;,5,&quot;Title:&quot;,4)</p><p>If x = vbNo Then Wscript.Quit(0)</p><p>If x = VbYes Then</p><p>'Your script goes here</p><p>msgbox &quot;you selected YES!&quot;, 4096, &quot;Yes&quot;</p><p>End If</p>
<p>How to use this with newline? </p>
<p>The answer is VbCrLf but you will have to add it to what you already like this: &quot;text1&quot; &amp; VbCrLf &amp; &quot;text2&quot; &amp; VbCrLf &amp; &quot;text3&quot;, 0, &quot;title&quot;</p><p>Example:</p><p>x=msgbox(&quot;Would you like to continue?&quot; &amp; VbCrLf &amp; &quot;If you select No, you will see NO&quot; &amp; VbCrLf &amp; VbCrLf &amp; &quot;If you select Yes, you will see YES&quot;,4, &quot;Question:&quot;)</p><p>If x = vbNo Then</p><p>MsgBox &quot;NO&quot;, 4096, &quot;No:&quot;</p><p>Else</p><p>MsgBox &quot;YES&quot;, 4096, &quot;Yes:&quot;</p><p>End If</p>
<p>Did it! Thanks a lot. Now I can make error messages!</p>
<p>Here is something cruel you do to your friends (if you have any)! What this does is loops the box. So when they press &quot;OK&quot;, it closes then opens again. Also, because it's &quot;4096&quot; it sits ontop of everything, just being awkward. Have fun!</p><blockquote>Do</blockquote><blockquote>MsgBox&quot;Just here to be awkward!&quot;,4096,&quot;Troll v6.;</blockquote><blockquote>Loop</blockquote>
<p>Don't put &gt;&quot;msgbox.vbs in the actual notepad, thats what you save it as, what I do is paste this MsgBox(&quot; &quot;,0+0,&quot; &quot;) but of coarse there are no spaces in the final copy, then I just fill it in</p>
<p>um... yeah you got an error didn't you?</p><p>try this and then you will not have an error...</p><p><em>x=msgbox (&ldquo;whatever you want message box to say here&rdquo; ,0, &rdquo;title here&rdquo;) <br>&gt; &ldquo;msgbox.vbs&rdquo;</em></p>
<p>no, thats an error in a command line, you should had an error on one of your commands</p>
Notepad isn't a &quot;powerful scripting program&quot; it's a simple text-editor.<br /> <br /> L<br />
IMHO A simple Text editor is a powerful programming tool. It used to be all there was. If you know what you're doing, a text editor might be all you need. <br> <br>try this from a windows command line. do it from a directory where you have write permissions. <br> <br> <br>Type <br>c:\scripts&gt; echo x=msgbox(&quot;Your text here.&quot; ,0,&quot;Title here&quot;)&gt;mbscript.vbs <br> <br> <br>Type <br>c:\scripts&gt; cscript mbscript.vbs <br> <br> <br>You've just written a vbscript without any text editor at all. <br>to add more lines use &gt;&gt; instead of &gt; before the file name. <br> <br> <br>Notepad, edit, vi, emacs whatever you use, a text editor IS a powerful tool. <br>
after it creates the mbscript.vbs file how do you write into the newly created vbs file with code? <br> <br>lets say...within that file i want to create a code that tell a program to run
Tell me what you're trying to do. So I can answer the question most thoughtfully. <br> <br>I think I understand, but I want to be sure before I write up a bunch of stuff you don't need. <br> <br>Thanks.
using your code <br>************* <br>c:\scripts&gt; echo x=msgbox(&quot;Your text here.&quot; ,0,&quot;Title here&quot;)&gt;mbscript.vbs <br>*********** <br> <br>it creates an empty vbs script called &quot;mbscript&quot;...................now after it has done so, how do i write a code (from the same notepad i used to create the mbscript.vbs) in addition that fills the empty mbscript.vbs with a code to lets say...run another program?
Make sure you're at the command prompt. <br> <br>You can get there like this: <br> <br>go to start <br>then run <br>then type CMD <br>and hit enter <br> <br>that will open the command line. It's a black screen with a blinking cursor and something like <br> <br>C:\&gt;_ the underscore represents the cursor. you don't type &quot;c:\&gt;&quot; <br> <br>you type only the following that is between the outer most quotes. <br> <br>&quot;echo x=msgbox (&quot;Your Text Here&quot; ,0, &quot;Your Title Here&quot;)&gt;msgbox.vbs&quot; <br> <br>That will work. I just now did it. <br> <br>when you type script msgbox.vbs you'll get a message box with an OK button. <br> <br>i've only used the technique I've described in an emergency where I was in a unique situation. sometimes I use it to create batch file. it's because I use linux a lot and I'm used to the command line. <br> <br>It's not really practical to write an entire script like that. <br>I suggest you use the Notepad.exe as described in this fine instructable. <br> <br>or if you can't get to notepad you can type &quot;edit&quot; at the command prompt and you'll get a text based editor. Well, you will on XP anyway. I don't know about windows 7 for sure. <br> <br>If you want to now how to program you should google &quot;vbscript fundamentals&quot; you should find the MSDN site for VBScript. Pretty much all you need to know is there. <br> <br>If you want examples of vbscripts you should google. vbscript examples. you'll get tons of source code. but start with something basic as in simple or easy. at first and work your way up. <br> <br>I hope this helps. <br> <br>Let me know if you need anything else. <br> <br>Christophor <br> <br> <br> <br>
sorry you have to type <br> <br>c script with no spaces. my spell checker keeps fix it for some reason. <br> <br>you could click on it to run it if you use the windows interface. <br> <br>probably you could just type msgbox.vbs and it will run.(after you've created it.) <br> <br>good luck.
No.<br> The power is in a person's mind, Notepad is a simple text-editor.<br> <br> L
I agree with you. Notepad is a simple text editor. Nothing more and nothing less.<br><br>I think we can both agree, if you can't code with a simple text editor then you can't really code anyway.<br><br>But, let's say simple text editors represent the minimum standard in scripting tools.<br><br>What exactly would you say IS an example of &quot;a powerful scripting program?&quot; What makes it more powerful than (insert name of text editor here)?<br><br>I'm not being hostile. I really want to know. I use notepad and notepad ++ on a daily basis. They are both simple text editors at heart. <br><br>Notepad is great for filtering formatting codes from cut text. Cut from excel. Paste into notepad. Presto! Nice clean text. Cut it from notepad and paste it into whatever like.<br><br>I look forward to your reply.<br><br>Thanks, Lemonie.<br><br>- Chris<br><br><br>
&nbsp;Nice work but do you know how to make it so that if they click &quot;no&quot; it simply opens the message box again?
&nbsp;yes, and also, there is a much easier way to make a msg box, open notepad, type in: msg * your text here &nbsp;Voila!! i am not dissing the file in any way, just a suggestion for easier work.&nbsp;
As instructables goes, this is a good one (not counting the typos). Even newbies can understand it.<br /> However hideous the idea, it is possible to program using notepad.<br /> <br /> Maybe make a series on this, 'cause this one is a bit too simple.<br /> How about a challenge. Program something using only notepad, an html app maybe? (aah sweet memories)&nbsp; ;-) <br />
Aye, just thought I would do a very, very simple one before I move onto some of the harder stuff I do. And typos... I was doing this at night time, so thats why there are -loads-.<br /> Jack<br />
You won't be <em>help</em> responsible, you'll be <em>held</em> responsible.<br /> <br /> :p

About This Instructable


8 favorites


More by Jack.Miller: How to: Make a message box using VBScript
Add instructable to: