Sign in to follow this  
Followers 0
biase

Need to know how to make this process/gui not hang

11 posts in this topic

#1 ·  Posted (edited)

I make a simple Lan IP Scanner, but it hang. Is there a way to make it better?

#include
#include
#include
#include
#include
#Region ### START Koda GUI section ### Form=f:mysoftfactoryportable autoit3 v3.3.6.1form desingerformsudpresolver.kxf
$GLANResolver = GUICreate("BX - LAN Resolver", 618, 370, 628, 246)
$BStart = GUICtrlCreateButton("Start", 541, 344, 75, 25)
$BClose = GUICtrlCreateButton("Close", 0, 344, 75, 25)
$LV1 = GUICtrlCreateListView("IP Address|Alive|Name", 0, 0, 618, 342)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Local $l[256]
TCPStartup()

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $BClose
Exit
Case $BStart
DoScan()
EndSwitch
WEnd

Func DoScan()
For $i = 1 To 255
$ip = "192.168.0." & $i
Sleep(100)
$l[$i] = GUICtrlCreateListViewItem($ip &'|'& Ping($ip, 250) &'ms|'& _TCPIpToName($ip), $LV1)
Next
EndFunc
Edited by biase

Share this post


Link to post
Share on other sites



Your script needs some error checking (Was TCPStartup successfull etc.).

I'm not sure your script hangs. Default timeout for Ping is 4 seconds. If you have a lot of IP-addresses you can't ping then the script will run for a very long time.

Put some debug statements into your script (e.g. before Ping write the IP address you process to the console etc.)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

USe multiprocessing since sadly, there's no multithreading.

since you're going to scan a bunch of stuff, this is what I usually try doing~

#NoTrayIcon
#include <Inet.au3>
#include <WindowsConstants.au3>
#include <MenuConstants.au3>
#include <Array.au3>

Global Const $tagPROCESSENTRY32 = "dword dwsize;" & _
        "dword cntUsage;" & _
        "dword th32ProcessID;" & _
        "uint th32DefaultHeapID;" & _
        "dword th32ModuleID;" & _
        "dword cntThreads;" & _
        "dword th32ParentProcessID;" & _
        "long pcPriClassBase;" & _
        "dword dwFlags;" & _
        "char szExeFile[260]"

Global Const $sMailSlotName = "\\.\mailslot\scriptkittie" ; IPC Slotname
Global $hMailSlot
Global $Started = False
Global $StopOperation = 0

If $CmdLine[0] Then Exit _CheckIP()

Global $GLANResolver = GUICreate("BX - LAN Resolver", 618, 370, 628, 246)
Global $BStart = GUICtrlCreateButton("Start", 541, 344, 75, 25)
Global $BClose = GUICtrlCreateButton("Close", 0, 344, 75, 25)
Global $LV1 = GUICtrlCreateListView("IP Address|Latency|Name", 0, 0, 618, 342)
Global $hLV1 = GUICtrlGetHandle($LV1)
GUISetState()

GUIRegisterMsg($WM_SYSCOMMAND, "WM_SYSCOMMAND")
GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

Global $ip = "192.168.0."

$hMailSlot = _MailSlotCreate($sMailSlotName)
If @error Then Exit MsgBox(16, "Error!", "Unable to create IPC mailslot, this can mean another instance is running!")

Sleep(999999999)

Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
    #forceref $hwnd, $iMsg, $ilParam

    Local $LowWord = BitAND($iwParam, 0xFFFF)
    Switch $hWnd
        Case $GLANResolver
            Switch $LowWord
                Case $BStart
                    If Not $Started Then
                        $Started = True
                        $StopOperation = 0
                        AdlibRegister('DoScan', 1); call via adlib so we can inturrupt it when neccasary
                        GUICtrlSetData($BStart, "Stop")
                    Else
                        $StopOperation = 1
                    EndIf

                Case $BClose
                    Exit

            EndSwitch
    EndSwitch

    Return 'GUI_RUNDEFMSG'
