Leaderboard
Popular Content
Showing content with the highest reputation on 04/06/2019 in all areas
-
A cross-platform implementation of the AutoIt language
jchd and one other reacted to Earthshine for a topic
flat?2 points -
You say the AutoIt language is (essentially) fine for you and friendly to both new users and seasonned developpers. You also say you wouldn't like switching to something else, which I can understand. What you can do is create your own version of the language you whish (call it AutoToolIt) and develop a preprocessor, producing compilable Ruby, Python plus free Qt or whatever target language of your choice. It's much (very much) easier to write a syntax checker and preprocessor than a ful-blown compiler. AutoToolIt source -> syntax check & preprocessor -> Ruby or Python + Qt -> compiler + linker -> executable Note than even this easier path isn't a strait highway with no traffic nor speed limit.2 points
-
A cross-platform implementation of the AutoIt language
FrancescoDiMuro and one other reacted to jchd for a topic
I too voted No for essentially the same reasons exposed above by [Flat?] @Earthshine. AutoIt strength isn't the language per se, it's the large number of core functions and UDFs, both standard and add-ons. A very significant part of all this is intimately tied to Windows API and behavior. Just consider how hard it would be to port (the goal is porting AutoIt) GDI+, anything COM-related, All of GUI and _GUI, messaging ... and the huge rest. If I were you I'd start with Ruby or Python + free Qt or something similar. If you insist on making a user-friendly language à la AutoIt, create the grammar and syntax you dream of and develop a preprocessor aiming such a platform.2 points -
Come on folks, where is your heart, don't be so outright discouraging with your voting. Why so negative? Everything starts with a dream, and not all dreams come true, but allow him that one in a million chance ... you know you really want it. Truth or reality is often stranger than fiction. Anyway, a good experiment for the lad, and a wonderful journey .... sure to learn a thing or three. It's not like he is going to mortgage his house in this endeavor.2 points
-
So I wanted a free obfuscator that was coded in AutoIt3 and was actually decent. So I spliced together several different ones found across the web and spent about two weeks programming this one. It is capable of: Encrypting ALL strings (len > 1) Renaming vars Renaming functions The string encryption is really the most innovative part of my obfuscator and also was the biggest pain in the ass. If you need or want to use a seperate string encryption method just make sure its a stream algorithm similar to the way XOR functions (one mode) Anyways here's the script. ENJOY!!!! ; Title: CryptoDragon AutoIt Obfuscator ; Version: v1.4.0.1 ; Requirements: AutoIt Version 3.1.1.0 (Beta is NOT required) ; Date: November 6th, 2018 ; Authors: Freak, taurus905 ; Purpose: This script obfuscates an AutoIt script by identifying, counting and replacing all ; variables and functions within that script, as well as encrypting strings. according to the following notes. ; Notes: Variables that are all UPPERCASE, such as, $GUI_EVENT_CLOSE, will not be obfuscated. ; All strings with single and double quotes are to be encrypted with a multikey XOR algo. (in order) ; Add arguments in the "Functions_NOT_to_obfuscate_section:" to bypass these functions. ; Uncomment: (in the script) ; Global $Show_Messages = "Yes" ; to show Message Boxes and Array Displays during execution. ; Input: An AutoIt Script --> OriginalScriptName.au3 ; Output: Variables to be Obfuscated --> OriginalScriptName - Vars to Obfuscate.txt ; Functions to be Obfuscated --> OriginalScriptName - Funcs to Obfuscate.txt ; Random Names --> OriginalScriptName - Random Names.txt ; CryptoDragon Obfuscated Script --> OriginalScriptName - CryptoDragon Obfuscated.au3 ; Modified by Freak to encrypt all strings in target program with multichar XOR, also added bug fixes. ; :::ChAnGeLoG:::: ; v1.2 - Original "Simple Obfuscator" by taurus905 ; v1.3 - Freak creates CryptoDragon project based off taurus905's "Simple Obfuscator" ; v1.3.4 - Added improved speed ; v1.3.5.1 - Improved functionality ; v1.3.6 - Added string length to _CryptoDragon_Crypt function for improved stability handling funny strings in version ; v1.4 - Improved security on encryption algorythm. Also obfuscator automatically writes encryption function to top of file automatically. ; v1.4.0.1 - Fixed encrypt function writing process. ; =================================================================================================== #include <GUIConstants.au3> #include <Array.au3> Func _CryptoDragon_Crypt($s_String, $s_Key, $iLen, $xorK2 = 0x12, $s_Level = 1.337) Local $s_Encrypted = "", $fin_Encrypted = "", $s_kc = 1 If StringLen($s_Key) = 0 Or $s_Level < 1 Then Return 0 $s_Key = StringSplit($s_Key, '') $s_String = StringSplit($s_String, '') For $x = 1 To $s_String[0] If $s_kc > $s_Key[0] Then $s_kc = 1 $s_Encrypted = $s_Key[$s_kc] $s_Encrypted += Floor(Asc($s_Key[$s_kc]) * $s_Level); $s_Encrypted = BitNOT($s_Encrypted); $s_Encrypted = BitXOR($s_Encrypted, Floor(Asc($s_Key[$s_kc]) * $s_Level)); $s_Encrypted += Floor(Asc($s_Key[$s_kc]) * $s_Level); $s_Encrypted -= Floor(Asc($s_Key[$s_kc]) * $s_Level); $s_Encrypted = BitXOR($s_Encrypted, Floor(Asc($s_Key[$s_kc]) * $s_Level)); $s_Encrypted = $s_Encrypted - 1; $s_Encrypted = BitXOR($s_Encrypted, Floor(Asc($s_Key[$s_kc]) * $s_Level)); $s_Encrypted = $s_Encrypted + 1; $s_Encrypted += Floor(Asc($s_Key[$s_kc]) * $s_Level); $s_Encrypted = BitXOR($s_Encrypted, $xorK2); $s_Encrypted = BitNOT($s_Encrypted); $s_Encrypted += Floor(Asc($s_Key[$s_kc]) * $s_Level); $fin_Encrypted &= Chr(BitXOR(Asc($s_String[$x]), Floor(Asc($s_Key[$s_kc]) * $s_Level))) $s_kc += 1 Next Return StringLeft($fin_Encrypted, $iLen) EndFunc ;==>_CryptoDragon_Crypt Global $Show_Messages = "No" ; Uncomment the following line to see progress messages and arrays during execution. ;Global $Show_Messages = "Yes" ; =================================================================================================== Global $file_Script_to_Obfuscate _Choose_Script_to_Obfuscate() ; Choose Script to Obfuscate ; =================================================================================================== ; Lines - Lines - Lines - Lines - Lines - Lines - Lines - Lines - Lines - Lines - Lines - Lines Global $Num_of_Lines _Count_Lines() ; Count Lines of Script to Obfuscate If $Show_Messages = "Yes" Then MsgBox(0, "$Num_of_Lines", $Num_of_Lines) Global $Array_of_Lines[$Num_of_Lines + 1] _Read_Lines_to_Array() ; Read Lines to Array If $Show_Messages = "Yes" Then _ArrayDisplay($Array_of_Lines, "$Array_of_Lines") ; Lines - Lines - Lines - Lines - Lines - Lines - Lines - Lines - Lines - Lines - Lines - Lines ; =================================================================================================== ; Vars - Vars - Vars - Vars - Vars - Vars - Vars - Vars - Vars - Vars - Vars - Vars - Vars - Vars Global $Num_of_Vars _Count_Vars() ; Count Variables in Script to Obfuscate If $Show_Messages = "Yes" Then MsgBox(0, "$Num_of_Vars", $Num_of_Vars) Global $Array_of_Vars[$Num_of_Vars + 1] _Read_Vars_to_Array() ; Read Variables to Array If $Show_Messages = "Yes" Then _ArrayDisplay($Array_of_Vars, "$Array_of_Vars") _Sort_Array_of_Vars() ; Sort Array of Variables If $Show_Messages = "Yes" Then _ArrayDisplay($Array_of_Vars, "$Array_of_Vars") Global $Num_of_Unique_Vars _Count_Unique_Vars() ; Count Unique Variables If $Show_Messages = "Yes" Then MsgBox(0, "$Num_of_Unique_Vars", $Num_of_Unique_Vars) Global $Array_of_Unique_Vars[$Num_of_Unique_Vars + 1] _Read_Unique_Vars_to_Array() ; Read Unique Variables to Array If $Show_Messages = "Yes" Then _ArrayDisplay($Array_of_Unique_Vars, "$Array_of_Unique_Vars") _Write_Unique_Vars_to_File() ; Write Unique Variables to File ; Vars - Vars - Vars - Vars - Vars - Vars - Vars - Vars - Vars - Vars - Vars - Vars - Vars - Vars ; =================================================================================================== ; Funcs - Funcs - Funcs - Funcs - Funcs - Funcs - Funcs - Funcs - Funcs - Funcs - Funcs - Funcs Global $Num_of_Funcs _Count_Funcs() ; Count Functions in Script to Obfuscate If $Show_Messages = "Yes" Then MsgBox(0, "$Num_of_Funcs", $Num_of_Funcs) Global $Array_of_Funcs[$Num_of_Funcs + 1] _Read_Funcs_to_Array() ; Read Functions to Array If $Show_Messages = "Yes" Then _ArrayDisplay($Array_of_Funcs, "$Array_of_Funcs") _Sort_Array_of_Funcs() ; Sort Array of Functions If $Show_Messages = "Yes" Then _ArrayDisplay($Array_of_Funcs, "$Array_of_Funcs") ; Funcs - Funcs - Funcs - Funcs - Funcs - Funcs - Funcs - Funcs - Funcs - Funcs - Funcs - Funcs ; =================================================================================================== ; Random - Random - Random - Random - Random - Random - Random - Random - Random - Random - Random Global $Num_of_Random_Names _Find_Random_Name_Count() ; Find Random Name Count Global $Random_Name[$Num_of_Random_Names + 1] _Read_Random_Names_to_Array() ; Read Random Names to Array If $Show_Messages = "Yes" Then _ArrayDisplay($Random_Name, "$Random_Name") _Write_Random_Names_to_File() ; Write Random Names to File ; Random - Random - Random - Random - Random - Random - Random - Random - Random - Random - Random ; =================================================================================================== ; Replace - Replace - Replace - Replace - Replace - Replace - Replace - Replace - Replace - Replace Global $New_Array_of_Lines[$Num_of_Lines + 1] _Remove_Comments() ; Remove Comments _ArraySortDblDel($Array_of_Unique_Vars) _ArraySortDblDel($Array_of_Funcs) $vars_finished = False $func_finished = False $Script_Data = _ArrayToString($Array_of_Lines, @CRLF) For $iii = 0 To $Num_of_Lines For $jjj = UBound($Array_of_Unique_Vars) - 1 To 1 Step -1 If $vars_finished Then ExitLoop If $Array_of_Unique_Vars[$jjj] <> $Array_of_Unique_Vars[1] Then If $Array_of_Unique_Vars[$jjj] <> "_" And $Array_of_Unique_Vars[$jjj] <> "$'" And StringLower($Array_of_Unique_Vars[$jjj]) <> "$cmdline" Then If StringInStr($Array_of_Unique_Vars[$jjj], ".") Then $temp = StringSplit($Array_of_Unique_Vars[$jjj], ".") $Array_of_Unique_Vars[$jjj] = $temp[1] EndIf If StringRight($Array_of_Unique_Vars[$jjj], 1) = "&" Then $Array_of_Unique_Vars[$jjj] = StringTrimRight($Array_of_Unique_Vars[$jjj], 1) EndIf $Script_Data = StringReplace($Script_Data, $Array_of_Unique_Vars[$jjj], "$" & $Random_Name[$jjj]) ConsoleWrite($Array_of_Unique_Vars[$jjj] & ":$" & $Random_Name[$jjj] & @CRLF) EndIf Else If $Array_of_Unique_Vars[$jjj] <> "_" And $Array_of_Unique_Vars[$jjj] <> "$'" Then If StringInStr($Array_of_Unique_Vars[$jjj], ".") Then $temp = StringSplit($Array_of_Unique_Vars[$jjj], ".") $Array_of_Unique_Vars[$jjj] = $temp[1] EndIf If StringRight($Array_of_Unique_Vars[$jjj], 1) = "&" Then $Array_of_Unique_Vars[$jjj] = StringTrimRight($Array_of_Unique_Vars[$jjj], 1) EndIf $Script_Data = StringReplace($Script_Data, $Array_of_Unique_Vars[$jjj], "$" & $Random_Name[$jjj]) ConsoleWrite($Array_of_Unique_Vars[$jjj] & ":$" & $Random_Name[$jjj] & @CRLF) EndIf $vars_finished = True EndIf Next Next For $iii = 0 To $Num_of_Lines For $jjj = UBound($Array_of_Funcs) - 1 To 1 Step -1 ; If StringLeft($Array_of_Funcs[$jjj], 1) = "_" Then ContinueLoop If $func_finished Then ExitLoop If $Array_of_Funcs[$jjj] <> $Array_of_Funcs[1] Then If StringInStr($Array_of_Funcs[$jjj], "=") Then ContinueLoop ; Au3wrapper, not a function. $Script_Data = StringReplace($Script_Data, $Array_of_Funcs[$jjj], $Random_Name[$jjj]) ConsoleWrite($Array_of_Funcs[$jjj] & ":" & $Random_Name[$jjj] & @CRLF) Else If StringInStr($Array_of_Funcs[$jjj], "=") Then $func_finished = True ContinueLoop ; Au3wrapper, not a function. EndIf $Script_Data = StringReplace($Script_Data, $Array_of_Funcs[$jjj], $Random_Name[$jjj]) ConsoleWrite($Array_of_Funcs[$jjj] & ":" & $Random_Name[$jjj] & @CRLF) $func_finished = True EndIf Next Next If $Show_Messages = "Yes" Then _ArrayDisplay($Array_of_Lines, "$New_Array_of_Lines") ; Replace - Replace - Replace - Replace - Replace - Replace - Replace - Replace - Replace - Replace ; =================================================================================================== _Write_CryptoDragon_Obfuscated_File($Script_Data) ; Write CryptoDragon Obfuscated Script Exit Func _ArraySortDblDel(ByRef $ARRAY, $CASESENS=0, $iDESCENDING=0, $iDIM=0, $iSORT=0) Local $arTmp1D[1], $arTmp2D[1][2], $dbl = 0 $arTmp1D[0] = "" $arTmp2D[0][0] = "" If $iDIM = 0 Then $iDIM = 1 _ArraySort($ARRAY,$iDESCENDING,0,0,$iDIM,$iSORT) Switch $iDIM Case 1 ; 1D For $i = 0 To UBound($ARRAY)-1 $dbl = 0 For $k = 0 To UBound($arTmp1D)-1 Switch $CASESENS Case 0 If $arTmp1D[$k] = $ARRAY[$i] Then $dbl = 1 Case 1 If $arTmp1D[$k] == $ARRAY[$i] Then $dbl = 1 EndSwitch Next If $dbl = 0 Then If $arTmp1D[0] = "" Then $arTmp1D[0] = $ARRAY[$i] Else _ArrayAdd($arTmp1D, $ARRAY[$i]) EndIf Else $dbl = 0 EndIf Next $ARRAY = $arTmp1D Case 2 ; 2D For $i = 0 To UBound($ARRAY)-1 $dbl = 0 For $k = 0 To UBound($arTmp2D)-1 Switch $CASESENS Case 0 If ( $arTmp2D[$k][0] = $ARRAY[$i][0] ) And _ ( $arTmp2D[$k][1] = $ARRAY[$i][1] ) Then $dbl = 1 Case 1 If ( $arTmp2D[$k][0] == $ARRAY[$i][0] ) And _ ( $arTmp2D[$k][1] == $ARRAY[$i][1] ) Then $dbl = 1 EndSwitch Next If $dbl = 0 Then If $arTmp2D[0][0] = "" Then $arTmp2D[0][0] = $ARRAY[$i][0] $arTmp2D[0][1] = $ARRAY[$i][1] Else ReDim $arTmp2D[UBound($arTmp2D)+1][2] $arTmp2D[UBound($arTmp2D)-1][0] = $ARRAY[$i][0] $arTmp2D[UBound($arTmp2D)-1][1] = $ARRAY[$i][1] EndIf Else $dbl = 0 EndIf Next $ARRAY = $arTmp2D EndSwitch EndFunc ; ==>_ArraySortDblDel ; ################################################################################################### ; =================================================================================================== Func _Choose_Script_to_Obfuscate() ; Choose Script to Obfuscate $file_Script_to_Obfuscate = FileOpenDialog("Choose an AutoIt Script to Obfuscate:", @ScriptDir, "Scripts (*.au3)", 1 + 2) If @error Then Exit EndFunc ; ==> _Choose_Script_to_Obfuscate ; =================================================================================================== ; Lines - Lines - Lines - Lines - Lines - Lines - Lines - Lines - Lines - Lines - Lines - Lines Func _Count_Lines() ; Count Lines of Script to Obfuscate FileOpen($file_Script_to_Obfuscate, 0) ; Open File to Obfuscate $Num_of_Lines = 0 While 1 $Num_of_Lines = $Num_of_Lines + 1 FileReadLine($file_Script_to_Obfuscate, $Num_of_Lines) ; Read All Lines for Count If @error = -1 Then ExitLoop WEnd EndFunc ; ==> _Count_Lines ; =================================================================================================== Func _Read_Lines_to_Array() ; Read Lines to Array For $iii = 1 To $Num_of_Lines $Array_of_Lines[$iii] = FileReadLine($file_Script_to_Obfuscate, $iii) ; Read All Lines Next FileClose($file_Script_to_Obfuscate) ; Close File to Obfuscate EndFunc ; ==> _Read_Lines_to_Array ; Lines - Lines - Lines - Lines - Lines - Lines - Lines - Lines - Lines - Lines - Lines - Lines ; =================================================================================================== ; Vars - Vars - Vars - Vars - Vars - Vars - Vars - Vars - Vars - Vars - Vars - Vars - Vars - Vars Func _Count_Vars() ; Count Variables in Script to Obfuscate $Num_of_Vars = 0 For $iii = 1 To $Num_of_Lines Local $quote_on = "No" $Array_of_Lines[0] = $Array_of_Lines[$iii] Local $line_length = StringLen($Array_of_Lines[0]) For $jjj = 1 To $line_length Local $char = StringLeft($Array_of_Lines[0], 1) If $char = Chr(34) And $quote_on = "No" Then $quote_on = "Yes" ElseIf $char = Chr(34) And $quote_on = "Yes" Then $quote_on = "No" EndIf If $char = ";" And $quote_on = "No" Then ExitLoop If $char = "$" And $quote_on = "No" Then $Num_of_Vars = $Num_of_Vars + 1 $Array_of_Lines[0] = StringTrimLeft($Array_of_Lines[0], 1) Next Next EndFunc ; ==> _Count_Vars ; =================================================================================================== Func _Read_Vars_to_Array() ; Read Variables to Array Local $var_ct = 0 For $iii = 1 To $Num_of_Lines Local $quote_on = "No" $Array_of_Lines[0] = $Array_of_Lines[$iii] Local $line_length = StringLen($Array_of_Lines[0]) For $jjj = 1 To $line_length Local $char = StringLeft($Array_of_Lines[0], 1) If $char = Chr(34) And $quote_on = "No" Then $quote_on = "Yes" ElseIf $char = Chr(34) And $quote_on = "Yes" Then $quote_on = "No" EndIf If $char = ";" And $quote_on = "No" Then ExitLoop If $char = "$" And $quote_on = "No" Then ; Read One Variable $var_ct = $var_ct + 1 $Array_of_Vars[$var_ct] = "" For $kkk = 1 To 256 $char = StringLeft($Array_of_Lines[0], 1) If $char = " " Or _ $char = " " Or _ $char = "=" Or _ $char = "[" Or _ $char = "]" Or _ $char = "," Or _ $char = ")" Or _ $char = ";" Or _ $char = "+" Or _ $char = "-" Or _ $char = "*" Or _ $char = "/" Or _ $char = Chr(34) Then ExitLoop $Array_of_Vars[$var_ct] = $Array_of_Vars[$var_ct] & $char $Array_of_Lines[0] = StringTrimLeft($Array_of_Lines[0], 1) Next EndIf $Array_of_Lines[0] = StringTrimLeft($Array_of_Lines[0], 1) Next Next EndFunc ; ==> _Read_Vars_to_Array ; =================================================================================================== Func _Sort_Array_of_Vars() ; Sort Array of Variables _ArraySortDblDel($Array_of_Vars) EndFunc ; ==> _Sort_Array_of_Vars ; =================================================================================================== Func _Count_Unique_Vars() ; Count Unique Variables $Num_of_Unique_Vars = 0 For $iii = 1 To UBound($Array_of_Vars) - 1 If $Array_of_Vars[$iii] <> $Array_of_Vars[$iii - 1] Then If StringIsUpper(StringTrimLeft(StringReplace($Array_of_Vars[$iii], "_", ""), 1)) Then ContinueLoop ; Don't write any system variables that are all UPPERCASE, such as, $GUI_EVENT_CLOSE $Num_of_Unique_Vars = $Num_of_Unique_Vars + 1 EndIf Next EndFunc ; ==> _Count_Unique_Vars ; =================================================================================================== Func _Read_Unique_Vars_to_Array() ; Read Unique Variables to Array Local $var_unique_ct = 0 For $iii = 1 To UBound($Array_of_Vars) - 1 If $Array_of_Vars[$iii] <> $Array_of_Vars[$iii - 1] Then If StringIsUpper(StringTrimLeft(StringReplace($Array_of_Vars[$iii], "_", ""), 1)) Then ContinueLoop ; Don't read any System Variables that are all UPPERCASE, such as, $GUI_EVENT_CLOSE $var_unique_ct = $var_unique_ct + 1 $Array_of_Unique_Vars[$var_unique_ct] = $Array_of_Vars[$iii] EndIf Next EndFunc ; ==> _Read_Unique_Vars_to_Array ; =================================================================================================== Func _Write_Unique_Vars_to_File() ; Write Unique Variables to File Local $file_Unique_Vars = StringTrimRight($file_Script_to_Obfuscate, 4) & " - Vars to Obfuscate.txt" ; Create Unique Variables Filename FileOpen($file_Unique_Vars, 2) ; Open File to Write Unique Variables For $iii = 1 To $Num_of_Unique_Vars FileWrite($file_Unique_Vars, $Array_of_Unique_Vars[$iii] & @CRLF) Next FileClose($file_Unique_Vars) ; Close Unique Variables File EndFunc ; ==> _Write_Unique_Vars_to_File ; Vars - Vars - Vars - Vars - Vars - Vars - Vars - Vars - Vars - Vars - Vars - Vars - Vars - Vars ; =================================================================================================== ; Funcs - Funcs - Funcs - Funcs - Funcs - Funcs - Funcs - Funcs - Funcs - Funcs - Funcs - Funcs Func _Count_Funcs() ; Count Functions in Script to Obfuscate $Num_of_Funcs = 0 For $iii = 1 To $Num_of_Lines Local $quote_on = "No" Local $var_on = "No" Local $func_on = "No" $Array_of_Lines[0] = $Array_of_Lines[$iii] Local $line_length = StringLen($Array_of_Lines[0]) For $jjj = 1 To $line_length Local $char = StringLeft($Array_of_Lines[0], 1) If $char = "(" Or $char = " " Then $func_on = "No" If $char = "$" And $quote_on = "No" Then $var_on = "Yes" If $char = "@" And $quote_on = "No" Then $var_on = "Yes" If $char = "<" And $quote_on = "No" Then $var_on = "Yes" If $char = " " And $quote_on = "No" Then $var_on = "No" If $char = Chr(34) And $quote_on = "No" Then $quote_on = "Yes" ElseIf $char = Chr(34) And $quote_on = "Yes" Then $quote_on = "No" EndIf If $char = ";" And $quote_on = "No" Then ExitLoop If $quote_on = "No" And $func_on = "No" And $var_on = "No" Then $func_on = "Yes" $Num_of_Funcs = $Num_of_Funcs + 1 EndIf $Array_of_Lines[0] = StringTrimLeft($Array_of_Lines[0], 1) Next Next EndFunc ; ==> _Count_Funcs ; =================================================================================================== Func _Read_Funcs_to_Array() ; Read Functions to Array Local $func_ct = 0 For $iii = 1 To $Num_of_Lines Local $quote_on = "No" Local $var_on = "No" Local $func_on = "No" $Array_of_Lines[0] = $Array_of_Lines[$iii] Local $line_length = StringLen($Array_of_Lines[0]) For $jjj = 1 To $line_length Local $char = StringLeft($Array_of_Lines[0], 1) If $char = "(" Or $char = " " Then $func_on = "No" If $char = "$" And $quote_on = "No" Then $var_on = "Yes" If $char = "@" And $quote_on = "No" Then $var_on = "Yes" If $char = "<" And $quote_on = "No" Then $var_on = "Yes" If $char = " " And $quote_on = "No" Then $var_on = "No" If $char = Chr(34) And $quote_on = "No" Then $quote_on = "Yes" ElseIf $char = Chr(34) And $quote_on = "Yes" Then $quote_on = "No" EndIf If $char = ";" And $quote_on = "No" Then ExitLoop If $char = "_" And $quote_on = "No" And $func_on = "No" And $var_on = "No" Then ; Read One Function $func_ct = $func_ct + 1 $Array_of_Funcs[$func_ct] = "" For $kkk = 1 To 256 $char = StringLeft($Array_of_Lines[0], 1) If $char = " " Or $char = "(" Then ExitLoop $Array_of_Funcs[$func_ct] = $Array_of_Funcs[$func_ct] & $char $Array_of_Lines[0] = StringTrimLeft($Array_of_Lines[0], 1) Next ; Functions_NOT_to_obfuscate_section: ; Add functions to the following lines that start with an underscore "_" that you ; do NOT want to be obfuscated. Example: ; If $Array_of_Funcs[$func_ct] = "_ArraySortDblDel" Or _ If $Array_of_Funcs[$func_ct] = "_ArraySortDblDel" Or _ $Array_of_Funcs[$func_ct] = "_ArrayDisplay" Or _ $Array_of_Funcs[$func_ct] = "_ChooseColor" Or _ $Array_of_Funcs[$func_ct] = "_ChooseFont" Or _ $Array_of_Funcs[$func_ct] = "_ImageGetSize" Or _ $Array_of_Funcs[$func_ct] = "_IsPressed" Or _ $Array_of_Funcs[$func_ct] = "_StringEncrypt" Or _ $Array_of_Funcs[$func_ct] = "_" Then ; Do NOT Count Built-In Functions $func_ct = $func_ct - 1 EndIf EndIf $Array_of_Lines[0] = StringTrimLeft($Array_of_Lines[0], 1) Next Next EndFunc ; ==> _Read_Funcs_to_Array ; =================================================================================================== Func _Sort_Array_of_Funcs() ; Sort Array of Functions _ArraySortDblDel($Array_of_Funcs) EndFunc ; ==> _Sort_Array_of_Funcs ; =================================================================================================== ; Funcs - Funcs - Funcs - Funcs - Funcs - Funcs - Funcs - Funcs - Funcs - Funcs - Funcs - Funcs ; =================================================================================================== Func _Find_Random_Name_Count() ; Find Random Name Count If $Num_of_Unique_Vars > $Num_of_Funcs Then $Num_of_Random_Names = $Num_of_Vars Else $Num_of_Random_Names = $Num_of_Funcs EndIf EndFunc ; ==> _Find_Random_Name_Count ; =================================================================================================== Func _Read_Random_Names_to_Array() ; Read Random Names to Array Local $random[16] For $iii = 1 To $Num_of_Random_Names $Random_Name[$iii] = "" For $jjj = 1 To Random(4, 15, 1) ; The number of random characters to use in each random name $random[$jjj] = Random(48, 122, 1) If $random[$jjj] > 64 And $random[$jjj] < 91 Or $random[$jjj] > 96 And $random[$jjj] < 123 Then $Random_Name[$iii] = $Random_Name[$iii] & Chr($random[$jjj]) Else $jjj = $jjj - 1 ContinueLoop EndIf Next Next Return $Random_Name EndFunc ; ==> _Read_Random_Names_to_Array ; =================================================================================================== Func _Write_Random_Names_to_File() ; Write Random Names to File Local $file_Random_Names = StringTrimRight($file_Script_to_Obfuscate, 4) & " - Random Names.txt" ; Create Random Names Filename FileOpen($file_Random_Names, 2) ; Open File to Write Random Names For $iii = 1 To $Num_of_Random_Names FileWrite($file_Random_Names, $Random_Name[$iii] & @CRLF) Next FileClose($file_Random_Names) ; Close Random Names File Return $Random_Name EndFunc ; ==> _Write_Random_Names_to_File ; Random - Random - Random - Random - Random - Random - Random - Random - Random - Random - Random ; =================================================================================================== ; Replace - Replace - Replace - Replace - Replace - Replace - Replace - Replace - Replace - Replace ; =================================================================================================== Func _Remove_Comments() ; Remove Comments For $iii = 1 To $Num_of_Lines Local $quote_on = "No" $Array_of_Lines[0] = $Array_of_Lines[$iii] Local $line_length = StringLen($Array_of_Lines[0]) $New_Array_of_Lines[$iii] = "" For $jjj = 1 To $line_length Local $char = StringLeft($Array_of_Lines[0], 1) If $char = Chr(34) And $quote_on = "No" Then $quote_on = "Yes" ElseIf $char = Chr(34) And $quote_on = "Yes" Then $quote_on = "No" EndIf If $char = ";" And $quote_on = "No" Then ExitLoop $New_Array_of_Lines[$iii] = $New_Array_of_Lines[$iii] & $char $Array_of_Lines[0] = StringTrimLeft($Array_of_Lines[0], 1) Next Next Return $New_Array_of_Lines EndFunc ; ==> _Remove_Comments ; Replace - Replace - Replace - Replace - Replace - Replace - Replace - Replace - Replace - Replace ; =================================================================================================== Func _StringBetween($S_STRING, $S_START, $S_END, $V_CASE = -1) Local $S_CASE = "" If $V_CASE = Default Or $V_CASE = -1 Then $S_CASE = "(?i)" Local $S_PATTERN_ESCAPE = "(\.|\||\*|\?|\+|\(|\)|\{|\}|\[|\]|\^|\$|\\)" $S_START = StringRegExpReplace($S_START, $S_PATTERN_ESCAPE, "\\$1") $S_END = StringRegExpReplace($S_END, $S_PATTERN_ESCAPE, "\\$1") If $S_START = "" Then $S_START = "\A" If $S_END = "" Then $S_END = "\z" Local $A_RET = StringRegExp($S_STRING, "(?s)" & $S_CASE & $S_START & "(.*?)" & $S_END, 3) If @error Then Return SetError(1, 0, 0) Return $A_RET EndFunc ;==>_STRINGBETWEEN Func _Add_Strings($aList, $AU3, $splitChar) Global $sPass = "" Dim $sRndChr[3] Local $Digits = Random(4, 15, 1) For $i = 1 To $Digits $sRndChr[0] = Chr(Random(65, 90, 1)) $sRndChr[1] = Chr(Random(97, 122, 1)) $sRndChr[2] = Chr(Random(48, 57, 1)) $sPass &= $sRndChr[Random(0, 2, 1)] Next Local $doneEncryption = False Local $newAU3 = $AU3 _ArraySortDblDel($aList) For $A = 0 To UBound($aList) - 1 If StringInStr($aList[$A], @CRLF) Then ContinueLoop ElseIf $aList[$A] <> "" And StringInStr($aList[$A], "_CryptoDragon_Crypt") = False And StringLeft($aList[$A], 1) <> "'" And StringRight($aList[$A], 1) <> "'" And StringLeft($aList[$A], 1) <> '"' And StringRight($aList[$A], 1) <> '"' And StringLen($aList[$A]) > 1 Then If StringInStr($aList[$A], "&") Then If StringRight($aList[$A], 1) = "&" Then $newAU3 = StringReplace($newAU3, $splitChar & StringTrimRight($aList[$A], 1) & $splitChar, " & _CryptoDragon_Crypt(BinaryToString('" & StringToBinary(_CryptoDragon_Crypt(StringTrimRight($aList[$A], 1), $sPass, StringLen(StringTrimRight($aList[$A], 1)))) & "'), BinaryToString('" & StringToBinary($sPass) & "'), " & String(StringLen($aList[$A]) - 1) & ")&") ConsoleWrite($splitChar & StringTrimRight($aList[$A], 1) & $splitChar & ":_CryptoDragon_Crypt(BinaryToString('" & StringToBinary(_CryptoDragon_Crypt(StringTrimRight($aList[$A], 1), $sPass, StringLen(StringTrimRight($aList[$A], 1)))) & "'), BinaryToString('" & StringToBinary($sPass) & "'), " & String(StringLen($aList[$A]) - 1) & ")&" & @CRLF) ElseIf StringRight($aList[$A], 2) = "& " Then $newAU3 = StringReplace($newAU3, $splitChar & StringTrimRight($aList[$A], 2) & $splitChar, "_CryptoDragon_Crypt(BinaryToString('" & StringToBinary(_CryptoDragon_Crypt(StringTrimRight($aList[$A], 2), $sPass, StringLen(String($aList[$A]) - 2))) & "'), BinaryToString('" & StringToBinary($sPass) & "'), " & String(StringLen($aList[$A]) - 2) & ") & ") ConsoleWrite($splitChar & StringTrimRight($aList[$A], 2) & $splitChar & ":_CryptoDragon_Crypt(BinaryToString('" & StringToBinary(_CryptoDragon_Crypt(StringTrimRight($aList[$A], 2), $sPass, StringLen(String($aList[$A]) - 2))) & "'), BinaryToString('" & StringToBinary($sPass) & "'), " & String(StringLen($aList[$A]) - 2) & ") &" & @CRLF) ElseIf StringLeft($aList[$A], 1) = "&" Then $newAU3 = StringReplace($newAU3, $splitChar & StringTrimLeft($aList[$A], 1) & $splitChar, "&_CryptoDragon_Crypt(BinaryToString('" & StringToBinary(_CryptoDragon_Crypt(StringTrimLeft($aList[$A], 2), $sPass, StringLen(String($aList[$A]) - 1))) & "'), BinaryToString('" & StringToBinary($sPass) & "'), " & String(StringLen($aList[$A]) - 1) & ")") ConsoleWrite($splitChar & StringTrimLeft($aList[$A], 1) & $splitChar & ":&_CryptoDragon_Crypt(BinaryToString('" & StringToBinary(_CryptoDragon_Crypt(StringTrimLeft($aList[$A], 1), $sPass, StringLen(String($aList[$A]) - 1))) & "'), BinaryToString('" & StringToBinary($sPass) & "'), " & String(StringLen($aList[$A]) - 1) & ")" & @CRLF) ElseIf StringLeft($aList[$A], 2) = " &" Then $newAU3 = StringReplace($newAU3, $splitChar & StringTrimLeft($aList[$A], 2) & $splitChar, " & _CryptoDragon_Crypt(BinaryToString('" & StringToBinary(_CryptoDragon_Crypt(StringTrimLeft($aList[$A], 2), $sPass, StringLen(String($aList[$A]) - 2))) & "'), BinaryToString('" & StringToBinary($sPass) & "'))") ConsoleWrite($splitChar & StringTrimLeft($aList[$A], 2) & $splitChar & ": & _CryptoDragon_Crypt(BinaryToString('" & StringToBinary(_CryptoDragon_Crypt(StringTrimLeft($aList[$A], 2), $sPass, StringLen(String($aList[$A]) - 2))) & "'), BinaryToString('" & StringToBinary($sPass) & "'), " & String(StringLen($aList[$A]) - 2) & ")" & @CRLF) Else $newAU3 = StringReplace($newAU3, $splitChar & $aList[$A] & $splitChar, "_CryptoDragon_Crypt(BinaryToString('" & StringToBinary(_CryptoDragon_Crypt($aList[$A], $sPass, StringLen($aList[$A]))) & "'), BinaryToString('" & StringToBinary($sPass) & "'), " & String(StringLen($aList[$A])) & ")") ConsoleWrite($splitChar & $aList[$A] & $splitChar & ":_CryptoDragon_Crypt(BinaryToString('" & StringToBinary(_CryptoDragon_Crypt($aList[$A], $sPass, StringLen($aList[$A]))) & "'), BinaryToString('" & StringToBinary($sPass) & "'), " & String(StringLen($aList[$A])) & ")" & @CRLF) EndIf Else $newAU3 = StringReplace($newAU3, $splitChar & $aList[$A] & $splitChar, "_CryptoDragon_Crypt(BinaryToString('" & StringToBinary(_CryptoDragon_Crypt($aList[$A], $sPass, StringLen($aList[$A]))) & "'), BinaryToString('" & StringToBinary($sPass) & "'), " & StringLen($aList[$A]) & ")") ConsoleWrite($splitChar & $aList[$A] & $splitChar & ":_CryptoDragon_Crypt(BinaryToString('" & StringToBinary(_CryptoDragon_Crypt($aList[$A], $sPass, StringLen($aList[$A]))) & "'), BinaryToString('" & StringToBinary($sPass) & "'), " & String(StringLen($aList[$A])) & ")" & @CRLF) EndIf EndIf Next Return $newAU3 EndFunc ;==>_ADD_STRINGS Func base64($vCode, $bEncode = True, $bUrl = False) Local $oDM = ObjCreate("Microsoft.XMLDOM") If Not IsObj($oDM) Then Return SetError(1, 0, 1) Local $oEL = $oDM.createElement("Tmp") $oEL.DataType = "bin.base64" If $bEncode then $oEL.NodeTypedValue = Binary($vCode) If Not $bUrl Then Return $oEL.Text Return StringReplace(StringReplace(StringReplace($oEL.Text, "+", "-"),"/", "_"), @LF, "") Else If $bUrl Then $vCode = StringReplace(StringReplace($vCode, "-", "+"), "_", "/") $oEL.Text = $vCode Return BinaryToString($oEL.NodeTypedValue, 4) EndIf EndFunc ;==>base64 Func _Encrypt_Strings($AU3, $file_Simple_Obfuscated) Local $sSTRINGS = _StringBetween($AU3, "'", "'") Local $newAU3 = _Add_Strings($sSTRINGS, $AU3, "'") Local $dSTRINGS = _StringBetween($newAU3, '"', '"') Local $epicAU3 = _Add_Strings($dSTRINGS, $newAU3, '"') Local $fileHandle = FileOpen($file_Simple_Obfuscated, 18) FileWrite($fileHandle, base64("RnVuYyBfQ3J5cHRvRHJhZ29uX0NyeXB0KCRzX1N0cmluZywgJHNfS2V5LCAkaUxlbiwgJHhvcksyID0gMHgxMiwgJHNfTGV2ZWwgPSAxLjMzNykKCUxvY2FsICRzX0VuY3J5cHRlZCA9ICIiLCAkZmluX0VuY3J5cHRlZCA9ICIiLCAkc19rYyA9IDEKCUlmIFN0cmluZ0xlbigkc19LZXkpID0gMCBPciAkc19MZXZlbCA8IDEgVGhlbiBSZXR1cm4gMAoJJHNfS2V5ID0gU3RyaW5nU3BsaXQoJHNfS2V5LCAnJykKCSRzX1N0cmluZyA9IFN0cmluZ1NwbGl0KCRzX1N0cmluZywgJycpCglGb3IgJHggPSAxIFRvICRzX1N0cmluZ1swXQoJCUlmICRzX2tjID4gJHNfS2V5WzBdIFRoZW4gJHNfa2MgPSAxCgkJJHNfRW5jcnlwdGVkID0gJHNfS2V5WyRzX2tjXQoJCSRzX0VuY3J5cHRlZCArPSBGbG9vcihBc2MoJHNfS2V5WyRzX2tjXSkgKiAkc19MZXZlbCk7CgkJJHNfRW5jcnlwdGVkID0gQml0Tk9UKCRzX0VuY3J5cHRlZCk7CgkJJHNfRW5jcnlwdGVkID0gQml0WE9SKCRzX0VuY3J5cHRlZCwgRmxvb3IoQXNjKCRzX0tleVskc19rY10pICogJHNfTGV2ZWwpKTsKCQkkc19FbmNyeXB0ZWQgKz0gRmxvb3IoQXNjKCRzX0tleVskc19rY10pICogJHNfTGV2ZWwpOwoJCSRzX0VuY3J5cHRlZCAtPSBGbG9vcihBc2MoJHNfS2V5WyRzX2tjXSkgKiAkc19MZXZlbCk7CgkJJHNfRW5jcnlwdGVkID0gQml0WE9SKCRzX0VuY3J5cHRlZCwgRmxvb3IoQXNjKCRzX0tleVskc19rY10pICogJHNfTGV2ZWwpKTsKCQkkc19FbmNyeXB0ZWQgPSAkc19FbmNyeXB0ZWQgLSAxOwoJCSRzX0VuY3J5cHRlZCA9IEJpdFhPUigkc19FbmNyeXB0ZWQsIEZsb29yKEFzYygkc19LZXlbJHNfa2NdKSAqICRzX0xldmVsKSk7CgkJJHNfRW5jcnlwdGVkID0gJHNfRW5jcnlwdGVkICsgMTsKCQkkc19FbmNyeXB0ZWQgKz0gRmxvb3IoQXNjKCRzX0tleVskc19rY10pICogJHNfTGV2ZWwpOwoJCSRzX0VuY3J5cHRlZCA9IEJpdFhPUigkc19FbmNyeXB0ZWQsICR4b3JLMik7CgkJJHNfRW5jcnlwdGVkID0gQml0Tk9UKCRzX0VuY3J5cHRlZCk7CgkJJHNfRW5jcnlwdGVkICs9IEZsb29yKEFzYygkc19LZXlbJHNfa2NdKSAqICRzX0xldmVsKTsKCQkkZmluX0VuY3J5cHRlZCAmPSBDaHIoQml0WE9SKEFzYygkc19TdHJpbmdbJHhdKSwgRmxvb3IoQXNjKCRzX0tleVskc19rY10pICogJHNfTGV2ZWwpKSkKCQkkc19rYyArPSAxCglOZXh0CglSZXR1cm4gU3RyaW5nTGVmdCgkZmluX0VuY3J5cHRlZCwgJGlMZW4pCkVuZEZ1bmMgICA7PT0+X0NyeXB0b0RyYWdvbl9DcnlwdA==", False)) FileWrite($fileHandle, $epicAU3) FileClose($fileHandle) EndFunc ;==>_ENCRYPT_STRINGS Func _Write_CryptoDragon_Obfuscated_File($AU3) ; Write CryptoDragon Obfuscated File Local $file_Simple_Obfuscated = StringTrimRight($file_Script_to_Obfuscate, 4) & " - CryptoDragon Obfuscated.au3" ; Create CryptoDragon Obfuscated Filename _Encrypt_Strings($AU3, $file_Simple_Obfuscated) EndFunc ; ==> _Write_CryptoDragon_Obfuscated_File ; ===================================================================================================1 point
-
autoit_php - access autoit functions from php
Skysnake reacted to HansHenrik for a topic
here's some PHP code to access AutoIt functions from php: https://github.com/divinity76/autoit_php - as of writing, only 5 functions are added: MouseMove and MouseClick and _ScreenCapture_Capture and WinWaitActive and Send, it also has support for running in Cygwin (which is where i've developed it, but it *should*, in theory, run on normal php-cli for windows as well.), is there any community interest for this? example usage <?php require_once("autoit.class.php"); $au = new AutoIt(); $au->MouseMove(10, 10, 5); $au->MouseClick("left"); echo "waiting up to 5 seconds for notepad window.."; if($au->WinWaitActive("[CLASS:Notepad]","",5)){ echo "found notepad!\n"; $au->Send("hello from autoit_php"); }else{ echo "timed out while waiting for notepad.\n"; } $imageBinary = $au->_ScreenCapture_Capture(); var_dump(strlen($imageBinary), imagecreatefromstring($imageBinary)); (i wanted to use some autoit functions from php-cli, and google wasn't of much help this time..)1 point -
Arranging XML File from one line into separate line
KickStarter15 reacted to mikell for a topic
Formerly I made this snippet for personal use. No warranty ! It can work... according on its mood at this moment $s = FileRead("file.xml") Msgbox(0,"test", _regex($s)) ;ConsoleWrite(_regex($s)) Func _regex($xml) Local $indent = "" While 1 $xml = StringRegExpReplace($xml, '(?s)((?<!\t)<(\S+)(?:\sxsi:[^>]+)?>.*?</\2>)', @crlf & $indent & '$1' ) $xml = StringRegExpReplace($xml, '.*>\K(</[^>]+>)', @crlf & $indent & '$1') If @extended = 0 Then Exitloop $indent &= @tab Wend $str = StringRegExpReplace($xml, '\R+', @crlf) Return $str EndFunc1 point -
terna, The big problem with that script is that you are trying to fire a function within a running function - see the Interrupting a running function tutorial in the Wiki to see why this is the case. I will try and rework the script so that you can get around the problem - but as I hate coding in OnEvent mode this might take a while! M231 point
-
Change between GUIs
FrancescoDiMuro reacted to Jos for a topic
Yea right... so why do you think it will ever go any further that this part?: MainActivity() Func MainActivity() While 1 ; Sleep for decrease CPU Usage Sleep(2000) ; Check process existing For $i = 0 To UBound($BMProcesses) - 1 Step 1 If ProcessExists($BMProcesses[$i]) Then ProcessWaitClose($BMProcesses[$i], 3600) Next ; Sleep for decrease CPU Usage Sleep(100) ; Terminate process For $i = 0 To UBound($BMProcesses) - 1 Step 1 ProcessClose($BMProcesses[$i]) Next EndFunc EDIT: Skip that: Your code it totally screwed up! RUn Tidy on it and Run AU3Check before even asking any question here! Jos1 point -
Change between GUIs
FrancescoDiMuro reacted to Jos for a topic
That still doesn't answer why the linked tutorial is difficult to understand, unless you didn't follow it and tried each step yourself. Jos1 point -
Yes, this is controlled by the variable $_WD_DEBUG. If you set it equal to $_WD_DEBUG_None before calling _WD_Startup, then the webdriver console should be launched in a hidden state.1 point
-
@caramen Have you tried changing the pageLoad timeout with _WD_Timeouts (see wd_demo for an example)?1 point
-
By all means give your opinion, but the negativity here sometimes saddens me ... not picking on you specifically. He's also asking others if they want to share his journey, and for any helpful ideas etc. He's young but I respect his mind ... most of us learn the hard way and have to deal with enough negatives as it is. Whether or not he can possibly succeed in this difficult endeavor is very debatable, but he deserves an A+ for trying ... and some encouragement, rather than discouragement. He will get the discouragement soon enough.1 point
-
@Earthshine - I don't think you are appreciating why he wants to do it, and the likely benefits to him at least. Since when do smart people just accept the current status quo? Life is a journey and about pushing boundaries and learning while growing. It's not like he isn't aware of those other options etc.1 point
-
Unable to parse Line
BlackSnoww reacted to Melba23 for a topic
BlackSnoww, Delighted I could help. M231 point -
Using UI Automation Code in AutoIt
Earthshine reacted to LarsJ for a topic
Real examples These are real examples as opposed to the demo examples. A single example is reviewed below. Otherwise, there's just a link to the example in the General Help and Support forum. Chrome - Activate a tab Get all texts in a Chrome document Automating Comodo Firewall menus Changing text on a control that only shows up when you click in it Detect a 'button' that only appears as a progress bar object All code is stored in Examples\6) Real examples\ folder. 3. Automating Comodo Firewall menus This is an automation of the menu system in the Comodo Firewall as described in this thread. The menu system that you can see on the left side of the images is a modern-looking menu system. But each menu item is implemented as a set of standard controls: An icon on the left, a text field in the middle and a button. The button is placed slightly differently from one menu item to another. In the second picture below, the button is located to the far right. Comodo probably uses this implementation with standard controls to ensure that the same GUI can be used on all Windows versions from Windows XP to Windows 10. The menu system can most likely be automated with classic automation code. But you need a UI spy tool that is able to reveal this structure of the menu items. Because it's about a Firewall, all AutoIt code is immediately blocked. As you can see in the first picture below, all firewall features are therefore disabled, so it's possible to run AutoIt code. Automation of the menu system with UI Automation code and UIASpy is straightforward. The task is initially divided into 3 small parts and 3 small scripts: Click Settings button to open Advanced Settings Click Firewall menu item to open the submenu Click Application Rules to access these settings This procedure is described in How to topics number 1. As the last task the 3 scripts are put together into a final script. The 3 small sub-tasks are implemented in completely the same way: Create UI Automation main objects (How to topics number 8) Identify and find window (How to topics number 9) Identify and find button (How to topics number 10) Create the Invoke object (How to topics number 12) Perform the Invoke() method (How to topics number 14) Create executable code (How to topics number 15) The easiest is to do it all using UIASpy. Operation of UIASpy is described directly in the UIASpy help system. Note that automation is done on a Windows 10 PC, but that Windows mode in UIASpy is set to Windows 7 mode (Options | Windows | Mode) to be able to generate Windows 7 code. To examine the structure of the controls in the menu items (necessary to identify the button in point 3), it's easiest to generate the tree structure for the whole window and paste the structure into a new page in your editor so that you can see the structure while using UIASpy. To generate executable code in point 6, it's only necessary to add the path to UIA_Constants.au3 and to move the different code snippets into the function. You can find the code in Examples\6) Real examples\ folder. The a-versions of the files contains the code generated directly by UIASpy. 1. Click Settings To run the code, the Comodo GUI should look as shown in the picture. Comodo1.au3: #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 ;#AutoIt3Wrapper_UseX64=n ; If target application is running as 32 bit code ;#AutoIt3Wrapper_UseX64=y ; If target application is running as 64 bit code #include "..\..\..\Includes\UIA_Constants.au3" ; Can be copied from UIASpy Includes folder ;#include "UIA_Functions.au3" ; Can be copied from UIASpy Includes folder ;#include "UIA_SafeArray.au3" ; Can be copied from UIASpy Includes folder ;#include "UIA_Variant.au3" ; Can be copied from UIASpy Includes folder Opt( "MustDeclareVars", 1 ) Example() Func Example() ; Create UI Automation object Local $oUIAutomation = ObjCreateInterface( $sCLSID_CUIAutomation, $sIID_IUIAutomation, $dtag_IUIAutomation ) If Not IsObj( $oUIAutomation ) Then Return ConsoleWrite( "$oUIAutomation ERR" & @CRLF ) ConsoleWrite( "$oUIAutomation OK" & @CRLF ) ; Get Desktop element Local $pDesktop, $oDesktop $oUIAutomation.GetRootElement( $pDesktop ) $oDesktop = ObjCreateInterface( $pDesktop, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement ) If Not IsObj( $oDesktop ) Then Return ConsoleWrite( "$oDesktop ERR" & @CRLF ) ConsoleWrite( "$oDesktop OK" & @CRLF ) ; --- Find window/control --- ConsoleWrite( "--- Find window/control ---" & @CRLF ) Local $pCondition0 $oUIAutomation.CreatePropertyCondition( $UIA_ClassNamePropertyId, "CisMainWizard", $pCondition0 ) If Not $pCondition0 Then Return ConsoleWrite( "$pCondition0 ERR" & @CRLF ) ConsoleWrite( "$pCondition0 OK" & @CRLF ) Local $pPane1, $oPane1 $oDesktop.FindFirst( $TreeScope_Descendants, $pCondition0, $pPane1 ) $oPane1 = ObjCreateInterface( $pPane1, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement ) If Not IsObj( $oPane1 ) Then Return ConsoleWrite( "$oPane1 ERR" & @CRLF ) ConsoleWrite( "$oPane1 OK" & @CRLF ) ; --- Find window/control --- ConsoleWrite( "--- Find window/control ---" & @CRLF ) Local $pCondition1 $oUIAutomation.CreatePropertyCondition( $UIA_ClassNamePropertyId, "SettingsButton", $pCondition1 ) If Not $pCondition1 Then Return ConsoleWrite( "$pCondition1 ERR" & @CRLF ) ConsoleWrite( "$pCondition1 OK" & @CRLF ) Local $pButton1, $oButton1 $oPane1.FindFirst( $TreeScope_Descendants, $pCondition1, $pButton1 ) $oButton1 = ObjCreateInterface( $pButton1, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement ) If Not IsObj( $oButton1 ) Then Return ConsoleWrite( "$oButton1 ERR" & @CRLF ) ConsoleWrite( "$oButton1 OK" & @CRLF ) ; --- Invoke Pattern (action) Object --- ConsoleWrite( "--- Invoke Pattern (action) Object ---" & @CRLF ) Local $pInvokePattern1, $oInvokePattern1 $oButton1.GetCurrentPattern( $UIA_InvokePatternId, $pInvokePattern1 ) $oInvokePattern1 = ObjCreateInterface( $pInvokePattern1, $sIID_IUIAutomationInvokePattern, $dtag_IUIAutomationInvokePattern ) If Not IsObj( $oInvokePattern1 ) Then Return ConsoleWrite( "$oInvokePattern1 ERR" & @CRLF ) ConsoleWrite( "$oInvokePattern1 OK" & @CRLF ) ; --- Invoke Pattern (action) Methods --- ConsoleWrite( "--- Invoke Pattern (action) Methods ---" & @CRLF ) $oInvokePattern1.Invoke() ConsoleWrite( "$oInvokePattern1.Invoke()" & @CRLF ) EndFunc Output in SciTE console: $oUIAutomation OK $oDesktop OK --- Find window/control --- $pCondition0 OK $oPane1 OK --- Find window/control --- $pCondition1 OK $oButton1 OK --- Invoke Pattern (action) Object --- $oInvokePattern1 OK --- Invoke Pattern (action) Methods --- $oInvokePattern1.Invoke() 2. Click Firewall menu item To run the code, the Comodo GUI should look as shown in the picture. Comodo2.au3: #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 ;#AutoIt3Wrapper_UseX64=n ; If target application is running as 32 bit code ;#AutoIt3Wrapper_UseX64=y ; If target application is running as 64 bit code #include "..\..\..\Includes\UIA_Constants.au3" ; Can be copied from UIASpy Includes folder ;#include "UIA_Functions.au3" ; Can be copied from UIASpy Includes folder ;#include "UIA_SafeArray.au3" ; Can be copied from UIASpy Includes folder ;#include "UIA_Variant.au3" ; Can be copied from UIASpy Includes folder Opt( "MustDeclareVars", 1 ) Example() Func Example() ; Create UI Automation object Local $oUIAutomation = ObjCreateInterface( $sCLSID_CUIAutomation, $sIID_IUIAutomation, $dtag_IUIAutomation ) If Not IsObj( $oUIAutomation ) Then Return ConsoleWrite( "$oUIAutomation ERR" & @CRLF ) ConsoleWrite( "$oUIAutomation OK" & @CRLF ) ; Get Desktop element Local $pDesktop, $oDesktop $oUIAutomation.GetRootElement( $pDesktop ) $oDesktop = ObjCreateInterface( $pDesktop, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement ) If Not IsObj( $oDesktop ) Then Return ConsoleWrite( "$oDesktop ERR" & @CRLF ) ConsoleWrite( "$oDesktop OK" & @CRLF ) ; --- Find window/control --- ConsoleWrite( "--- Find window/control ---" & @CRLF ) Local $pCondition0, $pCondition1, $pAndCondition1 $oUIAutomation.CreatePropertyCondition( $UIA_AutomationIdPropertyId, "COMODO Advanced Settings", $pCondition0 ) $oUIAutomation.CreatePropertyCondition( $UIA_ClassNamePropertyId, "CisMainWizard", $pCondition1 ) $oUIAutomation.CreateAndCondition( $pCondition0, $pCondition1, $pAndCondition1 ) If Not $pAndCondition1 Then Return ConsoleWrite( "$pAndCondition1 ERR" & @CRLF ) ConsoleWrite( "$pAndCondition1 OK" & @CRLF ) Local $pPane1, $oPane1 $oDesktop.FindFirst( $TreeScope_Descendants, $pAndCondition1, $pPane1 ) $oPane1 = ObjCreateInterface( $pPane1, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement ) If Not IsObj( $oPane1 ) Then Return ConsoleWrite( "$oPane1 ERR" & @CRLF ) ConsoleWrite( "$oPane1 OK" & @CRLF ) ; --- Find window/control --- ConsoleWrite( "--- Find window/control ---" & @CRLF ) Local $pCondition2, $pCondition3, $pAndCondition3 $oUIAutomation.CreatePropertyCondition( $UIA_ClassNamePropertyId, "btnAseSlide", $pCondition2 ) $oUIAutomation.CreatePropertyCondition( $UIA_ControlTypePropertyId, $UIA_ButtonControlTypeId, $pCondition3 ) $oUIAutomation.CreateAndCondition( $pCondition2, $pCondition3, $pAndCondition3 ) If Not $pAndCondition3 Then Return ConsoleWrite( "$pAndCondition3 ERR" & @CRLF ) ConsoleWrite( "$pAndCondition3 OK" & @CRLF ) Local $pCondition4, $pAndCondition4 $oUIAutomation.CreatePropertyCondition( $UIA_NamePropertyId, "Firewall Button", $pCondition4 ) $oUIAutomation.CreateAndCondition( $pAndCondition3, $pCondition4, $pAndCondition4 ) If Not $pAndCondition4 Then Return ConsoleWrite( "$pAndCondition4 ERR" & @CRLF ) ConsoleWrite( "$pAndCondition4 OK" & @CRLF ) Local $pButton1, $oButton1 $oPane1.FindFirst( $TreeScope_Descendants, $pAndCondition4, $pButton1 ) $oButton1 = ObjCreateInterface( $pButton1, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement ) If Not IsObj( $oButton1 ) Then Return ConsoleWrite( "$oButton1 ERR" & @CRLF ) ConsoleWrite( "$oButton1 OK" & @CRLF ) ; --- Invoke Pattern (action) Object --- ConsoleWrite( "--- Invoke Pattern (action) Object ---" & @CRLF ) Local $pInvokePattern1, $oInvokePattern1 $oButton1.GetCurrentPattern( $UIA_InvokePatternId, $pInvokePattern1 ) $oInvokePattern1 = ObjCreateInterface( $pInvokePattern1, $sIID_IUIAutomationInvokePattern, $dtag_IUIAutomationInvokePattern ) If Not IsObj( $oInvokePattern1 ) Then Return ConsoleWrite( "$oInvokePattern1 ERR" & @CRLF ) ConsoleWrite( "$oInvokePattern1 OK" & @CRLF ) ; --- Invoke Pattern (action) Methods --- ConsoleWrite( "--- Invoke Pattern (action) Methods ---" & @CRLF ) $oInvokePattern1.Invoke() ConsoleWrite( "$oInvokePattern1.Invoke()" & @CRLF ) EndFunc Output in SciTE console: $oUIAutomation OK $oDesktop OK --- Find window/control --- $pAndCondition1 OK $oPane1 OK --- Find window/control --- $pAndCondition3 OK $pAndCondition4 OK $oButton1 OK --- Invoke Pattern (action) Object --- $oInvokePattern1 OK --- Invoke Pattern (action) Methods --- $oInvokePattern1.Invoke() 3. Click Application Rules To run the code, the Comodo GUI should look as shown in the picture. Comodo3.au3: #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 ;#AutoIt3Wrapper_UseX64=n ; If target application is running as 32 bit code ;#AutoIt3Wrapper_UseX64=y ; If target application is running as 64 bit code #include "..\..\..\Includes\UIA_Constants.au3" ; Can be copied from UIASpy Includes folder ;#include "UIA_Functions.au3" ; Can be copied from UIASpy Includes folder ;#include "UIA_SafeArray.au3" ; Can be copied from UIASpy Includes folder ;#include "UIA_Variant.au3" ; Can be copied from UIASpy Includes folder Opt( "MustDeclareVars", 1 ) Example() Func Example() ; Create UI Automation object Local $oUIAutomation = ObjCreateInterface( $sCLSID_CUIAutomation, $sIID_IUIAutomation, $dtag_IUIAutomation ) If Not IsObj( $oUIAutomation ) Then Return ConsoleWrite( "$oUIAutomation ERR" & @CRLF ) ConsoleWrite( "$oUIAutomation OK" & @CRLF ) ; Get Desktop element Local $pDesktop, $oDesktop $oUIAutomation.GetRootElement( $pDesktop ) $oDesktop = ObjCreateInterface( $pDesktop, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement ) If Not IsObj( $oDesktop ) Then Return ConsoleWrite( "$oDesktop ERR" & @CRLF ) ConsoleWrite( "$oDesktop OK" & @CRLF ) ; --- Find window/control --- ConsoleWrite( "--- Find window/control ---" & @CRLF ) Local $pCondition0, $pCondition1, $pAndCondition1 $oUIAutomation.CreatePropertyCondition( $UIA_AutomationIdPropertyId, "COMODO Advanced Settings", $pCondition0 ) $oUIAutomation.CreatePropertyCondition( $UIA_ClassNamePropertyId, "CisMainWizard", $pCondition1 ) $oUIAutomation.CreateAndCondition( $pCondition0, $pCondition1, $pAndCondition1 ) If Not $pAndCondition1 Then Return ConsoleWrite( "$pAndCondition1 ERR" & @CRLF ) ConsoleWrite( "$pAndCondition1 OK" & @CRLF ) Local $pPane1, $oPane1 $oDesktop.FindFirst( $TreeScope_Descendants, $pAndCondition1, $pPane1 ) $oPane1 = ObjCreateInterface( $pPane1, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement ) If Not IsObj( $oPane1 ) Then Return ConsoleWrite( "$oPane1 ERR" & @CRLF ) ConsoleWrite( "$oPane1 OK" & @CRLF ) ; --- Find window/control --- ConsoleWrite( "--- Find window/control ---" & @CRLF ) Local $pCondition2, $pCondition3, $pAndCondition3 $oUIAutomation.CreatePropertyCondition( $UIA_AutomationIdPropertyId, "A6", $pCondition2 ) $oUIAutomation.CreatePropertyCondition( $UIA_ControlTypePropertyId, $UIA_HyperlinkControlTypeId, $pCondition3 ) $oUIAutomation.CreateAndCondition( $pCondition2, $pCondition3, $pAndCondition3 ) If Not $pAndCondition3 Then Return ConsoleWrite( "$pAndCondition3 ERR" & @CRLF ) ConsoleWrite( "$pAndCondition3 OK" & @CRLF ) Local $pCondition4, $pAndCondition4 $oUIAutomation.CreatePropertyCondition( $UIA_NamePropertyId, "Application Rules Link", $pCondition4 ) $oUIAutomation.CreateAndCondition( $pAndCondition3, $pCondition4, $pAndCondition4 ) If Not $pAndCondition4 Then Return ConsoleWrite( "$pAndCondition4 ERR" & @CRLF ) ConsoleWrite( "$pAndCondition4 OK" & @CRLF ) Local $pHyperlink1, $oHyperlink1 $oPane1.FindFirst( $TreeScope_Descendants, $pAndCondition4, $pHyperlink1 ) $oHyperlink1 = ObjCreateInterface( $pHyperlink1, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement ) If Not IsObj( $oHyperlink1 ) Then Return ConsoleWrite( "$oHyperlink1 ERR" & @CRLF ) ConsoleWrite( "$oHyperlink1 OK" & @CRLF ) ; --- Invoke Pattern (action) Object --- ConsoleWrite( "--- Invoke Pattern (action) Object ---" & @CRLF ) Local $pInvokePattern1, $oInvokePattern1 $oHyperlink1.GetCurrentPattern( $UIA_InvokePatternId, $pInvokePattern1 ) $oInvokePattern1 = ObjCreateInterface( $pInvokePattern1, $sIID_IUIAutomationInvokePattern, $dtag_IUIAutomationInvokePattern ) If Not IsObj( $oInvokePattern1 ) Then Return ConsoleWrite( "$oInvokePattern1 ERR" & @CRLF ) ConsoleWrite( "$oInvokePattern1 OK" & @CRLF ) ; --- Invoke Pattern (action) Methods --- ConsoleWrite( "--- Invoke Pattern (action) Methods ---" & @CRLF ) $oInvokePattern1.Invoke() ConsoleWrite( "$oInvokePattern1.Invoke()" & @CRLF ) EndFunc The Comodo GUI should now look as shown in the picture: Output in SciTE console: $oUIAutomation OK $oDesktop OK --- Find window/control --- $pAndCondition1 OK $oPane1 OK --- Find window/control --- $pAndCondition3 OK $pAndCondition4 OK $oHyperlink1 OK --- Invoke Pattern (action) Object --- $oInvokePattern1 OK --- Invoke Pattern (action) Methods --- $oInvokePattern1.Invoke() All code To put all the code together in a single script start by copying Comodo1.au3 to ComodoAll.au3. Add a Sleep( 1000 ) and add the code from Comodo2.au3 (except function header and Automation main objects). Sleep( 1000 ) is required for Comodo to have time to open the child window. The 1000 milliseconds can probably be optimized for something less. Test the code. In SciTE console you'll see warnings about double-declared local variables. Delete these declarations. Add a Sleep( 1000 ). Add the code from Comodo3.au3. Because the window in step 2 and step 3 is the same, you don't need to identify and find the window again. Test the code. In SciTE console you'll see warnings about double-declared local variables. Delete these declarations. To run all code, the Comodo GUI should look as shown in the first picture above. ComodoAll.au3: #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 ;#AutoIt3Wrapper_UseX64=n ; If target application is running as 32 bit code ;#AutoIt3Wrapper_UseX64=y ; If target application is running as 64 bit code #include "..\..\..\Includes\UIA_Constants.au3" ; Can be copied from UIASpy Includes folder ;#include "UIA_Functions.au3" ; Can be copied from UIASpy Includes folder ;#include "UIA_SafeArray.au3" ; Can be copied from UIASpy Includes folder ;#include "UIA_Variant.au3" ; Can be copied from UIASpy Includes folder Opt( "MustDeclareVars", 1 ) Example() Func Example() ; Create UI Automation object Local $oUIAutomation = ObjCreateInterface( $sCLSID_CUIAutomation, $sIID_IUIAutomation, $dtag_IUIAutomation ) If Not IsObj( $oUIAutomation ) Then Return ConsoleWrite( "$oUIAutomation ERR" & @CRLF ) ConsoleWrite( "$oUIAutomation OK" & @CRLF ) ; Get Desktop element Local $pDesktop, $oDesktop $oUIAutomation.GetRootElement( $pDesktop ) $oDesktop = ObjCreateInterface( $pDesktop, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement ) If Not IsObj( $oDesktop ) Then Return ConsoleWrite( "$oDesktop ERR" & @CRLF ) ConsoleWrite( "$oDesktop OK" & @CRLF ) ; --- Find window/control --- ConsoleWrite( "--- Find window/control ---" & @CRLF ) Local $pCondition0 $oUIAutomation.CreatePropertyCondition( $UIA_ClassNamePropertyId, "CisMainWizard", $pCondition0 ) If Not $pCondition0 Then Return ConsoleWrite( "$pCondition0 ERR" & @CRLF ) ConsoleWrite( "$pCondition0 OK" & @CRLF ) Local $pPane1, $oPane1 $oDesktop.FindFirst( $TreeScope_Descendants, $pCondition0, $pPane1 ) $oPane1 = ObjCreateInterface( $pPane1, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement ) If Not IsObj( $oPane1 ) Then Return ConsoleWrite( "$oPane1 ERR" & @CRLF ) ConsoleWrite( "$oPane1 OK" & @CRLF ) ; --- Find window/control --- ConsoleWrite( "--- Find window/control ---" & @CRLF ) Local $pCondition1 $oUIAutomation.CreatePropertyCondition( $UIA_ClassNamePropertyId, "SettingsButton", $pCondition1 ) If Not $pCondition1 Then Return ConsoleWrite( "$pCondition1 ERR" & @CRLF ) ConsoleWrite( "$pCondition1 OK" & @CRLF ) Local $pButton1, $oButton1 $oPane1.FindFirst( $TreeScope_Descendants, $pCondition1, $pButton1 ) $oButton1 = ObjCreateInterface( $pButton1, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement ) If Not IsObj( $oButton1 ) Then Return ConsoleWrite( "$oButton1 ERR" & @CRLF ) ConsoleWrite( "$oButton1 OK" & @CRLF ) ; --- Invoke Pattern (action) Object --- ConsoleWrite( "--- Invoke Pattern (action) Object ---" & @CRLF ) Local $pInvokePattern1, $oInvokePattern1 $oButton1.GetCurrentPattern( $UIA_InvokePatternId, $pInvokePattern1 ) $oInvokePattern1 = ObjCreateInterface( $pInvokePattern1, $sIID_IUIAutomationInvokePattern, $dtag_IUIAutomationInvokePattern ) If Not IsObj( $oInvokePattern1 ) Then Return ConsoleWrite( "$oInvokePattern1 ERR" & @CRLF ) ConsoleWrite( "$oInvokePattern1 OK" & @CRLF ) ; --- Invoke Pattern (action) Methods --- ConsoleWrite( "--- Invoke Pattern (action) Methods ---" & @CRLF ) $oInvokePattern1.Invoke() ConsoleWrite( "$oInvokePattern1.Invoke()" & @CRLF ) Sleep( 1000 ) ; --- Find window/control --- ConsoleWrite( "--- Find window/control ---" & @CRLF ) Local $pAndCondition1 $oUIAutomation.CreatePropertyCondition( $UIA_AutomationIdPropertyId, "COMODO Advanced Settings", $pCondition0 ) $oUIAutomation.CreatePropertyCondition( $UIA_ClassNamePropertyId, "CisMainWizard", $pCondition1 ) $oUIAutomation.CreateAndCondition( $pCondition0, $pCondition1, $pAndCondition1 ) If Not $pAndCondition1 Then Return ConsoleWrite( "$pAndCondition1 ERR" & @CRLF ) ConsoleWrite( "$pAndCondition1 OK" & @CRLF ) $oDesktop.FindFirst( $TreeScope_Descendants, $pAndCondition1, $pPane1 ) $oPane1 = ObjCreateInterface( $pPane1, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement ) If Not IsObj( $oPane1 ) Then Return ConsoleWrite( "$oPane1 ERR" & @CRLF ) ConsoleWrite( "$oPane1 OK" & @CRLF ) ; --- Find window/control --- ConsoleWrite( "--- Find window/control ---" & @CRLF ) Local $pCondition2, $pCondition3, $pAndCondition3 $oUIAutomation.CreatePropertyCondition( $UIA_ClassNamePropertyId, "btnAseSlide", $pCondition2 ) $oUIAutomation.CreatePropertyCondition( $UIA_ControlTypePropertyId, $UIA_ButtonControlTypeId, $pCondition3 ) $oUIAutomation.CreateAndCondition( $pCondition2, $pCondition3, $pAndCondition3 ) If Not $pAndCondition3 Then Return ConsoleWrite( "$pAndCondition3 ERR" & @CRLF ) ConsoleWrite( "$pAndCondition3 OK" & @CRLF ) Local $pCondition4, $pAndCondition4 $oUIAutomation.CreatePropertyCondition( $UIA_NamePropertyId, "Firewall Button", $pCondition4 ) $oUIAutomation.CreateAndCondition( $pAndCondition3, $pCondition4, $pAndCondition4 ) If Not $pAndCondition4 Then Return ConsoleWrite( "$pAndCondition4 ERR" & @CRLF ) ConsoleWrite( "$pAndCondition4 OK" & @CRLF ) $oPane1.FindFirst( $TreeScope_Descendants, $pAndCondition4, $pButton1 ) $oButton1 = ObjCreateInterface( $pButton1, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement ) If Not IsObj( $oButton1 ) Then Return ConsoleWrite( "$oButton1 ERR" & @CRLF ) ConsoleWrite( "$oButton1 OK" & @CRLF ) ; --- Invoke Pattern (action) Object --- ConsoleWrite( "--- Invoke Pattern (action) Object ---" & @CRLF ) $oButton1.GetCurrentPattern( $UIA_InvokePatternId, $pInvokePattern1 ) $oInvokePattern1 = ObjCreateInterface( $pInvokePattern1, $sIID_IUIAutomationInvokePattern, $dtag_IUIAutomationInvokePattern ) If Not IsObj( $oInvokePattern1 ) Then Return ConsoleWrite( "$oInvokePattern1 ERR" & @CRLF ) ConsoleWrite( "$oInvokePattern1 OK" & @CRLF ) ; --- Invoke Pattern (action) Methods --- ConsoleWrite( "--- Invoke Pattern (action) Methods ---" & @CRLF ) $oInvokePattern1.Invoke() ConsoleWrite( "$oInvokePattern1.Invoke()" & @CRLF ) Sleep( 1000 ) ; --- Find window/control --- ConsoleWrite( "--- Find window/control ---" & @CRLF ) $oUIAutomation.CreatePropertyCondition( $UIA_AutomationIdPropertyId, "A6", $pCondition2 ) $oUIAutomation.CreatePropertyCondition( $UIA_ControlTypePropertyId, $UIA_HyperlinkControlTypeId, $pCondition3 ) $oUIAutomation.CreateAndCondition( $pCondition2, $pCondition3, $pAndCondition3 ) If Not $pAndCondition3 Then Return ConsoleWrite( "$pAndCondition3 ERR" & @CRLF ) ConsoleWrite( "$pAndCondition3 OK" & @CRLF ) $oUIAutomation.CreatePropertyCondition( $UIA_NamePropertyId, "Application Rules Link", $pCondition4 ) $oUIAutomation.CreateAndCondition( $pAndCondition3, $pCondition4, $pAndCondition4 ) If Not $pAndCondition4 Then Return ConsoleWrite( "$pAndCondition4 ERR" & @CRLF ) ConsoleWrite( "$pAndCondition4 OK" & @CRLF ) Local $pHyperlink1, $oHyperlink1 $oPane1.FindFirst( $TreeScope_Descendants, $pAndCondition4, $pHyperlink1 ) $oHyperlink1 = ObjCreateInterface( $pHyperlink1, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement ) If Not IsObj( $oHyperlink1 ) Then Return ConsoleWrite( "$oHyperlink1 ERR" & @CRLF ) ConsoleWrite( "$oHyperlink1 OK" & @CRLF ) ; --- Invoke Pattern (action) Object --- ConsoleWrite( "--- Invoke Pattern (action) Object ---" & @CRLF ) $oHyperlink1.GetCurrentPattern( $UIA_InvokePatternId, $pInvokePattern1 ) $oInvokePattern1 = ObjCreateInterface( $pInvokePattern1, $sIID_IUIAutomationInvokePattern, $dtag_IUIAutomationInvokePattern ) If Not IsObj( $oInvokePattern1 ) Then Return ConsoleWrite( "$oInvokePattern1 ERR" & @CRLF ) ConsoleWrite( "$oInvokePattern1 OK" & @CRLF ) ; --- Invoke Pattern (action) Methods --- ConsoleWrite( "--- Invoke Pattern (action) Methods ---" & @CRLF ) $oInvokePattern1.Invoke() ConsoleWrite( "$oInvokePattern1.Invoke()" & @CRLF ) EndFunc Output in SciTE console: $oUIAutomation OK $oDesktop OK --- Find window/control --- $pCondition0 OK $oPane1 OK --- Find window/control --- $pCondition1 OK $oButton1 OK --- Invoke Pattern (action) Object --- $oInvokePattern1 OK --- Invoke Pattern (action) Methods --- $oInvokePattern1.Invoke() --- Find window/control --- $pAndCondition1 OK $oPane1 OK --- Find window/control --- $pAndCondition3 OK $pAndCondition4 OK $oButton1 OK --- Invoke Pattern (action) Object --- $oInvokePattern1 OK --- Invoke Pattern (action) Methods --- $oInvokePattern1.Invoke() --- Find window/control --- $pAndCondition3 OK $pAndCondition4 OK $oHyperlink1 OK --- Invoke Pattern (action) Object --- $oInvokePattern1 OK --- Invoke Pattern (action) Methods --- $oInvokePattern1.Invoke() In order to create the code for such an automation task, you don't have to write a single line of automation code yourself. UIASpy generates all code. You don't have to do anything else than clicking around in UIASpy, and do a few copy/paste operations. Of course, you must be able to identify all windows and controls, but this is not different from classic automation. So far, I'll maintain the statement from first post: Is this approach (using Microsoft objects and methods directly without a set of intermediate functions in a UDF) difficult? Not at all as the examples show.1 point -
@iamtheky While we are at it, lets not forget about the other languages which are also usable for automation... bash scripting seems to be the popular choice. You can even use NodeJS and JavaScript! That is not the point, as I have mentioned automation is not the primary goal... but rather the AutoIt language itself, there is no language which is as simple and self-contained as AutoIt on Linux... Sure, there are languages which are usable and maybe even better suited for making programs, but none of them has AutoIt's syntax and the approach towards programming, I believe this is what attracted me towards AutoIt I have myopia, but I have my glasses which allow me to clearly see what I am searching for... and those are not rose-tinted by the way1 point
-
@Exit I suppose you can make an april fool joke at any day in april if you are brave enough1 point
-
A cross-platform implementation of the AutoIt language
JLogan3o13 reacted to Exit for a topic
It's 4 days too late for an april joke.1 point -
PureAutoIt machine code compiler small executable
Earthshine reacted to junkew for a topic
I am trying to understand your endgoal. Full AutoIt language compiled? Just a subset of AutoIt commands/functions? Portability on windows, linux, max? How far? Support COM? objCreate? DLLCall? Sendmessage? .... Probably easier to make an AutoIt compiler based on C#1 point -
May be useful for someone! ; START CODE TEST Local $iTime = TimerInit() Local $Sip = _Get_IP() Local $iError = @error, $iExtended = @extended Local $eTime = TimerDiff($iTime) $iTime = "! IP: " & $Sip & @CRLF & "! ON: " & Round($eTime / 1000, 3) & "s" & @CRLF & "! Error: " & $iError & @CRLF & "! Extended: " & $iExtended & @CRLF ConsoleWrite($iTime) MsgBox(64 + 262144, "_Get_IP()", $iTime) ; END CODE TEST Func _Get_IP() ;~ HttpSetUserAgent('Mozilla/5.0 (Windows NT ' & StringRegExpReplace(FileGetVersion('kernel32.dll'), '^(\d+\.\d+)(.*)$', '$1', 1) & '; ' & (((StringInStr(@OSArch, "64") > 0) And (Not (@AutoItX64 > 0))) ? "WOW64" : "Win64; x64") & ")") HttpSetUserAgent('Mozilla/5.0 (Windows NT Win64; x64)') Local $aUrlGetIP = ["https://api.ipify.org", "https://ip4.seeip.org", "http://checkip.dyndns.org", "http://ip.eprci.net/text", "http://www.networksecuritytoolkit.org/nst/tools/ip.php"] Local $aStunServers[8][2] = [["stun.l.google.com", 19302], ["stun.a-mm.tv", 3478], ["stun.cloopen.com", 3478], ["stun.fbsbx.com", 3478], ["stun.hoiio.com", 3478], ["stun.miwifi.com", 3478], ["stun.pjsip.org", 3478], ["stun.yy.com", 3478]] ;_GetIP_ by Dao Van Trong - TRONG.LIVE Local $bPacketRd12 = BinaryMid(BinaryMid(Binary(Random(1.1, 2 ^ 31 - 1)), 1, 6) & Binary(Random(1.1, 2 ^ 31 - 1)), 1, 12) ;Generate request: some random unique ID in size of 12 bytes ; Binding request has class=0x00 and method=0x000000000001 (Binding) and is encoded into the first two bytes as 0x0001. Check http://tools.ietf.org/html/rfc5389#section-15 Local $bBinary = Binary("0x0001000000000000") & $bPacketRd12, $sReturn = "", $iError = 0, $sIpServ, $iSocket, $bRcvData, $StunID = -1, $iReTry = 2, $stunOK = 1, $MAPPED_ADDRESS = 0x0001, $IPv4 = 0x01, $IPv6 = 0x02, $SumStunSrv = UBound($aStunServers) - 1 TCPStartup() While 1 $bRcvData = "" $StunID += 1 If $StunID > $SumStunSrv Then $iReTry -= 1 If $iReTry < 1 Then $stunOK = 0 $iError = -1 ExitLoop EndIf $StunID = -1 ContinueLoop EndIf If $aStunServers[$StunID][0] = "" Then ContinueLoop $sIpServ = TCPNameToIP($aStunServers[$StunID][0]) If @error Then ContinueLoop ; couldn't resolve server's IP $iSocket = UDPOpen($sIpServ, $aStunServers[$StunID][1]) If @error Then ContinueLoop UDPSend($iSocket, $bBinary) If @error Then UDPCloseSocket($iSocket) ContinueLoop EndIf Local $xTimer = 0, $iTimer = TimerInit() Do Sleep(1) $xTimer = TimerDiff($iTimer) $bRcvData = UDPRecv($iSocket, 1280) Until (@error Or ($bRcvData <> "") Or ($xTimer > 2000)) UDPCloseSocket($iSocket) If $bRcvData = "" Then ContinueLoop EndIf ;~ $xTimer = TimerDiff($iTimer) ;~ ConsoleWrite('+ Connected and Get IP from ' & $aStunServers[$StunID][0] & ':' & $aStunServers[$StunID][1] & ' ON: ' & Round($xTimer / 100, 3) & 's ' & @CRLF) ExitLoop WEnd If $stunOK Then #cs ; Struct can be written now in place of binary data, but it's all big-endian (weird for reading in AutoIt): Local $tSTUN = DllStructCreate("byte Header_[8]; byte Header_ID[12];" & _ "byte Type[2];" & _ "byte Length[2];" & _ "byte Attrib;" & _ "byte Family;" & _ "byte Port[2];" & _ "byte IP[4];") #ce ; ...so I will just parse binary directly instead. Local $iSizeData = BinaryLen($bRcvData) If $iSizeData Then ; sanity check Local $bReadID = BinaryMid($bRcvData, 9, 12) ; server returns my unique "ID" Local $iType, $iLength = 0 Local $iPos = 21 ; further parsing starts after the header, see the struct and STUN doc If $bReadID = $bPacketRd12 Then ; check validity of the response by checking returned ID (handle) While $iPos < $iSizeData $iType = Dec(Hex(BinaryMid($bRcvData, $iPos, 2))) ; Big endian to number $iPos += 2 ; skip the size of "Type" field $iLength = Dec(Hex(BinaryMid($bRcvData, $iPos, 2))) ; Big endian to number $iPos += 2 ; skip the size of "Length" field If $iType = $MAPPED_ADDRESS Then ExitLoop $iPos += $iLength ; skip the size of all of the data in this chunk WEnd EndIf $iPos += 1 ; skip the size of "Attrib" field Local $iFamily = Dec(Hex(BinaryMid($bRcvData, $iPos, 1))) ; read "Family" info. - ; Big endian to number $iPos += 1 ; skip the size of "Family" field $iPos += 2 ; skip the size of "Port" field If $iFamily = $IPv4 Then ; Read IP info. Four bytes are IP in network byte order (big endian) $sReturn = Int(BinaryMid($bRcvData, $iPos, 1)) & "." & Int(BinaryMid($bRcvData, $iPos + 1, 1)) & "." & Int(BinaryMid($bRcvData, $iPos + 2, 1)) & "." & Int(BinaryMid($bRcvData, $iPos + 3, 1)) If ($sReturn <> "") And ($sReturn <> "0.0.0.0") Then UDPShutdown() Return $sReturn EndIf $iError = -2 ElseIf $iFamily = $IPv6 Then ; IPv6 $iError = 1 EndIf ; No such data available $iError = 2 EndIf ; You are blocked or something $iError = 3 EndIf Local $aReturn = 0, $iDomain, $aHost, $sPattern = "^(?i)(?:(?:[a-z]+):\/\/)?(?:(?:(?:[^@:]+))(?::(?:[^@]+))?@)?([^\/:]+)(?::(?:\d+))?(?:\/(?:[^?]+)?)?(?:\?\N+)?" For $i = 0 To UBound($aUrlGetIP) - 1 $aHost = StringRegExp($aUrlGetIP[$i], $sPattern, 1) If Not @error And IsArray($aHost) Then $iDomain = $aHost[0] TCPNameToIP($iDomain) If @error Then ContinueLoop $sReturn = InetRead($aUrlGetIP[$i], 1 + 2 + 8 + 16) If @error Or $sReturn == "" Then ContinueLoop $aReturn = StringRegExp(BinaryToString($sReturn), "((?:\d{1,3}\.){3}\d{1,3})", 3) ; [\d\.]{7,15} If Not @error Then $sReturn = $aReturn[0] ExitLoop EndIf $sReturn = "" Next TCPShutdown() If ($sReturn <> "") And ($sReturn <> "0.0.0.0") Then Return SetError(0, $iError, $sReturn) Return SetError(4, $iError, "") ;_GetIP_ by Dao Van Trong - TRONG.LIVE EndFunc ;==>_Get_IP1 point
-
You are responsible for the content you post on this site. Most of the site is a public forum and the private sections have only limited controls over those who can access them - this is particularly true of "Chat". So treat posting here as if you were speaking in a crowded room surrounded by strangers. Recent high-profile defamation events on other sites illustrate that there are ways in which third parties can force personal data, including contents of personal messages, to be released by site owners. Be careful - libelous/defamatory posts can and have landed members of these other sites in legal hot water. Your anonymity is not guaranteed in such situations. M231 point