Shade Posted June 14, 2006 Share Posted June 14, 2006 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 [u]Window Hider[/u] Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted June 14, 2006 Share Posted June 14, 2006 wtf is this "" & $ini ur adding nothing to a file extension? Link to comment Share on other sites More sharing options...
forger Posted June 14, 2006 Share Posted June 14, 2006 What thatsgreat2345 meant is that you don't need to put "" & in front of a variable 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 Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted June 14, 2006 Share Posted June 14, 2006 control send can also just be used to send something to a window doesnt have to have a specific ID Link to comment Share on other sites More sharing options...
Shade Posted June 14, 2006 Author Share Posted June 14, 2006 But it wont screw up the code if I use "" & var right? I'm still kinda wondering why it isn't working... [u]Window Hider[/u] Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted June 14, 2006 Share Posted June 14, 2006 (edited) ok now u MUST include a controlID my bad or it wont work Edited June 14, 2006 by thatsgreat2345 Link to comment Share on other sites More sharing options...
Shade Posted June 15, 2006 Author Share Posted June 15, 2006 (edited) 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 June 15, 2006 by Shade [u]Window Hider[/u] 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