Queener Posted May 13, 2013 Share Posted May 13, 2013 (edited) Sorry for the noobie question, but I'm planning to copy text from file to inputbox on web browser. I get error saying that I did not declare $sFile? $sFile = FileOpen(@ScriptDir & "\config.txt") $sRead = FileRead($sFile) $aString = StringSplit($sRead, @CRLF, 1) If $aString[0] < 11 Then Exit $sResult = "" For $i = 11 To $aString[0] $sResult &=$aString[$i] & @CRLF Next WinActivate($Title) FileWrite($Title, $sResult) Isn't $sFile = FileOpen(@ScriptDir & "config.txt") declaring it already? Edited May 13, 2013 by asianqueen Msgbox(0, "Hate", "Just hate it when I post a question and find my own answer after a couple tries. But if I don't post the question, I can't seem to resolve it at all.") Link to comment Share on other sites More sharing options...
Nessie Posted May 13, 2013 Share Posted May 13, 2013 Please post the full code. What $Title is? This seems not to be a file.Hi! My UDF: NetInfo UDF Play with your network, check your download/upload speed and much more! YTAPI Easy to use YouTube API, now you can easy retrive all needed info from a video. NavInfo Check if a specific browser is installed and retrive other usefull information. YWeather Easy to use Yahoo Weather API, now you can easily retrive details about the weather in a specific region. No-IP UDF Easily update your no-ip hostname(s). My Script: Wallpaper Changer Change you wallpaper dinamically, you can also download your wallpaper from your website and share it with all! My Snippet: _ImageSaveToBMPConvert an image to bmp format. _SciteGOTO Open a file in SciTE at specific fileline. _FileToHex Show the hex code of a specified file Link to comment Share on other sites More sharing options...
BrewManNH Posted May 13, 2013 Share Posted May 13, 2013 If that's how your script is written in the full script, then you would be declaring $sFile in the first line. The problem I have is with $Title, but that may be because you only posted a part of the script. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Queener Posted May 13, 2013 Author Share Posted May 13, 2013 Please post the full code. What $Title is? This seems not to be a file. Hi! Let's not worry about $title for now. $title = inputbox1 from web browser. Let's start off by why it doesn't accept $sFile as it's being declare. Msgbox(0, "Hate", "Just hate it when I post a question and find my own answer after a couple tries. But if I don't post the question, I can't seem to resolve it at all.") Link to comment Share on other sites More sharing options...
jdelaney Posted May 13, 2013 Share Posted May 13, 2013 Paste in the exact scite error, and the exact line number of this: $sFile = FileOpen(@ScriptDir & "config.txt") IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
mrflibblehat Posted May 13, 2013 Share Posted May 13, 2013 Let's not worry about $title for now. $title = inputbox1 from web browser. Let's start off by why it doesn't accept $sFile as it's being declare. Please post the full script, you need to help us help you [font="'courier new', courier, monospace;"]Pastebin UDF | Prowl UDF[/font] Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 13, 2013 Moderators Share Posted May 13, 2013 (edited) Added something for $Title, and the code below works just fine. It has to be something else in the unshared portion of your script. $Title = @ScriptDir & "\Title.txt" $sFile = FileOpen(@ScriptDir & "\config.txt") $sRead = FileRead($sFile) $aString = StringSplit($sRead, @CRLF, 1) If $aString[0] < 11 Then Exit $sResult = "" For $i = 11 To $aString[0] $sResult &=$aString[$i] & @CRLF Next WinActivate($Title) FileWrite($Title, $sResult) Edited May 13, 2013 by JLogan3o13 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Queener Posted May 13, 2013 Author Share Posted May 13, 2013 (edited) I change the code a little bit to see if I still get the same error, but it still the same thing. expandcollapse popup$Title = "InputBox1" Func start() Run(@ProgramFilesDir & "\Mozilla Firefox\firefox.exe" & " " & "(Site)") EnterJob() EndFunc While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $Button start() EndSwitch WEnd Func EnterJob() While 2 sleep(2000) If WinActive($Title) Then ControlClick($Title,"","MozillaWindowClass1","Left",1,85,60) GetPass() Sleep(5000) Endif WEnd EndFunc Func GetPass() $File = FileOpen("\config.txt",0) $Read = Fileread($File) $String = StringSplit($Read, @CRLF, 1) If $String[0] < 11 Then Exit $Result = "" For $i = 11 To $String[0] $Result &=$String[$i] & @CRLF Next Send("{ALT}{TAB}") FileWrite($Title, $Result) Exit EndFunc There are still code left that I didn't include because it contain my user/pass. I notice that there are method such as mailslot, but thats too hard to get it right so I'm going this route. Edited May 13, 2013 by asianqueen Msgbox(0, "Hate", "Just hate it when I post a question and find my own answer after a couple tries. But if I don't post the question, I can't seem to resolve it at all.") Link to comment Share on other sites More sharing options...
BrewManNH Posted May 13, 2013 Share Posted May 13, 2013 You can't use FileWrite to paste text to a Window. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Nessie Posted May 13, 2013 Share Posted May 13, 2013 As i suspected, you are tring to FileWrite a control and that of course can't be done. Take a look to you can do the same job with _IE function as well. Hi! My UDF: NetInfo UDF Play with your network, check your download/upload speed and much more! YTAPI Easy to use YouTube API, now you can easy retrive all needed info from a video. NavInfo Check if a specific browser is installed and retrive other usefull information. YWeather Easy to use Yahoo Weather API, now you can easily retrive details about the weather in a specific region. No-IP UDF Easily update your no-ip hostname(s). My Script: Wallpaper Changer Change you wallpaper dinamically, you can also download your wallpaper from your website and share it with all! My Snippet: _ImageSaveToBMPConvert an image to bmp format. _SciteGOTO Open a file in SciTE at specific fileline. _FileToHex Show the hex code of a specified file Link to comment Share on other sites More sharing options...
Queener Posted May 13, 2013 Author Share Posted May 13, 2013 (edited) Got it.... I did it a different way. It's not real time if you keep the program open. If you make any modification to config.txt; you'll need to close the program.exe and re-open. Does not need to recompile with this method. $sRead = Fileread(@ScriptDir & "\config.txt") Func Test() ControlClick($Title,"","MozillaWindowClass1","Left",1,85,83) Send($sRead,1) Send("{ENTER}") EndFunc Edited May 13, 2013 by asianqueen Msgbox(0, "Hate", "Just hate it when I post a question and find my own answer after a couple tries. But if I don't post the question, I can't seem to resolve it at all.") 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