EndFunc   ;==>WM_COMMAND

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    #forceref $hWnd, $iMsg, $iwParam
    Local $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    Local $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    ;Local $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
    Local $iCode = DllStructGetData($tNMHDR, "Code")

    Switch $hWndFrom
        Case $hLV1
            Switch $iCode
                Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button

                    Local $Temp = StringSplit(GUICtrlRead(GUICtrlRead($LV1)), "|", 2)

                    ConsoleWrite( _
                        @CR & _
                        ">========" & @CR & _
                        "!Address: " & $Temp[0] & @CR & _
                        "-Latency: " & $Temp[1] & @CR & _
                        "+TCPName: " & $Temp[2] & @CR & _
                        ">========" & @CR _
                    )

            EndSwitch
    EndSwitch
    ;ConsoleWrite($iCode&@CR)
    Return 'GUI_RUNDEFMSG'
EndFunc   ;==>WM_NOTIFY

Func WM_SYSCOMMAND($hWnd, $iMsg, $iwParam, $ilParam)
    #forceref $hWnd, $iMsg, $iwParam, $ilParam

    Switch $hWnd
        Case $GLANResolver
            Switch BitAND($iwParam, 0xFFF0)
                Case $SC_CLOSE
                    _MailSlotClose($hMailSlot)
                    Exit
            EndSwitch
    EndSwitch

    Return 'GUI_RUNDEFMSG'
EndFunc

Func _CheckIP()
    $CmdLineRaw = StringRegExp($CmdLineRaw, "(?i)--[a-z0-9-]{1,25}?=(.*?)\s", 3); get command line parameters
    If @error Then
        MsgBox(16, "Error: Unknown parameter!", "The parameters supplied to the program could not be understood.")
        Exit 1
    EndIf

    Local $ip = $CmdLineRaw[0]

    _MailSlotWrite($sMailSlotName, '<address="' & $ip & '" stats="' & Ping($ip, 250) & '" _TCPIpToName="' & _TCPIpToName($ip) & '">')
EndFunc

Func DoScan()

    AdlibUnRegister("doscan")

    Local $Parameters

    For $i = 1 To 255

        If $StopOperation Then ExitLoop

        $Parameters = " --Address=" & $ip & $I

        Switch @Compiled
            Case True
                Run(FileGetShortName(@ScriptFullPath) & " " & $Parameters & " ")
            Case False
                Run(FileGetShortName(@AutoItExe) & ' /AutoIt3ExecuteScript ' & FileGetShortName(@ScriptFullPath) & $Parameters & " ")
        EndSwitch

         _CheckResults()

        While 1
            _ProcessGetChildren(@AutoItPID)
            If (@extended < 7) Then; 7 is how many processes can run
                Sleep(500)
                ContinueLoop 2
            Else
                Sleep(700)
            EndIf
        WEnd
    Next

    $Started = 0
    $StopOperation = 0

    _CheckResults()

    GUICtrlSetData($BStart, "Start")

EndFunc

Func _CheckResults()
    Local $iSize = _MailSlotCheckForNextMessage($hMailSlot)
    If $iSize Then
        While 1
            $Ret = _MailSlotRead($hMailSlot, $iSize, 1)
            Sleep(10)
            $Ret = StringRegExp($Ret, '<address="([^"]+)" stats="([^"]+)" _TCPIpToName="([^"]+)?">', 3)
            If Not @error Then
                Switch UBound($Ret)
                    Case 2
                        GUICtrlCreateListViewItem($Ret[0] & "|" & $Ret[1] & "|N/A", $LV1)
                    Case 3
                        GUICtrlCreateListViewItem($Ret[0] & "|" & $Ret[1] & "|" & $Ret[2], $LV1)
                EndSwitch
            EndIf
            $iSize = _MailSlotCheckForNextMessage($hMailSlot)
            If Not $iSize Then ExitLoop
        WEnd
    EndIf
    Return SetError(0, 0, 0)
EndFunc   ;==>_CheckResults

#Region - MailSlot.au3 by trancexx (trancexx at yahoo dot com) -

