Thread: VBS question
View Single Post
  #1  
Old 01-07-2010, 05:48 PM
guineapig guineapig is offline
Planar Protector

guineapig's Avatar

Join Date: Oct 2009
Posts: 4,028
Default VBS question

Hey fellow geeks.

Quick VBS question.
I have a script here for a basic keygen. It works fine except for one thing.
After you type in (for example) 2-3 digit number and the key is generated you click okay and it goes back to the window requesting another session key.

That part is fine. However, when I click close (x) it brings up the generated number again. Also if you click close (x) on the window with the generated key it also takes you back to the window requesting another key.

Here's the code:
---------------------------------
On Error Resume Next

Dim Key, tempString, tempKey, Input

Do

Input = InputBox("Enter Serial!")
Input = int(Input)

Key = ((((((((Input ^ 8) / 92657) + 16) * 7) / 316) - 23) / 71104) + 26) * 24

tempString = CStr(Key)
tempString = Left(tempString, 6)
tempKey = Int(tempString)

if (tempKey < 1000000) then
tempString = CStr(tempKey * 2540)
tempString = Left(tempString, 6)
Key = Int(tempString)
else
Key = tempKey
end if

msgbox (Key)

Loop Until Input < 1

-----------------------------------------

How the hell do I get the code to terminate the script as soon as the close (x) click event happens???

I cant think of a bunch of ways to do it logically but I really suck at VBS and can't figure out the syntax. Any help would be greatly appreciated.

This is just for home computer use so feel free to use the code for whatever if you want to...
__________________
Quote:
Originally Posted by nilbog View Post
Server chat is for civil conversation. Personal attacks/generally being confrontational will not be tolerated.