Jump to content

Loop getting stuck


aa2zz6
 Share

Recommended Posts

This is what I meant by putting it into an Array, unfortunately I'm only guessing what the Search Criteria is and also the command line

PS: Why do you use @AutoItExe in your command lines since the scripts are already compiled as .exe?

Local $debug = True
#include <Array.au3>

Global $aSearch[4][3]
$aSearch[0][0] = 3

;~ Search Explorer Criteria
$aSearch[1][0] = 'Explorer=true'
;~ Result for Search Explorer Critera initially set to false
$aSearch[1][1] = False
;~ ArcGIS Explorer Commandline
$aSearch[1][2] = @AutoItExe & ' "' & @ScriptDir & '\E3.exe"'

;~ Search Settings Criteria
$aSearch[2][0] = 'Settings=true'
;~ Result for Search Settings Critera initially set to false
$aSearch[2][1] = False
;~ ArcGIS Settings Commandline
$aSearch[2][2] = @AutoItExe & ' "' & @ScriptDir & '\Settings.exe"'

;~ Search Monitor Criteria
$aSearch[3][0] = 'Monitor=true'
;~ Result for Search Monitor Critera initially set to false
$aSearch[3][1] = False
;~ ArcGIS Monitor Commandline
$aSearch[3][2] = @AutoItExe & ' "' & @ScriptDir & '\Directories\Scripts\[0] Monitor Log\Monitor.exe"'

For $x = 1 To $aSearch[0][0]
    $aSearch[$x][1] = _ReadLogFile($aSearch[$x][0])
    ;~ Uncomment the line below to Run the executable
    ;~ If $aSearch[$x][1] = True Then RunWait($aSearch[$x][2])
Next

_ArrayDisplay($aSearch)

Func _ReadLogFile($sSearch)
    Local $line_read
    Local $Map_Settings = @ScriptDir & '\Map Settings.log'
    Local $handle_read = FileOpen($Map_Settings, 0)
    While 1
        ; read each line from a file
        $line_read = FileReadLine($handle_read)
        ; exit the loop if end of file
        If @error Then ExitLoop
        If $debug Then ConsoleWrite('Read Line: ' & $line_read & @CRLF)

        If StringInStr($line_read, $sSearch) Then Return True
    WEnd
    ;~ $sSearch was not found
    Return False
EndFunc

 

Link to comment
Share on other sites

#include <File.au3>
#include <Array.au3>

Local $debug = True
Local Const $Map_Settings = @ScriptDir & '\Map Settings.log'
Global $True = "True"
Global $False = "False"
$handle_read = FileOpen($Map_Settings)
Local $iCountLines = _FileCountLines($Map_Settings)
While 1
    For $l = 1 to $iCountLines
    $line_read = FileReadLine($handle_read)
    If @error Then ExitLoop
    If $debug Then ConsoleWrite('Read Line: ' & $line_read & @CRLF)
    If StringInStr($line_read, $True, 2, 1) Then
       ConsoleWrite('Result - '& $True &' - '&@MSEC&@CRLF)
        ;RunWait(@AutoItExe & ' "' & @ScriptDir & '\Directories\Scripts\[0] Monitor Log\Monitor.exe"')
        Monitor($True)
        ExitLoop
    EndIf
    If StringInStr($line_read, $False, 2, 1) Then
        ;RunWait(@AutoItExe & ' "' & @ScriptDir & '\E3.exe"')
        E3EXE($False)
        ExitLoop
    EndIf
    Next
    Sleep(100)
WEnd

Func Monitor($True)
    ConsoleWrite(' - '& $True &' - '&@MSEC&@CRLF)
EndFunc

Func E3EXE($False)
    ConsoleWrite(' - '& $False &' - '&@MSEC&@CRLF)
EndFunc

Line-by-line and functions.

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
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
 Share

  • Recently Browsing   0 members

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