; #FUNCTION# ====================================================================================================================
; Name ..........: _ProcessGetChildren
; Description ...: Returns onfo about child processes of given process
; Syntax ........: _ProcessGetChildren($i_PID)
; Parameters ....: $i_PID               - An integer value.
; Return values .: Number of child processes is in @Extended, PID array is in return value
; Author ........: ???
; ===============================================================================================================================
Func _ProcessGetChildren($i_PID)
    Local Const $TH32CS_SNAPPROCESS = 0x00000002

    Local $a_tool_help = DllCall("Kernel32.dll", "long", "CreateToolhelp32Snapshot", "int", $TH32CS_SNAPPROCESS, "int", 0)
    If IsArray($a_tool_help) = 0 Or $a_tool_help[0] = -1 Then Return SetError(1, 0, $i_PID)

    Local $sPROCESSENTRY32 = DllStructCreate($tagPROCESSENTRY32)
    DllStructSetData($sPROCESSENTRY32, 1, DllStructGetSize($sPROCESSENTRY32))

    Local $p_PROCESSENTRY32 = DllStructGetPtr($sPROCESSENTRY32)

    Local $a_pfirst = DllCall("Kernel32.dll", "int", "Process32First", "long", $a_tool_help[0], "ptr", $p_PROCESSENTRY32)
    If IsArray($a_pfirst) = 0 Then Return SetError(2, 0, $i_PID)

    Local $a_pnext, $a_children[11][2] = [[10]], $i_child_pid, $i_parent_pid, $i_add = 0
    $i_child_pid = DllStructGetData($sPROCESSENTRY32, "th32ProcessID")
    If $i_child_pid <> $i_PID Then
        $i_parent_pid = DllStructGetData($sPROCESSENTRY32, "th32ParentProcessID")
        If $i_parent_pid = $i_PID Then
            $i_add += 1
            $a_children[$i_add][0] = $i_child_pid
            $a_children[$i_add][1] = DllStructGetData($sPROCESSENTRY32, "szExeFile")
        EndIf
    EndIf

    While 1
        $a_pnext = DllCall("Kernel32.dll", "int", "Process32Next", "long", $a_tool_help[0], "ptr", $p_PROCESSENTRY32)
        If IsArray($a_pnext) And $a_pnext[0] = 0 Then ExitLoop
        $i_child_pid = DllStructGetData($sPROCESSENTRY32, "th32ProcessID")
        If $i_child_pid <> $i_PID Then
            $i_parent_pid = DllStructGetData($sPROCESSENTRY32, "th32ParentProcessID")
            If $i_parent_pid = $i_PID Then
                If $i_add = $a_children[0][0] Then
                    ReDim $a_children[$a_children[0][0] + 11][2]
                    $a_children[0][0] = $a_children[0][0] + 10
                EndIf
                $i_add += 1
                $a_children[$i_add][0] = $i_child_pid
                $a_children[$i_add][1] = DllStructGetData($sPROCESSENTRY32, "szExeFile")
            EndIf
        EndIf
    WEnd

    If $i_add <> 0 Then
        ReDim $a_children[$i_add + 1][2]
        $a_children[0][0] = $i_add
    EndIf

    DllCall("Kernel32.dll", "int", "CloseHandle", "long", $a_tool_help[0])
    If $i_add Then Return SetError(0, $i_add, $a_children)
    Return SetError(3, 0, 0)
EndFunc   ;==>_ProcessGetChildren

; #FUNCTION# ;===============================================================================
;
; Name...........: _MailSlotCheckForNextMessage
; Description ...: Checks for presence of a new message.
; Syntax.........: _MailSlotCheckForNextMessage ($hMailSlot)
; Parameters ....: $hMailSlot - Mailslot handle
; Return values .: Success - Returns 0 if there is no message or the size of a new message in bytes if there is one
;                          - Sets @error to 0
;                  Failure - Returns 0 and sets @error:
;                  |1 - GetMailslotInfo function or call to it failed.
; Author ........: trancexx
; Modified.......:
; Link ..........; http://msdn.microsoft.com/en-us/library/aa365435(VS.85).aspx
;
;==========================================================================================
Func _MailSlotCheckForNextMessage($hMailSlot)

    Local $aCall = DllCall("kernel32.dll", "int", "GetMailslotInfo", _
            "ptr", $hMailSlot, _
            "dword*", 0, _
            "dword*", 0, _
            "dword*", 0, _
            "dword*", 0)

    If @error Or Not $aCall[0] Then
        Return SetError(1, 0, 0)
    EndIf

    If $aCall[3] = -1 Or Not $aCall[4] Then
        Return 0
    Else
        Return $aCall[3]
    EndIf

