Sign in to follow this  
Followers 0
computergroove

How can I tie my script to a running .exe file?

6 posts in this topic

I am submitting requests for free products. My script is supposed to click backspace to "go back" to the last page in Firefox and hit several tabs to get to an email field. My script then retypes an email address with a number that increases by 1 every time it is run. It then tabs to the submit button and hits enter only to loop the program again. Below is a copy of my script. I remember making a script years ago having to use something like winactive I think where the script ties itself to a program already running before I can hit F8 to unpause the script and have it work with the program I want it to. It really doesn't do anything now. It runs but seems to pause itself even if I hit f8. What else do I need for this?

Global $Paused
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
$variable1 = 1000

While 1
    Sleep(100)
WEnd

Func start()
    Send("{BACKSPACE}");need to start from final landing page
    Send("{TAB}")
    Sleep(100)
    Send("{TAB}")
    Sleep(100)
    Send("{TAB}")
    Sleep(100)
    Send("{TAB}")
    Sleep(100)
    Send("{TAB}")
    Sleep(100)
    Send("{TAB}")
    Sleep(100)
    Send("{TAB}")
    Sleep(100)
    Send("{TAB}")
    Sleep(100)
    Send("{TAB}")
    Sleep(100)
    Send("{TAB}")
    Sleep(100)
    Send("{TAB}")
    Sleep(100)
    Send("{TAB}")
    Send("p")
    Send("a")
    Send("r")
    Send("k")
    Send("s")
    Send($variable1)
    Send("@")
    Send("g")
    Send("m")
    Send("a")
    Send("i")
    Send("l")
    Send(".")
    Send("c")
    Send("o")
    Send("m")
    $variable1 = $variable1 + 1
    Send("{TAB}")
    Sleep(100)
    Send("{TAB}")
    Sleep(100)
    Send("{TAB}")
    Sleep(100)
    Send("{TAB}")
    Sleep(100)
    Send("{TAB}")
    Sleep(100)
    Send("{TAB}")
    Sleep(100)
    Send("{TAB}")
    Sleep(100)
    Send("{TAB}")
    Sleep(100)
    Send("{TAB}")
    Sleep(100)
    Send("{TAB}")
    Send("{ENTER}")
EndFunc

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip("")
EndFunc

Func Terminate()
    Exit 0
EndFunc

Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Share this post


Link to post
Share on other sites



I am submitting requests for free products. My script is supposed to click backspace to "go back" to the last page in Firefox and hit several tabs to get to an email field. My script then retypes an email address with a number that increases by 1 every time it is run. It then tabs to the submit button and hits enter only to loop the program again. Below is a copy of my script. I remember making a script years ago having to use something like winactive I think where the script ties itself to a program already running before I can hit F8 to unpause the script and have it work with the program I want it to. It really doesn't do anything now. It runs but seems to pause itself even if I hit f8. What else do I need for this?

There's a couple of things I think you need to take a look at. First, you'll want to start the program by minimizing your own window (your running script), and finding then activating the Firefox window. Check out the functions in the "Windows Management" section of the help file for the functions you'll need. Activating the Firefox window will ensure that the keystrokes you're sending go to the correct window.

Second, your keystroke sending is all in a function you've named Start(), but I'm not seeing where Start() is being called.

Your application is one in which doing something is the primary activity, and responding to the GUI is secondary. That fits the "GUI OnEvent Mode". Read the "GUI Concepts" section of the help file. It explains the two modes available, and where each one is more appropriate to use.

I hope this helps!

Share this post


Link to post
Share on other sites

I got it to work without tying it to an application. See the example below. I just need to pull the firefox page up within 5 seconds of running the script and it follows it like a charm. Thanks for the help.

#Region;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_outfile=C:\Documents and Settings\user\Desktop\free kotex script.exe
#EndRegion;**** Directives created by AutoIt3Wrapper_GUI ****
;Global $Paused
HotKeySet("{F8}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
$variable1 = 1020

While 1
    call("start")
WEnd

Func start()
    Sleep(5000)
    Send("{BACKSPACE}");need to start from final landing page of coupon site
    Sleep(3000)
    Send("{TAB}")
    Sleep(100)
    Send("{TAB}")
    Sleep(100)
    Send("{TAB}")
    Sleep(100)
    Send("{TAB}")
    Sleep(100)
    Send("{TAB}")
    Sleep(100)
    Send("{TAB}")
    Sleep(100)
    Send("{TAB}")
    Sleep(100)
    Send("{TAB}")
    Sleep(100)
    Send("{TAB}")
    Sleep(100)
    Send("{TAB}")
    Sleep(100)
    Send("{TAB}")
    Sleep(100)
    Send("{TAB}")
    Send("p")
    Send("a")
    Send("r")
    Send("k")
    Send("s")
    Send($variable1)
    Send("@")
    Send("g")
    Send("m")
    Send("a")
    Send("i")
    Send("l")
    Send(".")
    Send("c")
    Send("o")
    Send("m")
    $variable1 = $variable1 + 1
    Send("{TAB}")
    Sleep(100)
    Send("{TAB}")
    Sleep(100)
    Send("{TAB}")
    Sleep(100)
    Send("{TAB}")
    Sleep(100)
    Send("{TAB}")
    Sleep(100)
    Send("{TAB}")
    Sleep(100)
    Send("{TAB}")
    Sleep(100)
    Send("{TAB}")
    Sleep(100)
    Send("{TAB}")
    Sleep(100)
    Send("{TAB}")
    Send("{ENTER}")
EndFunc

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip("")
EndFunc

Func Terminate()
    Exit 0
EndFunc

Is there a way to shorten the amount of tabs I have to use send with? Maybe send("{TAB}{TAB}{TAB}{TAB}")?


Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Share this post


Link to post
Share on other sites

I got it to work without tying it to an application. See the example below. I just need to pull the firefox page up within 5 seconds of running the script and it follows it like a charm. Thanks for the help.

(...)

Is there a way to shorten the amount of tabs I have to use send with? Maybe send("{TAB}{TAB}{TAB}{TAB}")?

Yes, you can do that. Or, if you really need "Sleep" part...

For $i = 1 To 12
    Send("{TAB}")
    Sleep(100)
Next

Enjoy in programming!


I can do signature me.

Share this post


Link to post
Share on other sites

You could have done this with the IE functions in like 10 lines of code.

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  
Followers 0