Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/03/2019 in all areas

  1. Here something that you could use : #include <GUIConstantsEx.au3> #include <GuiConstants.au3> #include <MsgBoxConstants.au3> Global $hGUI1, $g_hGUI2 = 9999, $g_idButton3 gui1() Func gui1() $hGUI1 = GUICreate("Gui 1", 200, 200, 100, 100, $WS_THICKFRAME) Local $idButton1 = GUICtrlCreateButton("Msgbox 1", 10, 10, 80, 30) Local $idButton2 = GUICtrlCreateButton("Show Gui 2", 10, 60, 80, 30) GUISetState(@SW_SHOW, $hGUI1) GUIRegisterMsg($WM_MOVE, "Move") GUIRegisterMsg($WM_SYSCOMMAND, "WM_SYSCOMMAND") GUISetState(@SW_SHOW) Local $aMsg While 1 $aMsg = GUIGetMsg(1) ; Use advanced parameter to get array Switch $aMsg[1] ; check which GUI sent the message Case $hGUI1 Switch $aMsg[0] ; Now check for the messages for $hGUI1 Case $GUI_EVENT_CLOSE ; If we get the CLOSE message from this GUI - we exit <<<<<<<<<<<<<<< ExitLoop Case $idButton1 MsgBox($MB_OK, "MsgBox 1", "Test from Gui 1") Case $idButton2 GUICtrlSetState($idButton2, $GUI_DISABLE) gui2() EndSwitch Case $g_hGUI2 Switch $aMsg[0] ; Now check for the messages for $g_hGUI2 Case $g_idButton3, $GUI_EVENT_CLOSE ; If we get the CLOSE message from this GUI - we just delete the GUI <<<<<<<<<<<<<<< GUIDelete($g_hGUI2) GUICtrlSetState($idButton2, $GUI_ENABLE) EndSwitch EndSwitch WEnd EndFunc ;==>gui1 Func gui2() Local $aPos = WinGetPos($hGUI1) $g_hGUI2 = GUICreate("", 200 - 2, 200, $aPos[0], $aPos[1]+$aPos[3], $WS_THICKFRAME, -1, $hGUI1) $g_idButton3 = GUICtrlCreateButton("Close", 10, 10, 80, 30) GUISetState() EndFunc ;==>gui2 Func Move($hWnd, $Msg, $wParam, $lParam) If $hWnd = $hGUI1 Then Local $ParentPosArr = WinGetPos($hGUI1) WinMove($g_hGUI2, "", $ParentPosArr[0], $ParentPosArr[1] + $ParentPosArr[3]) EndIf Return $GUI_RUNDEFMSG EndFunc ;==>Move Func WM_SYSCOMMAND($hWnd, $Msg, $wParam, $lParam) Const $SC_MOVE = 0xF010 If $hWnd <> $hGUI1 And BitAND($wParam,0xFFF0) = $SC_MOVE Then Return False Return $GUI_RUNDEFMSG EndFunc
    2 points
  2. 403: a good starting point for an investigation!
    2 points
  3. This is a simple and practical way to start and manage many processes. I use it to quickly query many remote clients for varyous informations. For processes I mean external programs that can run autonomously and that allows I/O redirection. Here the advantage is that when you start a process, you can also determine which function in your main program should receive results when the external process finishes executing. So you can have different processes and different "callback" functions. The whole works nearly autonomously and asynchronously. While spawned processes works, you can perform other tasks in the main script and leave the worry of receiving and managing the results, to the pre-established functions. As I sayd, everything is almost completely automatic and the processes do their work asynchronously and independently of the flow of the main script. To check and manage processes status, you have only to call as often as possible the _TasksCheckStatus() function that will quickly handle the running processes. AdlibRegister() could be used for this ripetitive "polling". In short: 1) setup single commandlines that will "generate" your wanted result 2) establish wich function of your main script should receive the above result 3) an optional Timeout in seconds is allowed (task from point 1 will be killed at timeout) see function header for details. The provided example of use, needs to be executed in a network environment with preferably many clients, and you have to be administrator. Populate the $aIPList[] array with ClientNames (or ip addresses), and this example script will query all the clients about some informations by running many processes asincronously. Then it will collect results from the processes as soon as "answers" are available and will populate the ListView with that data. I used a ListView so that you can see that all the cells will fill (quite quickly) in an asynchronous way. If you are not in a network with many clients, then this example is nearly useless... (sorry) Hope it can be of use... (suggestions, bug reports and emrovements are welcome) MultiTask.udf #include-once ; #include "Array.au3" ; #INDEX# ======================================================================================================================= ; Title .........: Multi Task Management (tasks spawned by the user via the _TaskRun function of this udf) ; AutoIt Version : ; Language ......: ; Description ...: Functions that assists to execute and manage user's spawned tasks. ; Author(s) .....: Chimp ; =============================================================================================================================== ; #CURRENT# ===================================================================================================================== ; _TaskRun Run a new task and stacks its references for later use ; _TasksCheckStatus Check the status of all running tasks and call the CallBack function when a task completed ; =============================================================================================================================== ; #INTERNAL_USE_ONLY#============================================================================================================ ; __TaskRemove frees task's stacked references ; __NOP No OPeration function ; =============================================================================================================================== Global $aTasks[1][7] = [[0]] ; Create and initialize the task reference stack to 0 ; #FUNCTION# ==================================================================================================================== ; Name ..........: _TaskRun ; Description ...: Runs a new task as specified in $sCommand ; Syntax ........: _TaskRun($vIndex, $sCommand[, $sParser = "__NOP"[, $vTimeout = False]]) ; Parameters ....: $vIndex - A variant value passed by the caller as a reference to this task. ; this value will be returned to the callback function along with results. ; ; $sCommand - A string value containing the full command to be executed ; ; $sParser - [optional] The name of the function to be called at the end of this task. ; Default is __NOP that is a "do nothing" function. ; P.S. ; the $aParser function will be called by the _TasksCheckStatus() function when ; this task will finish to run: ; an 1D array with 4 elements will be passed to the called function: ; element [0] the caller's index reference of this task ; element [1] the StdOut result of this task ; element [2] the StdErr result of this task ; element [3] the time spent by this task ; ; $vTimeout - [optional] A variant value. Default is False. ; if specified is the number of seconds for the Timeout. ; After this amount of seconds, if this task is still running, it is killed ; ; Return values .: the total number of stacked tasks ; Author ........: Chimp ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: ; =============================================================================================================================== Func _TaskRun($vIndex, $sCommand, $sParser = "__NOP", $vTimeout = False) ; ; Stack structure: ; ; +-----+ ; 0 | nr. | <-- [0][0] number of running tasks ; +-----+-----+-----+-----+-----+-----+-----+ ; 1 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | ; +-----+-----+-----+-----+-----+-----+-----+ ; n | * | * | * | * | * | * | * | ; | | | | | | | ; | | | | | | [n][6] setted with the TimerInit() value at the start of this task. ; | | | | | | ; | | | | | [n][5] contains the required Timeout in seconds (Default is set to False = no timeout) ; | | | | | ; | | | | [n][4] The CallBack function name that will receive the results of this task ; | | | | ; | | | [n][3] the error message returned by the StdErr stream of this task ; | | | ; | | [n][2] the result of the command returned by the StdOut stream of this task ; | | ; | [n][1] the reference of this task passed by the user (will be passed back to the caller along with results) ; | ; [n][0] the PID of this running task ; ReDim $aTasks[$aTasks[0][0] + 2][7] ; add a new element to the stack $aTasks[0][0] += 1 ; add 1 to the number of running tasks ; Run the passed command with the I/O streams redirected $aTasks[$aTasks[0][0]][0] = Run($sCommand, "", @SW_HIDE, 6) ; 6 -> $STDOUT_CHILD (0x2) + $STDERR_CHILD (0x4) ; store references of this task to the stack $aTasks[$aTasks[0][0]][1] = $vIndex $aTasks[$aTasks[0][0]][4] = $sParser $aTasks[$aTasks[0][0]][5] = $vTimeout ; can be False or the number of seconds for the timeout of this task $aTasks[$aTasks[0][0]][6] = TimerInit() ; store the TimerInit() value for this task Return $aTasks[0][0] ; return the total number of running tasks EndFunc ;==>_TaskRun ; #FUNCTION# ==================================================================================================================== ; Name ..........: _TasksCheckStatus ; Description ...: Scans the status of all active tasks and checks if some task has finished its job ; This function should be called as aften as possible ; Syntax ........: _TaskCheckStatus() ; Parameters ....: None ; Return values .: number of still running tasks; * see remarks ; Author ........: Chimp ; Modified ......: ; Remarks .......: When a task finish, it is removed from the stack and results are passed to the callback function. ; An 1D array with 4 elements will be passed to the called function: ; element [0] the caller's index reference of this task ; element [1] the StdOut result of this task ; element [2] the StdErr result of this task ; element [3] the time spent by this task (approximative time) ; is an approximate datum because it also includes the delay ; added by the main loop before calling _TasksCheckStatus() ; Related .......: ; Link ..........: ; Example .......: ; =============================================================================================================================== Func _TasksCheckStatus() If $aTasks[0][0] = 0 Then Return 0 ; if no tasks then return Local $bEndTask ; will be setted to True if the checked task has finished or is killed by timeout Local $iPointer = 1 ; start checking from first task in the stack Local $aResults[4] ; this Array will be loaded with the results of the task Local $sCallBack ; the name of the function to call when a task ends its job Local $aArgs[2] = ["CallArgArray", ""] ; "special" array will be loaded with parameters for the CallBack function While $iPointer <= $aTasks[0][0] $bEndTask = False $aTasks[$iPointer][2] &= StdoutRead($aTasks[$iPointer][0]) ; read and store the StdOut stream $aTasks[$iPointer][3] &= StderrRead($aTasks[$iPointer][0]) ; read and store the StdErr stream ; If @error Then ; if there is an @error is because this task has finished its job If Not ProcessExists($aTasks[$iPointer][0]) Then ; if this task has finished its job $bEndTask = True ; flag the end of the work ElseIf $aTasks[$iPointer][5] <> False Then ; if task is still running see if a Timeout check was rquired and if so if is been reached If Int(TimerDiff($aTasks[$iPointer][6]) / 1000) >= $aTasks[$iPointer][5] Then ; timeout reached or exceeded!! $aTasks[$iPointer][3] = "@error Timeout " & $aTasks[$iPointer][3] ; insert an error message at the beginning of the StdErr stream StdioClose($aTasks[$iPointer][0]) ; close I/O streams ProcessClose($aTasks[$iPointer][0]) ; kill this process $bEndTask = True ; flag the end of this task EndIf EndIf If $bEndTask Then ; if this task has finished, get its results and send to the CallBack function $aResults[0] = $aTasks[$iPointer][1] ; ............. Index (the caller reference) $aResults[1] = $aTasks[$iPointer][2] ; ............. the StdOut generated by this task $aResults[2] = $aTasks[$iPointer][3] ; ............. the StdErr generated by this task $aResults[3] = TimerDiff($aTasks[$iPointer][6]) ; .. time spent by this task $sCallBack = $aTasks[$iPointer][4] ; the name of the function to be called $aArgs[1] = $aResults ; second element of the "CallArgArray" special array contains the $aResults array ; loaded with the parameters to be send to the CallBack function. (array in array) ; (the CallBack function will receive only the 1D 4 elements array $aResults) __TaskRemove($iPointer) ; remove references of this task from the stack ; call the CallBack function and pass the results of this task. ; (CallBack function should return as soon as possible because it stops the CheckStatus for the other tasks) ; Call($sCallBack, $aArgs) ; Call CallBack function --->---+ ; | ; <--- and return here ---------------------------------+ EndIf $iPointer += 1 ; check next task WEnd Return $aTasks[0][0] EndFunc ;==>_TasksCheckStatus ; Internal use. Remove the task references from the stack Func __TaskRemove($iElement) #cs If $iElement > $aTasks[0][0] Or $iElement < 1 Then Return StdioClose($aTasks[$iElement][0]) _ArrayDelete($aTasks, $iElement) #ce ; - new -------------------------------------------------- ; remove element without the _Array* udf If $iElement > 0 And $iElement <= $aTasks[0][0] Then StdioClose($aTasks[$iElement][0]) If $aTasks[0][0] > 1 Then For $i = 0 To UBound($aTasks, 2) - 1 $aTasks[$iElement][$i] = $aTasks[$aTasks[0][0]][$i] Next EndIf Else Return ; queue is empty or the required element is out of bound EndIf $aTasks[0][0] -= 1 ReDim $aTasks[$aTasks[0][0] + 1][UBound($aTasks, 2)] Return $aTasks[0][0] ; returns the number of tasks still running EndFunc ;==>__TaskRemove ; Internal use. An empty function Func __NOP($aDummy) ; NOP (No OPeration) EndFunc ;==>__NOP Example of use ; #RequireAdmin #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> #include '.\MultiTask.au3' ; ; IMPORTANT following array should be populated with many real HostNames ; here are just nonsense items used as placeholders Global $aIPList[] = [@ComputerName, @IPAddress1, @ComputerName, @ComputerName, 'InexistentClient', @ComputerName] Global $hGrid ; The ListView Handle Global $ahGrid[1] ; An array to keep handles of any listview row Example() MsgBox(0, "Debug:", "Done" & @CRLF & "Hit OK to exit") Func Example() Local $Form1 = GUICreate("Clients status", 760, 400) ; ; Create the ListView $hGrid = GUICtrlCreateListView("HostName|IP|Info|Last reboot|CPU|Last logon|Current logon", 0, 0, 760, 400) _GUICtrlListView_SetColumnWidth($hGrid, 0, 140) ; HostName _GUICtrlListView_SetColumnWidth($hGrid, 1, 100) ; IP _GUICtrlListView_SetColumnWidth($hGrid, 2, 80) ; Ping info ms or Off or Unknown or Timeout) _GUICtrlListView_SetColumnWidth($hGrid, 3, 120) ; Last Reboot _GUICtrlListView_SetColumnWidth($hGrid, 4, 40) ; cpu load ; last 2 columns a mutually exclusive. If there is a user logged it's shown on the last column ; if there is not a user logged then the last user that was logged is shown on column 4 instead _GUICtrlListView_SetColumnWidth($hGrid, 5, 140) ; Last logged UserId (if nobody is logged now) _GUICtrlListView_SetColumnWidth($hGrid, 6, 140) ; Currently logged UserId _GUICtrlListView_SetExtendedListViewStyle($hGrid, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT)) ; show grid; select whole row ; GUISetState(@SW_SHOW) ; following line is needed if you have to refill the listview ; _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($hGrid)) ; empty the listview ReDim $ahGrid[UBound($aIPList)] ; this loop will run all needed tasks at once. ; The results of the tasks will be managed by the callback functions (nearly) autonomously and asynchronously For $i = 0 To UBound($aIPList) - 1 $ahGrid[$i] = _GUICtrlListView_AddItem($hGrid, "") ; create a listview row ; ; ... for each client ... ; ; spawn ping commands. result will be send to the _PingParse() function _TaskRun($i, "Ping -a -n 1 -4 " & $aIPList[$i], "_PingParse") ; spawn commands to recall LoggedOn User. Result will be send to the _LoggedOn() function _TaskRun($i, "wmic /node:" & $aIPList[$i] & " computersystem get username /value", "_LoggedOn", 5) ; 5 = timeout in 5 seconds ; spawn commands to recall Last reboot time. result will be send to the _LastReboot() function _TaskRun($i, "wmic /node:" & $aIPList[$i] & " os get lastbootuptime /value", "_LastReboot", 5) ; spawn commands to recall % of CPU load. result will be send to the _CPU_load() function _TaskRun($i, "wmic /node:" & $aIPList[$i] & " cpu get loadpercentage /value", "_CPU_load", 7) Next ; now, while all tasks are running ; we could perform other activities in the meantime ; or we can wait the end of all the tasks Do Sleep(250) ; you could perform other jobs here while waiting for the tasks to finish Until Not _TasksCheckStatus() ; <-- this function performs management of running tasks ; and should be called as often as possible EndFunc ;==>Example ; below are CallBack functions ; #FUNCTION# ==================================================================================================================== ; Name ..........: _PingParse (a callback function) ; Description ...: this function analize the output of a ping command and "extract" needed infos ; it fills columns 0 1 and 2 of the list view ($aTarget[0] is the line number of the listview to be filled) ; Syntax ........: _PingParse($aTarget[, $bDomain = True]) ; Parameters ....: $sTarget - An array with Ping results passed by the MultiTasks as soon as any ping task ends ; the passed array contains following data: ; $aTarget[0] Index for this task ; $aTarget[1] StdOut from ping (the whole output of the ping) ; $aTarget[2] StdErr from ping ; $aTarget[3] Time spent by this task to complete (is NOT the ping roundtrip time) ; $bDomain - [optional] A binary value. Default is True. (keep domain info in host name) ; ; Return values .: None. It Fills Listview columns 0, 1 and 2 ; column 0 : resolved HostName or "" ; column 1 : IP address or "" (this can contain last known IP even if now is offline) ; column 2 : roundtrip time or "Unknown" or "timeout" or "Off" ; ; Author ........: Chimp ; =============================================================================================================================== Func _PingParse($aTarget, $bDomain = True) ; $aTarget contains 4 elements: [0] Index, [1] StdOut, [2] StdErr, [3] time spent by this task Local $sOutput = $aTarget[1] ; stdout Local $0, $1, $2, $3, $aMs ; Local $iAnswer = -1, $iName = -1 Local $aResult[3] = ["", "", ""] ; [0]ms, [1]HostName, [2]IP $aMs = StringRegExp($sOutput, "([0-9]*)ms", 3) If Not @error Then ; Ping replayed $aResult[0] = $aMs[UBound($aMs) - 1] ; average ms Else ; $aResult[0] = "off" EndIf $0 = StringInStr($sOutput, "Ping") $1 = StringInStr($sOutput, "[") ; HostName decoded? If $1 Then ; HostName decoded $2 = StringInStr($sOutput, "]") $3 = StringInStr($sOutput, " ", 0, -2, $1) $aResult[1] = StringMid($sOutput, $3 + 1, $1 - $3 - 1) ; HostName $aResult[2] = StringMid($sOutput, $1 + 1, $2 - $1 - 1) ; IP Else If $0 Then ; pinging an IP address? ; $aResult[1] = "" ; no HostName Local $aFindIP = StringRegExp($sOutput, "\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b", 3) If Not @error Then $aResult[2] = $aFindIP[0] Else ; unknown HostName $aResult[0] = "Unknown" $aResult[1] = $aIPList[$aTarget[0]] ; retrieve HostName from the $aIPList array EndIf EndIf If $bDomain = False Then Local $aSplit = StringSplit($aResult[1], ".", 2) ; 2 = $STR_NOCOUNT $aResult[1] = $aSplit[0] ; romove .domain part from the HostName EndIf If StringLeft($aTarget[2], 14) = "@error Timeout" Then $aResult[0] = "Timeout" ; Now that we have the infos, we compile related cells in ListView ; grid row-handle data column _GUICtrlListView_SetItemText($hGrid, $ahGrid[$aTarget[0]], $aResult[1], 0) ; first column "HostName" _GUICtrlListView_SetItemText($hGrid, $ahGrid[$aTarget[0]], $aResult[2], 1) ; second column "IP address" _GUICtrlListView_SetItemText($hGrid, $ahGrid[$aTarget[0]], $aResult[0], 2) ; third column "Infos about the ping" ; ConsoleWrite("Debug: " & "-> " & $aResult[0] & @TAB & $aResult[1] & @TAB & $aResult[2] & @CRLF) EndFunc ;==>_PingParse Func _LastReboot($aParameters) ; Last reboot DateTime $aParameters[1] = StringStripWS($aParameters[1], 8) Local $equal = StringInStr($aParameters[1], "=") If $equal Then _GUICtrlListView_AddSubItem($hGrid, $ahGrid[$aParameters[0]], WMIDateStringToDate(StringMid($aParameters[1], $equal + 1)), 3) ; column 3 EndIf EndFunc ;==>_LastReboot Func _CPU_load($aParameters) ; % of CPU load $aParameters[1] = StringStripWS($aParameters[1], 8) Local $equal = StringInStr($aParameters[1], "=") If $equal Then _GUICtrlListView_AddSubItem($hGrid, $ahGrid[$aParameters[0]], StringMid($aParameters[1], $equal + 1), 4) ; column 4 EndIf EndFunc ;==>_CPU_load Func _LoggedOn($aParameters) ; User now logged $aParameters[1] = StringStripWS($aParameters[1], 8) ; if none is logged, then find the user that was last logged (also using _TaskRun) If $aParameters[1] = "" Or $aParameters[1] = "UserName=" Then ; following syntax is by @iamtheky (thanks) ; https://www.autoitscript.com/forum/topic/189845-regexp-pattern-in-findstr-dos-command/?do=findComment&comment=1363106 Local $sCmd = 'cmd /c FOR /F "usebackq skip=2 tokens=1-3" %A IN (`REG QUERY ' & '"\\' & $aIPList[$aParameters[0]] & _ '\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI" /REG:64 /v LastLoggedOnUser 2^>nul`) Do @echo %C' _TaskRun($aParameters[0], $sCmd, "_LastLogged", 5) ; find last logged user and, when ready, send result to _LastLogged() Else ; if someone is logged then write username to column 6 Local $aUser = StringSplit($aParameters[1], "=", 2) ; 2 = $STR_NOCOUNT _GUICtrlListView_AddSubItem($hGrid, $ahGrid[$aParameters[0]], $aUser[UBound($aUser) - 1], 6) ; column 6 EndIf EndFunc ;==>_LoggedOn Func _LastLogged($aParameters) _GUICtrlListView_AddSubItem($hGrid, $ahGrid[$aParameters[0]], $aParameters[1], 5) ; column 5 EndFunc ;==>_LastLogged Func WMIDateStringToDate($dtmDate) ; thanks to @kylomas ; https://www.autoitscript.com/forum/topic/169252-wmi-password-age-issue/?do=findComment&comment=1236082 ; reformat date to mm/dd/yyyy hh:mm:ss and zero fill single digit values Return StringRegExpReplace(StringRegExpReplace($dtmDate, '(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2}).*', '$2/$3/$1 $4:$5:$6'), '(?<!\d)(\d/)', '0$1') EndFunc ;==>WMIDateStringToDate
    1 point
  4. Thanks a lot BetaLeaf it was very helpful for me!
    1 point
  5. This is not an AutoIt3 issue as you clearly are living on the edge with the stuff you install. Just clean your PC from all malware in your prefered way or Simply reformat your harddisk. *click* Jos
    1 point
  6. Stop being surprised and yes this is meant as it sounds as this has been told to the OP a zillion times. Jos
    1 point
  7. He’s infected with malware it’s not his script. The user should scan his system for malware with Malwarebytes
    1 point
  8. To answer this question, you don't have to annoy Detective Columbo . It is sufficient to simply enter Http error 403 at Google. https://en.wikipedia.org/wiki/HTTP_403 https://www.howtogeek.com/357785/what-is-a-403-forbidden-error-and-how-can-i-fix-it/ @faustf : I am slightly surprised that a member with 1000+ posts asks such a question (not meant to be insulting).
    1 point
  9. Its an easy language to learn Its capable of controlling other applications: Click buttons, set textvalues, read values Easy to install from a zip or usb stick Small and quick IDE compared to the bigger ones for Java, C# just use Scite and you are up and running Small exe when compiled Examples in the help files are excellent Nowadays I would partly say that Powershell can also do a lot of stuff where I used AutoIt for in the past. Create simple and quick a GUI frontend No install (ISE is available on all Windows machines) AutoIt syntax I favor over PowerShell although both decided to have a $ in front of variable names
    1 point
  10. This comes close I feel https://github.com/genius257/AutoItObject-Internal although com based its really flexible And assigning functions to variables give you a lot of flexibility if you want for customizing logic/syntax $a=classA_b() $t=$a $a=classA_a() $t=$a $a=classB_b() $t=$a $a=classB_a() $t=$a func classA_a() consolewrite("a_a" & @CRLF) EndFunc func classA_b() consolewrite("a_b" & @CRLF) EndFunc func classB_a() consolewrite("b_a" & @CRLF) EndFunc func classB_b() consolewrite("b_b" & @CRLF) EndFunc
    1 point
  11. Here is a version that is a little cleaner. It checks whether it is inside a string and some comments added: ------------------------------------------------------------------------------- -- Select all quoted Text. ( All text between "" or '') function PersonalTools:SelectQuoatedText() local from = 0 local to = 0 -- Check whether we are inside a string. if editor.StyleAt[editor.CurrentPos] ~= SCE_AU3_STRING then print("! Cursor isn't inside a string.") return end -- find start of the string for i = editor.CurrentPos, editor:PositionFromLine(editor.CurrentPos), -1 do if editor.StyleAt[i] ~= SCE_AU3_STRING then from = i + 2 break end end -- find end of the string for i = editor.CurrentPos, editor.LineEndPosition[editor.CurrentPos] do if editor.StyleAt[i] ~= SCE_AU3_STRING then to = i - 1 break end end -- select total string editor:SetSel(from, to) end Jos
    1 point
  12. I have used freelance.com in the past, but from the time I spent there, it is a lot more competitive and freelance.com takes fees for almost anything (for placing a sponsored bid, taking a skill test, to withdraw money etc.) I have had much greater success through Upwork, in my opinion it is better than freelancer, there is a fixed fee that you pay Upwork for money earned by a single client, you have payment protection as long as you follow the rules, so that means even if a client plays it dirty, you are still guaranteed to earn the original amount that you have agreed upon (read the about fixed price protection carefully). The fee is not too bad and is simple to follow: 20% for first $500 10% after >$500 5% after >$10,000 The fee is calculated by lifetime earnings from a single client, so if you have a long-term client who has paid more than $10,000 for your services, then you only cut 5% of the following earnings to Upwork. It depends on what your client is looking for, and if they are a programmer and are wanting to deal with the script. If you are having a hard time with a task, then I do recommend planning out what you need and make sure that your requirements are clear before approaching a freelancer. Upwork also offers client payment protection, so as long as the requirements are clear, you should be on the safe side, even if the freelancer does not have a good will. From my personal experience, I am working with a client who has very good understanding of all programming concepts and has worked on many complex software projects, but they instead chose to focus on their business instead of the intricacies in programming (which can often get overwhelming, especially when you are running a business alongside). So at the moment I am taking care of all the code while my client takes care of testing and the higher level design of the code I do not think many do actually, most of them do it as a hobby or as part of their already existing traditional job. There are a few I know who do take up freelance work now and then, I am one of them myself (if you haven't figured out that by now ). From on top of my head, both @Xandy and @Danyfirex are open to freelance work, not sure I remember any other members who are know to work freelance. It is actually not that hard to become one, as long as you have the right skill and knowledge, you can utilize it to work on related jobs. Always be persistent when looking for jobs, especially in the beginning. It might not pay your bills until a few months, as your reputation on the site grows (ratings, client feedback, ranking/status), you will start getting a lot more jobs, enough to make a living if you plan it out just right. It might be worth trying this if you are not living independently and have someone who can take care of your expenses until you get on your feet.
    1 point
  13. I mostly like AutoIt for its ease of teaching. I personally believe a lot of beginner coders (especially older beginners) give up learning early due to a lack of *usable* results in a given time-frame. Telling someone to spend weeks learning about xyz to only come out with a knowledge of variables, operators, keywords etc. doesn't build confidence but oh wait... you can create a banana class and use that... where? (Is it showing that I'm not a proponent of OOPLs?) Inherently, the whole ethic of AutoIt means that within the first week of learning coding from knowing zero, your student has already created a GUI! This is huge IMO. It empowers the beginner and they *know* they can use that GUI for something. I've been using AutoIt solely for some time now, and have a bunch of applications installed on many computers at work. 100+ users per day; Admin dashboards for each app; logging, automated emails, web API calls, FTP usage, Excel and Word manipulation, Android adb interaction, etc etc etc... Not as much as other members here have made, but a complete ground-up re-write of an app that's fit for a corporate environment can take less than a day, including a smidgin of testing! And when you want to delete a project folder, you don't have to be patient with Windows while it hangs on "Calculating time required to delete files...". Code re-usability that doesn't come with the cost of a million dependencies, I could go on all day about why I love AutoIt but I think I'm just preaching to the choir by now 😛
    1 point
  14. Your questions are slightly unclear. Have a look at the gorgeous WinHttp.au3 from @trancexx : https://github.com/dragana-r/autoit-winhttp/releases (also contains a help file with examples)
    1 point
  15. AutoIt is a pretty good all-rounder, generally being capable of doing most things, and far speedier to get up & running than other languages in that regard, though not speedier when it comes to process execution, which is one of its few downfalls, but which rarely matters normally. At the end of the day, you should use the right tool for the right job, but if your Toolbox only contains AutoIt, you are still looking damn good and cooking with fire in 95%+ instances.
    1 point
  16. IanN1990, The text in a console window is usually written directly in the client area in the window with the DrawText function or the like. DrawText is a GDI (graphics) function and the text is simply colored pixels directly in the window. The text in a console window is comparable to an image and is not represented as an edit or text control and therefore cannot be automated either with UIA, MSAA or classic automation code. The text in Notepad or in a listbox, listview or treeview is, however, represented as a real edit or text control where the text is stored in a DllStruct (char, wchar, str, wstr, bstr or similar) that is included in the control. Therefore, these text controls can be automated. But this is not the case for the text in a console window and therefore the text cannot be automated.
    1 point
  17. Mbee, I think that modern GUIs is a common term for what you call non-standard GUIs. In order to be able to use UI Automation code, it's necessary at least to have an idea of what it's all about. There are links to Microsoft documentation in the help system in UIASpy. You can also read the How to topics which is a short introduction to both UI Automation code and the UIASpy tool. There are three posts in total. The first is a general introduction to UI Automation code. The second is about using the UIASpy tool. You can skip the third post. Add a new post if you have any questions. But please be specific. It's true that there is some redundancy regarding both UIASpy and UI Automation data. In UIASpy you can do the same things in several different ways. And you can also get the same UI Automation data in several different ways. It's also correct that I have not made a UDF in the same way as junkews UIAWrappers.au3. The idea of my project is precisely to avoid such a UDF. Instead, I want to use the Microsoft objects and methods directly only translated into AutoIt code. In UIASpy you can see what information is available to identify and find a specific window/control and you can see which patterns (actions) you can use. You can generate code to see eg. how the ObjCreateInterface command should look. Some of the more advanced object methods use safearrays as either input or output parameters. UIASpy can generate code to handle these safearrays. For very simple examples like my demo examples you can generate pretty accurate code with UIASpy. For more advanced automation tasks such as automating Comodo, it's necessary to put the different code snippets together into a final script. Why do I want to avoid a UDF like junkews UIAWrappers.au3? The whole idea of my project has been to add the new UI Automation features that have been added through Windows 8, 8.1 and 10. UIAWrappers.au3 contains functions. CUIAutomation2.au3 contains Windows 7 constants and definitions. All code can be used from Windows XP to Windows 10. But only Windows 7 constants, definitions and objects are supported. There are 2 main objects: $oUIAutomation and $oUIAutomationElement. The new features in Windows 8 - 10 are implemented through several new main objects that depends on a particular Windows version. It includes $oUIAutomation2, $oUIAutomation3, $oUIAutomation4, $oUIAutomation5, $oUIAutomationElement2, $oUIAutomationElement3, $oUIAutomationElement4, $oUIAutomationElement5, $oUIAutomationElement6, $oUIAutomationElement7 and $oUIAutomationElement8. If you have looked at the code in UIAWrappers.au3 (about 1,000 real code lines) then it's not difficult to imagine that integrating all these new objects into the code and taking into account different Windows versions is not quite trivial. And that's very mildly said. It'll be a huge task that's close to impossible. In my project, it's much easier. I can just add the new objects and methods to the existing arrays, and add code snippets to create the objects and methods. But I'll leave it to the user of UIASpy to select the objects that fit the Windows version and put all the code pieces together into a final script. I'll take a closer look at Comodo, but I'll probably need a week or two.
    1 point
  18. How to topics, 1 - 7 How to topics is a guide to use UIASpy to identify windows and controls and to create sample code to obtain information and perform actions. Topics 1 - 7: Introductory topics Top of next post (bottom of this post) Topics 8 - 15: Sample code creation Topics 16 - 17: Other How to topics How to perform UI Automation tasks How to use UIASpy to detect elements How to use UIASpy to create sample code How to create sample code through Detail info page How to create sample code through Sample code menu How to create sample code by copying listview rows How to create objects with ObjCreateInterface How to create UI Automation main objects How to identify and find application top window How to identify and find UI elements (controls) How to get UI element property values How to create element action objects How to get pattern property values How to perform element actions How to create executable code How to perform a mouse click in middle of bounding rectangle How to perform a control click via PostMessage and $UIA_AutomationIdPropertyId 1. How to perform UI Automation tasks UI Automation tasks are almost always performed in a top-down and step-by-step procedure. The task is divided into smaller sub-tasks that cannot be further divided. Each sub-task is performed in 2-4 steps. Clicking a button in a window is divided into 2 sub-tasks: Identify the window Identify and click the button The window that's identified in the first sub-task is used to identify the button in the second sub-task. Identifying the window is done in 2 steps: Create condition to identify the window Find the window based on the condition Identifying and clicking the button is done in 4 steps: Create condition to identify the button Find the button based on the condition Create an action to click the button Perform the action and click the button Here, the procedure is illustrated schematically: UIASpy can provide information to identify windows and controls and can generate sample code to implement the 2-4 steps. 2. How to use UIASpy to detect elements Open UIASpy. Click Left pane | Delete top windows to delete all treeview top windows. To detect a window, place the mouse cursor over the window title bar and press F2. To detect a control, place the mouse cursor over the control and press F1. Switch back to UIASpy window. 3. How to use UIASpy to create Sample code Through Sample code creation, you can more or less create all code in a simple automation task: Create UI Automation initial code Create condition and find application window Create condition and find control in window Get information about windows and controls Create pattern objects to perform actions Get information related to pattern objects Perform actions with pattern object methods Add a Sleep() statement if necessary In short, there are 3 ways to create sample code with UIASpy: Use the UIASpy Sample code main menu Right click a selected row in the Detail info listview page and Click Create sample code to create code based on selected row(s) Right click a selected row in the Detail info listview page or in a Sample code listview page and Click Copy to sample code to copy variable names and values to sample code (preferred) or Click Copy selected items to copy variable names and values to clipboard Then paste the code into an editor. 4. How to create sample code through Detail info page The Detail info listview page is also the default listview page. This makes sample code creation easy and fast. You can find a brief description with pictures and code snippets in the UIASpy thread. But not all code can be created this way. In many cases, there is a need to use the Sample code main menu. 5. How to create sample code through Sample code menu Much more code can be created through the Sample code menu than through the Detail info page. In addition, the menu can be used to set Sample code options and for Sample code maintenance. You can find a brief description with a picture in the UIASpy thread. 6. How to create sample code by copying listview rows To copy information from the Detail info listview page or a Sample code listview page into the editor right-click a selected row and click Copy to sample code: Paste the code into the editor: ; --- Copy element info --- ; $UIA_NativeWindowHandlePropertyId 0x00090244 7. How to create objects with ObjCreateInterface All objects needed in most automation tasks can be created using UIASpy sample code features. This is by far the easiest way to create the objects. There is really no need to create the objects in other ways. Top of post
    1 point
  19. Not quite. The WM message and also the Adlib is fired even if the working loop is currently occupied. From the MSDN documentation for WM_SYSCOMMAND ... "In WM_SYSCOMMAND messages, the four low-order bits of the wParam parameter are used internally by the system. To obtain the correct result when testing the value of wParam, an application must combine the value 0xFFF0 with the wParam value by using the bitwise AND operator."
    1 point
  20. Certainly not if names like malwareExe and malwareFilename are part of the source 🤔. Please post your script for further assistance.
    0 points
  21. CAPTCHA can't be bypass by web bots right ? we have to submit it to bypass websites i think
    0 points
×
×
  • Create New...