EndFunc   ;==>_MailSlotCheckForNextMessage

; #FUNCTION# ;===============================================================================
;
; Name...........: _MailSlotRead
; Description ...: Reads messages from the specified mailslot.
; Syntax.........: _MailSlotRead ($hMailSlot , $iSize [, $iMode])
; Parameters ....: $hMailSlot - Mailslot handle
;                  $iSize - The number of bytes to read.
;                  $iMode - Reading mode.
;                             Can be: 0 - read binary
;                                     1 - read ANSI
;                                     2 - read UTF8
; Return values .: Success - Returns read data
;                          - Sets @extended to number of read bytes
;                          - Sets @error to 0
;                  Special: Sets @error to -1 if specified buffer to read to is too small.
;                  Failure - Returns empty string and sets @error:
;                  |1 - DllCall() to ReadFile failed.
;                  |2 - GetLastError function or call to it failed.
;                  |3 - ReadFile function failed. @extended will be set to the return value of the GetLastError function.
; Author ........: trancexx
; Modified.......:
; Link ..........; http://msdn.microsoft.com/en-us/library/aa365467(VS.85).aspx
;                  http://msdn.microsoft.com/en-us/library/ms679360(VS.85).aspx
;
;==========================================================================================
Func _MailSlotRead($hMailSlot, $iSize, $iMode = 0)

    Local $tDataBuffer = DllStructCreate("byte[" & $iSize & "]")

    Local $aCall = DllCall("kernel32.dll", "int", "ReadFile", _
            "ptr", $hMailSlot, _
            "ptr", DllStructGetPtr($tDataBuffer), _
            "dword", $iSize, _
            "dword*", 0, _
            "ptr", 0)

    If @error Then
        Return SetError(1, 0, "")
    EndIf

    If Not $aCall[0] Then
        Local $aLastErrorCall = DllCall("kernel32.dll", "int", "GetLastError")
        If @error Then
            Return SetError(2, 0, "")
        EndIf
        If $aLastErrorCall[0] = 122 Then ; ERROR_INSUFFICIENT_BUFFER
            Return SetError(-1, 0, "")
        Else
            Return SetError(3, $aLastErrorCall[0], "")
        EndIf
    EndIf

    Local $vOut

    Switch $iMode
        Case 1
            $vOut = BinaryToString(DllStructGetData($tDataBuffer, 1))
        Case 2
            $vOut = BinaryToString(DllStructGetData($tDataBuffer, 1), 4)
        Case Else
            $vOut = DllStructGetData($tDataBuffer, 1)
    EndSwitch

    Return SetError(0, $aCall[4], $vOut)

EndFunc   ;==>_MailSlotRead

