Jump to content
Sign in to follow this  
Shade

Stuck...

Recommended Posts

Hey guys and girls. I was wondering if any of you could give me a hand with a script I wrote. It sends text strings to a window based on the configuration of an ini file. I can't seem to get it working right. Any help is appreciated.

;Define Variables

;Ini File
$ini = "Defaults.ini"
;Window
$window = IniRead ( "" & $ini, "Windows", "Window", "")
;Sleep Time
$sleep1 = IniRead ( "" & $ini, "Sleeps", "Sleep1", "")
$sleep2 = IniRead ( "" & $ini, "Sleeps", "Sleep2", "")
$sleep3 = IniRead ( "" & $ini, "Sleeps", "Sleep3", "")
$sleep4 = IniRead ( "" & $ini, "Sleeps", "Sleep4", "")
$sleep5 = IniRead ( "" & $ini, "Sleeps", "Sleep5", "")
;Send String
$send1 = IniRead ( "" & $ini, "Sends", "Send1", "")
$send2 = IniRead ( "" & $ini, "Sends", "Send2", "")
$send3 = IniRead ( "" & $ini, "Sends", "Send3", "")
$send4 = IniRead ( "" & $ini, "Sends", "Send4", "")
$send5 = IniRead ( "" & $ini, "Sends", "Send5", "")
$send6 = IniRead ( "" & $ini, "Sends", "Send6", "")

;Body of Program
    MsgBox (0, "Auto Completer", "If Ini file is configured, Press OK to start.")
;Send the Strings
    ControlSend ("" & $window, "", "", "" & $send1)
    Sleep ("" & $sleep1)
    ControlSend ("" & $window, "", "", "" & $send2)
    Sleep ("" & $sleep2)
    ControlSend ("" & $window, "", "", "" & $send3)
    Sleep ("" & $sleep3)
    ControlSend ("" & $window, "", "", "" & $send4)
    Sleep ("" & $sleep4)
    ControlSend ("" & $window, "", "", "" & $send5)
    Sleep ("" & $sleep5)
    ControlSend ("" & $window, "", "", "" & $send6)
Exit

Attached is the ini file (without keys). Change the .txt extension to .ini.

Defaults.txt

Share this post


Link to post
Share on other sites

What thatsgreat2345 meant is that you don't need to put "" & in front of a variable :D

ControlSend ($window, "", "", $send1)

Um don't you have to add a Control ID or ClassNameNN in order to send it somewhere in that window you want?

Use the "autoit window info" to find that:

Start Menu > Programs > AutoIt v3

Also, make sure your window is running :D

Share this post


Link to post
Share on other sites

Ok, thanks guys. Is there any way I can send the string to the window without knowing the control ID? This program will be used on a computer without AutoIt installed, so I can not use the AutoIt Window Info program.

Edit:

Nevermind. I just substituted ControlSend() with Send() and made sure the window was focused. Thanks.

Edited by Shade

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  

×
×
  • Create New...