Jump to content

VBS Scripts


b0r3d

Recommended Posts

winamp 5.04

make sure pskill is in the same folder as winamp

Set WshShell = WScript.CreateObject("WScript.Shell")

WshShell.Run ("C:\winamp\winamp.exe")

WScript.Sleep 7000

WshShell.SendKeys "%a"

WScript.Sleep 500

WshShell.SendKeys "{TAB}"

WScript.Sleep 500

WshShell.SendKeys "{DOWN}"

WScript.Sleep 500

WshShell.SendKeys "{ }"

WScript.Sleep 500

WshShell.SendKeys "{DOWN 6}"

WScript.Sleep 1000

WshShell.SendKeys "{ }"

WScript.Sleep 500

WshShell.SendKeys "%n"

WScript.Sleep 500

WshShell.SendKeys "%n"

WScript.Sleep 500

WshShell.SendKeys "{ }"

WScript.Sleep 500

WshShell.SendKeys "{DOWN}"

WScript.Sleep 500

WshShell.SendKeys "{ }"

WScript.Sleep 500

WshShell.SendKeys "{DOWN}"

WScript.Sleep 500

WshShell.SendKeys "{ }"

WScript.Sleep 500

WshShell.SendKeys "{DOWN}"

WScript.Sleep 500

WshShell.SendKeys "{ }"

WScript.Sleep 500

WshShell.SendKeys "{DOWN}"

WScript.Sleep 500

WshShell.SendKeys "{ }"

WScript.Sleep 500

WshShell.SendKeys "{DOWN}"

WScript.Sleep 500

WshShell.SendKeys "{ }"

WScript.Sleep 500

WshShell.SendKeys "{DOWN}"

WScript.Sleep 500

WshShell.SendKeys "{ }"

WScript.Sleep 500

WshShell.SendKeys "%n"

WScript.Sleep 500

WshShell.SendKeys "%n"

WScript.Sleep 500

WshShell.SendKeys "{ }"

WScript.Sleep 500

WshShell.SendKeys "i"

WScript.Sleep 30000

WshShell.SendKeys "{TAB 7}"

WScript.Sleep 1000

WshShell.SendKeys "{ }"

WScript.Sleep 500

WshShell.SendKeys "{TAB 2}"

WScript.Sleep 500

WshShell.SendKeys "{ENTER}"

WScript.Sleep 1000

WshShell.Run ("C:\winamp\pskill.exe winamp.exe")

WScript.Sleep 500

Wscript.Quit

Link to comment
Share on other sites


So far, all what I've seen, is installing from hard drive.

Example: ("%systemdrive%\Install\MyApp\setup.exe")

What if MyApp is on a CD and I want to install it from there directly?

I assume it's here: %CDROM%\Install\MyApp\setup.exe

HUH?!

Link to comment
Share on other sites

If your EXE_to_be_run is located at "%CDROM%\install\apps\app.exe", and your .js is located in "%CDROM%\install", you don't need to use any special environment variables. Just use the relative directory paths. For example, in the above example, you can simply run "apps\app.exe /Q" directly.

Link to comment
Share on other sites

Didn't work in a real test.
Now, this is a surprise! The originator of the JS method did not beat it up into doing what he wanted it to do! :)

Here's an explanation:

It won't work from svcpack.inf or if you're running it from RunOnceEX/INF method. That is because, the relative directories will work only in context of being run from that folder, whereas the above methods run in a more direct level. It runs fine (atleast for me) if you do the same from either cmdlines/GUIrunonce using .CMDs/XPlode.

Link to comment
Share on other sites

The originator of the JS method did not beat it up into doing what he wanted it to do! :rolleyes:

hahaha

In fact, I invented an idea to run EXEs via JS or VBS from %CDROM% directly, under any method, RunOnceEX ... CMD ... etc!

It's completely MAZIN®'s script. :)

I posted my question just to see if there's an official script to do it.

However, I'll post it in Winamp thread when I prepare the text.

Thanks, prathapml.

Link to comment
Share on other sites

  • 2 weeks later...

Hi, thank you all for your example scripts, now I have made one for Fly 2000 TV:

Set WshShell = WScript.CreateObject ("WScript.Shell")
WshShell.Run (".\FLY2000TV238B3.exe /S")
WScript.Sleep 100
WshShell.SendKeys "{ENTER}"
WScript.Sleep 1500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 100
WshShell.SendKeys "N"
WScript.Quit

This will install Fly 2000 TV 2.38 beta 3 quietly

Link to comment
Share on other sites

  • 2 months later...

Here's noob question. How do you include long file names in the script "run" command?

Here's what I want to do:

WshShell.run "C:\Program Files\My Program\run this file.exe"

(I know the 8.3 file name will run this, but is there a way to use the long file names?)

Link to comment
Share on other sites

Here's noob question. How do you include long file names in the script "run" command?

Here's what I want to do:

WshShell.run "C:\Program Files\My Program\run this file.exe"

(I know the 8.3 file name will run this, but is there a way to use the long file names?)

Add quotes = Chr(34)

Set WshShell = WScript.CreateObject ("WScript.Shell")
WshShell.Run Chr(34) & "C:\Program Files\My Program\run this file.exe" & Chr(34)

:)

Link to comment
Share on other sites

is there a way in vbs to tell if a window is still active?

need it for an install where files are extracted out of a cab. I could use the sleep command but it is a bit primitive and it will have to be set way over the extraction time just in case it is used on a slower computer. So the best is to wait untill everything is extracted and see if the extraction windows is still open.

also

what is the time of the sleep function

say for:

WScript.Sleep(200);

Link to comment
Share on other sites

Someone posted code for watching for a particular window before sending keys. This was a suggested alternative to using "sleep." Seems like a great idea, but I'm not seeing install VBS's that employ this method! :(

Can someone with some coding experience post a sample? Let's suppose this scenario:

  • Run setup.exe to install program: "MyProg"
  • Window pops up with title: "MyProg Installation". Need ALT-N to continue.
  • Window pops up with title: "MyProg File Associations". Need ALT-N to continue.
  • Program installs. Final window title: "MyProg install complete" Need ALT-C to close.

I learn by trial and error and by seeing examples. If anyone could post this, I would be very thankful!

Link to comment
Share on other sites

here it is. This vbs is in the same directory as the setup.exe otherwise the complete path has to be entered. This will check every 2 seconds (sleep 2000) for the window. I have extra sleep of 1000 (1 second) to make sure the windows is completely up.

You have to make sure that you have the exact title for the windows you are waiting for. Try AutoIt to get this info.

 
set WshShell = WScript.CreateObject ("WScript.Shell")

WshShell.RUN ("setup.exe")

Do until WshShell.AppActivate ("MyProg Installation")
    WScript.Sleep 2000
Loop
WScript.Sleep 1000
WshShell.SendKeys "%{n}"

Do until WshShell.AppActivate ("MyProg File Associations")
    WScript.Sleep 2000
Loop
WScript.Sleep 1000
WshShell.SendKeys "%{n}"

Do until WshShell.AppActivate ("MyProg install complete")
    WScript.Sleep 2000
Loop
WScript.Sleep 1000
WshShell.SendKeys "%{c}"

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...