; #FUNCTION# ;===============================================================================
;
; Name...........: _MailSlotWrite
; Description ...: Writes message to the specified mailslot.
; Syntax.........: _MailSlotWrite ($sMailSlotName , $vData [, $iMode])
; Parameters ....: $hMailSlot - Mailslot name
;                  $vData - Data to write.
;                  $iMode - Writing mode.
;                             Can be: 0 - write binary
;                                     1 - write ANSI
;                                     2 - write UTF8
; Return values .: Success - Returns the number of written bytes
;                          - Sets @error to 0
;                  Failure - Returns empty string and sets @error:
;                  |1 - CreateFileW function or call to it failed.
;                  |2 - WriteFile function or call to it failed.
;                  |3 - Opened mail slot handle could not be closed.
;                  |4 - WriteFile function or call to it failed and additionally opened mail slot handle could not be closed.
; Author ........: trancexx
; Modified.......:
; Link ..........; http://msdn.microsoft.com/en-us/library/aa363858(VS.85).aspx
;                  http://msdn.microsoft.com/en-us/library/aa365747(VS.85).aspx
;                  http://msdn.microsoft.com/en-us/library/ms724211(VS.85).aspx
;
;==========================================================================================
Func _MailSlotWrite($sMailSlotName, $vData, $iMode = 0)

    Local $aCall = DllCall("kernel32.dll", "ptr", "CreateFileW", _
            "wstr", $sMailSlotName, _
            "dword", 0x40000000, _ ; GENERIC_WRITE
            "dword", 1, _ ; FILE_SHARE_READ
            "ptr", 0, _
            "dword", 3, _ ; OPEN_EXISTING
            "dword", 0, _ ; SECURITY_ANONYMOUS
            "ptr", 0)

    If @error Or $aCall[0] = -1 Then
        Return SetError(1, 0, 0)
    EndIf

    Local $hMailSlotHandle = $aCall[0]

    Local $bData

    Switch $iMode
        Case 1
            $bData = StringToBinary($vData, 1)
        Case 2
            $bData = StringToBinary($vData, 4)
        Case Else
            $bData = $vData
    EndSwitch

    Local $iBufferSize = BinaryLen($bData)

    Local $tDataBuffer = DllStructCreate("byte[" & $iBufferSize & "]")
    DllStructSetData($tDataBuffer, 1, $bData)

    $aCall = DllCall("kernel32.dll", "int", "WriteFile", _
            "ptr", $hMailSlotHandle, _
            "ptr", DllStructGetPtr($tDataBuffer), _
            "dword", $iBufferSize, _
            "dword*", 0, _
            "ptr", 0)

    If @error Or Not $aCall[0] Then
        $aCall = DllCall("kernel32.dll", "int", "CloseHandle", "ptr", $hMailSlotHandle)
        If @error Or Not $aCall[0] Then
            Return SetError(4, 0, 0)
        EndIf
        Return SetError(2, 0, 0)
    EndIf

    Local $iOut = $aCall[4]

    $aCall = DllCall("kernel32.dll", "int", "CloseHandle", "ptr", $hMailSlotHandle)
    If @error Or Not $aCall[0] Then
        Return SetError(3, 0, $iOut)
    EndIf

    Return $iOut

EndFunc   ;==>_MailSlotWrite

