Calendar Awards Members List FAQ
Advertisement
Play-Asia.com - Buy Video Games for Consoles and PC - From Japan, Korea and other Regions
Reply
$ Thread Tools
 
  #1 (permalink)   [ ]
Old 08-26-2009, 06:12 PM
Link Lord Link Lord is a male United States Link Lord is offline
wat.
Join Date: Apr 2008
Location: Earth. GET OFF MY PROPERTY!
View Posts: 295
Script Help

I'm trying to create a fake virus warning to freak out my friends, family members, etc. in Notepad. It's coming along great so far, but I ran into a small problem. Here's the script so far:

Code:
warning = MsgBox("A Virus has infected your computer!  Immediate action must be taken to avoid risking damage.  Would you like Windows to attempt to remove the Virus?",4+16 , "Warning!")
If warning = vbYes Then
a = MsgBox("Windows was unable to remove the Virus.  Attempting to quarantine...",0+16 , "Removal Failed")
Else
b = MsgBox("The Virus is still harming your computer.  Windows strongly recommends you take action against it to prevent any further damage.  Are you sure you want to leave the Virus alone?",4+16 , "Warning!")
End If
If a = vbOK Then
c = MsgBox("Windows was unable to quarantine the Virus.",0+16 ,"Quarantine Failed")
End If
If b = vbNo Then
I want the next line to make the computer run a Batch file making it start a countdown to restarting. The script for the Batch file is as follows (and I'll add a message when this is finished):

Code:
shutdown -r -t 30
How can I link this Batch file to the script for the fake virus warning so it opens after the victim says "No, No" or "Yes, OK, OK?"
__________________
By Sugarpoultry
Reply With Quote
  #2 (permalink)   [ ]
Old 08-27-2009, 09:29 PM
Linked- Linked- is offline
Gerudo Thief
Join Date: Aug 2008
Location: Canada
View Posts: 84
Re: Script Help

VB has an open xxxx file command, just use that, after the last okay is pressed
__________________


Signature by Veritas
Reply With Quote
Advertisement
  #3 (permalink)   [ ]
Old 08-28-2009, 12:42 PM
Link Lord Link Lord is a male United States Link Lord is offline
wat.
Join Date: Apr 2008
Location: Earth. GET OFF MY PROPERTY!
View Posts: 295
Re: Script Help

Path used: Yes, OK, OK
Code:
warning = MsgBox("A Virus has infected your computer!  Immediate action must be taken to avoid risking damage.  Would you like Windows to attempt to remove the Virus?",4+16 , "Warning!")
If warning = vbYes Then
a = MsgBox("Windows was unable to remove the Virus.  Attempting to quarantine...",0+16 , "Removal Failed")
Else
b = MsgBox("The Virus is still harming your computer.  Windows strongly recommends you take action against it to prevent any further damage.  Are you sure you want to leave the Virus alone?",4+16 , "Warning!")
End If
If a = vbOK Then
c = MsgBox("Windows was unable to quarantine the Virus.",0+16 ,"Quarantine Failed")
End If
If c = vbOK Then 
Open restart.bat
End If
Script: C:\Users\*Username*\Documents\virus.vbs
Line: 11
Char: 1
Error: Object required: 'restart'
Code: 00A01A8
Source: Microsoft VBScript runtime error

Darn it. What's wrong in there?
__________________
By Sugarpoultry
Reply With Quote
  #4 (permalink)   [ ]
Old 08-28-2009, 12:52 PM
Danger Midway Islands Danger is offline
Money talks, bull**** walks


Join Date: Aug 2008
View Posts: 6,026
Re: Script Help

add this instead, and don't create the .bat file yourself
Code:
Set fileSys = CreateObject("Scripting.FileSystemObject")
Set fileOut = fileSys.CreateTextFile("C:\res.bat", True)
fileOut.WriteLine "shutdown -r -t 30"
fileOut.Close

Set wShell = CreateObject("WScript.Shell")
run_this = "res.bat "
wShell.Run run_this, 1, TRUE

Set fil = fileSys.GetFile("C:\res.bat")
fil.Delete

Set fileOut = Nothing
Set wShell = Nothing
Set fil = Nothing
Set fileSys = Nothing
Not 100% sure if it will work, my vbs knowledge is a bit rusty; try it!
__________________

"I do hate a lot of 'religion' but people like Christ - yeah they inspire me. I mean if you look at Christ, He was hanging around with the lowlifes, prostitutes and the losers you know, not going around with those high society mother****ers you see trying to sell Jesus today!"
Last Edited by Danger; 08-28-2009 at 12:54 PM. Reason: Reply With Quote
Advertisement
  #5 (permalink)   [ ]
Old 08-28-2009, 02:52 PM
Link Lord Link Lord is a male United States Link Lord is offline
wat.
Join Date: Apr 2008
Location: Earth. GET OFF MY PROPERTY!
View Posts: 295
Re: Script Help

Code:
warning = MsgBox("A Virus has infected your computer!  Immediate action must be taken to avoid risking damage.  Would you like Windows to attempt to remove the Virus?",4+16 , "Warning!")
If warning = vbYes Then
a = MsgBox("Windows was unable to remove the Virus.  Attempting to quarantine...",0+16 , "Removal Failed")
Else
b = MsgBox("The Virus is still harming your computer.  Windows strongly recommends you take action against it to prevent any further damage.  Are you sure you want to leave the Virus alone?",4+16 , "Warning!")
End If
If a = vbOK Then
c = MsgBox("Windows was unable to quarantine the Virus.",0+16 ,"Quarantine Failed")
End If
If c = vbOK Then 
Set fileSys = CreateObject("Scripting.FileSystemObject")
Set fileOut = fileSys.CreateTextFile("C:\res.bat", True)
fileOut.WriteLine "shutdown -r -t 30"
fileOut.Close

Set wShell = CreateObject("WScript.Shell")
run_this = "res.bat "
wShell.Run run_this, 1, TRUE

Set fil = fileSys.GetFile("C:\res.bat")
fil.Delete

Set fileOut = Nothing
Set wShell = Nothing
Set fil = Nothing
Set fileSys = Nothing
End If
Script: C:\Users\*Username*\Documents\virus.vbs
Line: 12
Char: 1
Error: Permission denied (<What the heck? I'm the Administrator. )
Code: 800A0046
Source: Microsoft VBScript runtime error

Dang... I really thought that one would work.

Oh, and why shouldn't I make the Batch file?
__________________
By Sugarpoultry
Reply With Quote
  #6 (permalink)   [ ]
Old 08-28-2009, 02:54 PM
Danger Midway Islands Danger is offline
Money talks, bull**** walks


Join Date: Aug 2008
View Posts: 6,026
Re: Script Help

It's this line failing
Set fileOut = fileSys.CreateTextFile("C:\res.bat", True)
but I have no idea why...
try replacing all "C:\res.bat" with just "res.bat"

and it's because this script I gave you creates the file itself, executes it, and then deletes it.
__________________

"I do hate a lot of 'religion' but people like Christ - yeah they inspire me. I mean if you look at Christ, He was hanging around with the lowlifes, prostitutes and the losers you know, not going around with those high society mother****ers you see trying to sell Jesus today!"
Reply With Quote
Advertisement
  #7 (permalink)   [ ]
Old 08-28-2009, 02:58 PM
Link Lord Link Lord is a male United States Link Lord is offline
wat.
Join Date: Apr 2008
Location: Earth. GET OFF MY PROPERTY!
View Posts: 295
Re: Script Help

...And there we go! It's finally working.

Thanks, fratey.
__________________
By Sugarpoultry
Reply With Quote
  #8 (permalink)   [ ]
Old 08-28-2009, 06:36 PM
Danger Midway Islands Danger is offline
Money talks, bull**** walks


Join Date: Aug 2008
View Posts: 6,026
Re: Script Help

o_o it did? Surprising! It was mostly guesswork...
Glad it worked. ;3
__________________

"I do hate a lot of 'religion' but people like Christ - yeah they inspire me. I mean if you look at Christ, He was hanging around with the lowlifes, prostitutes and the losers you know, not going around with those high society mother****ers you see trying to sell Jesus today!"
Reply With Quote
Advertisement
Reply

Tags
script


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -5. The time now is 11:34 AM.

Contact Us - Zelda Universe - Archive - Privacy Statement - Top
no new posts