PDA

View Full Version : Need vbs scripting help


krazedkat
03-16-2008, 07:07 PM
ok so im new to the whole vbs scripting

so far i have made this code:
yourMsg=MsgBox( "Click OK to run the script that constantly presses CAPS =D", 1, "Startup Menu")
if ok then run
Set wshShell =wscript.CreateObject("WScript.Shell")
do
wscript.sleep 100
wshshell.sendkeys "{CAPSLOCK}"
loop


so it pops up a msgbox saying " click ok to run the script that constantly presses CAPS =D"
the 1 makes the 2 options of ok and cancel that the bottom
the if ok then run makes it run my custom code below it that constantly presses the CAPSLOCK key.


now the thing i can't figure out is how to make it close WITHOUT running the caps code when the CANCEL button is pressed :D

thanks for any help....

Legacy2404
03-16-2008, 07:26 PM
I do not script... once there as a choice to be made, to script or not to script... me being the dingbat chose not to script... that being said the following maybe of some help...

http://www.microsoft.com/technet/scriptcenter/default.mspx

krazedkat
03-17-2008, 08:07 AM
tried that and it hasnt helped so far

Tinus1959
03-17-2008, 09:45 AM
The normal code for the if statement is:
If <condition> then <code> else <code>
The block folowing the else block is what happens when you press cancel.

Does this help you?

krazedkat
03-17-2008, 05:40 PM
ya thanx i just figured it out :D

krazedkat
03-17-2008, 08:46 PM
sorry for double post but can you show me what the code SHOULD be?

Tinus1959
03-18-2008, 01:56 AM
sorry for double post but can you show me what the code SHOULD be?
I don't script myself, but in the scripting vault a few posts up you will find several scripts with this style.
Trying to read scrips from other people is a very good way to learn.
Start easy and increase your level as you get more experiance.

krazedkat
03-18-2008, 07:38 AM
thnx tinus

Tinus1959
03-18-2008, 01:39 PM
thnx tinusYou're welcome.