Jump to content

Recommended Posts

Posted

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

Posted

$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
Posted

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
Posted

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]

Posted (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 by Burrup

qq

Posted

$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

Posted

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]

Posted (edited)

take the openFile out of the while loop. And you need to incremete $i each time through the loop.see what this does:

$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 by steveR
AutoIt3 online docs Use it... Know it... Live it...MSDN libraryglobal Help and SupportWindows: Just another pane in the glass.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...