BladeZ Posted May 3, 2005 Share Posted May 3, 2005 i have a file of lines of text that i want to import into my registry and run but it only loads line one and doesnt go to line 2,3,4,ect... i am using the FileReadLine command so any help would be thanked Link to comment Share on other sites More sharing options...
Ejoc Posted May 3, 2005 Share Posted May 3, 2005 $szFunc = "FileReadLine" $szFile = RegRead("HKLM\SOFTWARE\AutoIt v3\AutoIt","InstallDir") if $szFile <> "" Then Run(@ComSpec & ' /c START "" "' & $szFile & '\AutoIt.chm"',"",@SW_HIDE) WinWait("AutoIt Help") Send("!n" & $szFunc & "{ENTER}") Endif Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs Link to comment Share on other sites More sharing options...
BladeZ Posted May 3, 2005 Author Share Posted May 3, 2005 uhhh can you explain it a little easyer this is my first script Link to comment Share on other sites More sharing options...
Ejoc Posted May 3, 2005 Share Posted May 3, 2005 run the script it will explain it Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs Link to comment Share on other sites More sharing options...
BladeZ Posted May 3, 2005 Author Share Posted May 3, 2005 i was already in help and it did not help me Link to comment Share on other sites More sharing options...
Ejoc Posted May 3, 2005 Share Posted May 3, 2005 The help file explains how to use the function, and even gives an example how to read every line of a text file. I dont know how to explain it better then the documentation already does. Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs Link to comment Share on other sites More sharing options...
steveR Posted May 4, 2005 Share Posted May 4, 2005 Sounds like you need a loop. You need to read each line in a loop until you get a EOF. Post what script you have so we have something to work with. AutoIt3 online docs Use it... Know it... Live it...MSDN libraryglobal Help and SupportWindows: Just another pane in the glass. Link to comment Share on other sites More sharing options...
herewasplato Posted May 4, 2005 Share Posted May 4, 2005 i have a file of lines of text that i want to import into my registry....<{POST_SNAPBACK}> I'm not sure that I understand what you want to do and I usually help a person write whatever they want before suggesting a totally different approach... but in this case, why not use the export/import methods already associated with the registry? If that will not work, then post what lines of code you have and we'll see if we can see any problems with it. [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
buzz44 Posted May 4, 2005 Share Posted May 4, 2005 (edited) $Filename = "C:\Some folder\some file.txt" While 1 $OpenFile = FileOpen($Filename, 0) $Line = FileReadLine($OpenFile) If @error = -1 Then ExitLoop ;Do what you want for each line Msgbox(4096,"test",$Line ); <<<< Example Wend Edited May 4, 2005 by Burrup qq Link to comment Share on other sites More sharing options...
BladeZ Posted May 4, 2005 Author Share Posted May 4, 2005 $Filename = "C:\List.txt" $i = 0 While $i <= 10 $OpenFile = FileOpen($Filename, 0) $Line = FileReadLine($OpenFile) RegWrite ( "regkey" ,"key", "REG_SZ", $line ) Run ("C:\someprogram") winactivate("2004") WinWaitActive("2004") Sleep (2000) MouseClick("left", 1150, 60) Sleep (2000) send ("{tab 1} {enter}") sleep(2000) If PixelGetColor( 1150 , 60 ) <> 725543 Then send ("~ exit {ENTER}") WinActivate ("List.txt - Notepad") sleep (2000) Send (" Dosnt Work! {down}") WinMinimizeAll ( ) endif If PixelGetColor( 1150 , 60 ) = 669032 Then send ("~ exit {ENTER}") WinActivate ("List.txt - Notepad") sleep (2000) Send (" Works! {down}") WinMinimizeAll ( ) endif WEnd Link to comment Share on other sites More sharing options...
herewasplato Posted May 4, 2005 Share Posted May 4, 2005 AutoItSetOption("TrayIconDebug", 1) ;0-off add this to the start of the real - unsantized - version of you script, run it and tell us what line it hangs on - my guess is one of the winwaits does not have a perfect title... but that is just a wild guess mouse over the autoit icon in the "system tray" or whatever it is called this week later [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
BladeZ Posted May 4, 2005 Author Share Posted May 4, 2005 its not hanging at any line it just doesnt want to read the next line of the text file Link to comment Share on other sites More sharing options...
steveR Posted May 4, 2005 Share Posted May 4, 2005 (edited) take the openFile out of the while loop. And you need to incremete $i each time through the loop.see what this does: expandcollapse popup$Filename = "C:\List.txt" $i = 0 $OpenFile = FileOpen($Filename, 0) While $i <= 10 $Line = FileReadLine($OpenFile) RegWrite("regkey", "key", "REG_SZ", $Line) Run("C:\someprogram") WinActivate("2004") WinWaitActive("2004") Sleep(2000) MouseClick("left", 1150, 60) Sleep(2000) Send("{tab 1} {enter}") Sleep(2000) If PixelGetColor(1150, 60) <> 725543 Then Send("~ exit {ENTER}") WinActivate("List.txt - Notepad") Sleep(2000) Send(" Dosnt Work! {down}") WinMinimizeAll() EndIf If PixelGetColor(1150, 60) = 669032 Then Send("~ exit {ENTER}") WinActivate("List.txt - Notepad") Sleep(2000) Send(" Works! {down}") WinMinimizeAll() EndIf $i = $i + 1 WEnd FileClose($OpenFile) Edited May 4, 2005 by steveR AutoIt3 online docs Use it... Know it... Live it...MSDN libraryglobal Help and SupportWindows: Just another pane in the glass. Link to comment Share on other sites More sharing options...
BladeZ Posted May 4, 2005 Author Share Posted May 4, 2005 ok its working good for now 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