yabee Posted April 22, 2010 Share Posted April 22, 2010 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. Link to comment Share on other sites More sharing options...
Tvern Posted April 22, 2010 Share Posted April 22, 2010 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. Link to comment Share on other sites More sharing options...
yabee Posted April 22, 2010 Author Share Posted April 22, 2010 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? Link to comment Share on other sites More sharing options...
yabee Posted April 22, 2010 Author Share Posted April 22, 2010 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 Link to comment Share on other sites More sharing options...
omnomnom Posted April 22, 2010 Share Posted April 22, 2010 (edited) 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 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 April 22, 2010 by omnomnom Link to comment Share on other sites More sharing options...
yabee Posted April 22, 2010 Author Share Posted April 22, 2010 well explained.. thanks! i will try it. Link to comment Share on other sites More sharing options...
yabee Posted April 22, 2010 Author Share Posted April 22, 2010 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 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! Link to comment Share on other sites More sharing options...
omnomnom Posted April 22, 2010 Share Posted April 22, 2010 Glad to hear it! Enjoy. If you dont mind me asking, what does Sticky Me 1.5.0.exe do? =) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now