; #FUNCTION# ;===============================================================================
;
; Name...........: _MailSlotCreate
; Description ...: Creates a mailslot with the specified name.
; Syntax.........: _MailSlotCreate ($sMailSlotName [,$iSize [, $iTimeOut [, $pSecurityAttributes])
; Parameters ....: $sMailSlotName - The name of the mailslot
;                  $iSize - The maximum size of a single message that can be written to the mailslot, in bytes. 0 means any size.
;                  $iTimeOut - The time a read operation can wait for a message to be written to the mailslot before a time-out occurs, in milliseconds.
;                              Can be 0 - returns immediately if no message is present
;                                     -1 (minus one) - waits forever for a message
;                  $pSecurityAttributes - A pointer to a SECURITY_ATTRIBUTES structure. 0 means the handle cannot be inherited.
; Return values .: Success - Returns a handle that a mailslot server can use to perform operations on the mailslot
;                          - Sets @error to 0
;                  Failure - Returns -1 and sets @error:
;                  |1 - CreateMailslotW function or call to it failed.
; Author ........: trancexx
; Modified.......:
; Remarks .......: Mailslot name must have the following form and must be unique: \\.\mailslot\[path]name
;                  The name may include multiple levels of pseudo directories separated by backslashes.
;                  For example \\.\mailslot\abc\def\ghi is valid name too.
; Link ..........; http://msdn.microsoft.com/en-us/library/aa365147(VS.85).aspx
;
;==========================================================================================
Func _MailSlotCreate($sMailSlotName, $iSize = 0, $iTimeOut = 0, $pSecurityAttributes = 0)

    Local $aCall = DllCall("kernel32.dll", "ptr", "CreateMailslotW", _
            "wstr", $sMailSlotName, _
            "dword", $iSize, _
            "dword", $iTimeOut, _
            "ptr", $pSecurityAttributes)

    If @error Or $aCall[0] = -1 Then
        Return SetError(1, 0, -1)
    EndIf

    Return $aCall[0]

EndFunc   ;==>_MailSlotCreate

; #FUNCTION# ;===============================================================================
;
; Name...........: _MailSlotClose
; Description ...: Closes mailslot.
; Syntax.........: _MailSlotClose ($hMailSlot)
; Parameters ....: $hMailSlot - Mailslot handle
; Return values .: Success - Returns 1
;                          - Sets @error to 0
;                  Failure - Returns 0 and sets @error:
;                  |1 - CloseHandle function or call to it failed.
; Author ........: trancexx
; Modified.......:
; Link ..........; http://msdn.microsoft.com/en-us/library/ms724211(VS.85).aspx
;
;==========================================================================================
Func _MailSlotClose($hMailSlot)

    Local $aCall = DllCall("kernel32.dll", "int", "CloseHandle", "ptr", $hMailSlot)

    If @error Or Not $aCall[0] Then
        Return SetError(1, 0, 0)
    EndIf

    Return 1

EndFunc   ;==>_MailSlotClose

#EndRegion - MailSlot.au3 by trancexx (trancexx at yahoo dot com) -

I included part of a script called mailslot by trancexx, it helps a lot with IPC.

Share this post


Link to post
Share on other sites

May i know why you use "Sleep" instead of "While" and "GUIRegisterMsg" instead of "GUIGetMsg"?

I need to Google more about MailSlot function and can you tell me how to use "multiprocessing" correctly?

Share this post


Link to post
Share on other sites

May i know why you use "Sleep" instead of "While" and "GUIRegisterMsg" instead of "GUIGetMsg"?

I need to Google more about MailSlot function and can you tell me how to use "multiprocessing" correctly?

MailSlot UDF can be found It's mainly used to communicate with child processes as in the script I posted I guess.

I use a sleep instead of a while loop just cause, it's also smaller than a while and looks nicer to me as where the script stops falling through.

You can also do~

While Sleep(999999)

wend

if you're gonna use the GuiRegisterMsg() method of managing a GUI app.

As for why I use GuiRegisterMsg instead of GuiGetMsg.

I like using that method because if you click a button, you can call the function using the AutoIt function AdlibRegister()

When you call a function for execution in this way, you can use the same button to break through that functions execution and change a variables data and do other stuff.

As I did in the example, I use the same button to change the $StopOperation variable to something positive so that it stops the loop, instead of having some recursive message checking code built into the functions loops, I guess you can say it's personal taste, I just like doing things this way.

Also, you can get much more information from actions a user does using this method.

For example, try double clicking the listview when there's an item in it.

Share this post


Link to post
Share on other sites

FlutterShy,

There is GUIOnEventMode.


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

FlutterShy,

There is GUIOnEventMode.

I know, but then you have to set a function for every event etc, where you could take care of it all in one or two switch statments no?

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

I know, but then you have to set a function for every event etc, where you could take care of it all in one or two switch statments no?

OK. Just your method (which is clever) isn't for those becoming acquainted with AutoIt for the first time. Edited by guinness

_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

Well, when I started off, I was supprised to learn about GUIRegisterMsg, I wished I'd have learned about it earlier and how it helps you keep your gui a little more responsive and interactive.

Share this post


Link to post
Share on other sites

Well, when I started off, I was supprised to learn about GUIRegisterMsg, I wished I'd have learned about it earlier and how it helps you keep your gui a little more responsive and interactive.

Well it's limited. There is a warning to using GUIRegisterMsg and blocking functions.

Anyway, back on topic again. I just wanted to make the OP aware of other options available within AutoIt.


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

Thanks FlutterShy for the explanation..

I can see now how you make multi process running by using below code if i'm not wrong

Switch @Compiled
Case True
Run(FileGetShortName(@ScriptFullPath) & " " & $Parameters & " ")
Case False
Run(FileGetShortName(@AutoItExe) & ' /AutoIt3ExecuteScript ' & FileGetShortName(@ScriptFullPath) & $Parameters & " ")
EndSwitch

I'm still learning MailSlot, it'll take time for me to understand, but it's ok.

Share this post


Link to post
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
Sign in to follow this  
Followers 0