Jump to content
Sign in to follow this  
yabee

Need help with making an autorun script

Recommended Posts

yabee

I need to make a script that when I open internet explorer or mozilla firefox, my program would autorun.

could you please help me making that code..

I came up with this code but it hasnt worked out yet

if $iexplore.exe = [open]

[autorun] = c:\program files\project1\sticky me 1.5.0

please help me ASAP.. Im really in a rush.

Share this post


Link to post
Share on other sites
Tvern

You can create a script that runs in the background untill IE, or FF open and then runs a function.

For instance:

While 1
    If ProcessExists("iexplore.exe") Then
        MsgBox(0,"test","internet explorer exixsts")
    EndIf
    Sleep(100)
WEnd

will display a messagebox when IE exists.

Share this post


Link to post
Share on other sites
yabee

MsgBox(0,"test","internet explorer exixsts")

thank you!

how do i change it if i want a program to run such as calculator to run in the background instead of the messagebox?

Share this post


Link to post
Share on other sites
yabee

nvm, i got it.. but i still have a problem with the script.. i keeps running until my laptop hangs.. whats wrong with the code?

While 1

If ProcessExists("iexplore.exe") Then

ShellExecute("C:\Program Files\Project1\Sticky Me 1.5.0.exe")

EndIf

Sleep(100)

WEnd

Share this post


Link to post
Share on other sites
omnomnom

i am unsure if this would work, but you can try experimenting a little with this -

While 1
If ProcessExists("iexplore.exe") Then
ShellExecute("C:\Program Files\Project1\Sticky Me 1.5.0.exe")
EndIf
Sleep(100)
If ProcessExists("Sticky Me 1.5.0.exe") then
exit
EndIf
WEnd

I have not tested it, however it may work.

The problem with your original script appears to be that when iexplore is launched, it runs Sticky Me 1.5.0.exe then sleeps, and starts over again and because iexplore exists it will launch Sticky Me 1.5.0.exe again.

Correct me if im wrong, however the solution i posted should work okay

EDIT1: Forgot to put in endif, now fixed... however i am unsure if the endif is in the correct place... try experimenting a little :idea:

EDIT2: Fixed the code, do not need the else which was previously there I have not tried to see if it works or not however i no longer get any syntax errors.

Edited by omnomnom

Share this post


Link to post
Share on other sites
yabee

i am unsure if this would work, but you can try experimenting a little with this -

While 1
If ProcessExists("iexplore.exe") Then
ShellExecute("C:\Program Files\Project1\Sticky Me 1.5.0.exe")
EndIf
Sleep(100)
If ProcessExists("Sticky Me 1.5.0.exe") then
exit
EndIf
WEnd

I have not tested it, however it may work.

The problem with your original script appears to be that when iexplore is launched, it runs Sticky Me 1.5.0.exe then sleeps, and starts over again and because iexplore exists it will launch Sticky Me 1.5.0.exe again.

Correct me if im wrong, however the solution i posted should work okay

EDIT1: Forgot to put in endif, now fixed... however i am unsure if the endif is in the correct place... try experimenting a little :idea:

EDIT2: Fixed the code, do not need the else which was previously there I have not tried to see if it works or not however i no longer get any syntax errors.

it works nicely. thank you for the help and explanation!

Share this post


Link to post
Share on other sites
omnomnom

Glad to hear it! Enjoy.

If you dont mind me asking, what does Sticky Me 1.5.0.exe do? =)

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.