Leaderboard
Popular Content
Showing content with the highest reputation on 09/28/2019 in all areas
-
[Solved] Perform Multi-Task
seadoggie01 and one other reacted to Gianni for a topic
an udf I wrote some time ago may be handy for your goal. That udf allows you to run many separate tasks and collect results when are ready. a needed condition for the tasks is that those must be run detached from the main scipt and must allow I/O streams redirection. now, if your tasks are executed by autoit functions instead of external executables, you can still adopt a solution like this: create an "external" autoit script that accepts command line parameters, and returns results back to the caller (a sort of foreign AutoIt function callable from the main script, but runned detached). In this way you can run more instances of that function at a time and collect results while available. Here is how: from the main script use a statement similar to this $hPid = Run(@AutoItExe & ' Ext_Func.au3 Param1 ' & $Param2 & ' $Param3', "", @SW_HIDE, 0x2) ; (0x2) -> $STDOUT_CHILD = Provide a handle to the child's STDOUT stream where Ext_Func.au3 is the external script followed by parameters separated by spaces. In the external script you get parameters by the $CmdLine[] variable and you send results to the caller using the Consolewrite function. (this is performed automatically if you use the MultiTask.udf) Since an example is better than many words (especially if talked by a non-native speaker), here it is: to calculate some of the "hash" you need I've used this nice function by @Danyfirex and I've adapted it a bit so to be an "external" function. Save this function as hash_hmac.au3 in the folder along with your main script. ; by Danyfirex ; see here: https://www.autoitscript.com/forum/topic/191500-hash-hmac/ If $CmdLine[0] < 3 Then Exit ; Read parameters Local $sXkey = $CmdLine[1] ; Key Local $sFile = $CmdLine[2] ; File Path Local $sHash = $CmdLine[3] ; hash algorithm If Not FileExists($sFile) Then Exit If Not StringInStr("|SHA512|SHA256|SHA1|SHA384|MD5|RIPEMD160|", '|' & $sHash & '|') Then Exit Local $hFile = FileOpen($sFile, 16) ; 16 -> $FO_BINARY (16) = Force binary mode Local $oHMAC = ObjCreate("System.Security.Cryptography.HMAC" & $sHash) $oHMAC.key = Binary($sXkey) ; Calculate hash hmac of the file Local $bHash = $oHMAC.ComputeHash_2(FileRead($hFile)) ConsoleWrite($bHash) ; send result to stdout I have also modified/added only small parts of your main script just to allow the use of the MultiTask.udf, leaving everything else unchanged. I leave you the control of your overall logic ... so save also this modified version of your Main script and run it (of course no need to say to also save the MultiTask.udf udf in your folder) Parts I've modified are enclosed between two comment lines like this: ; ========================================================================================================== To see it in action drop some files on the GUI and then hit your "Start calculate" button. ; #RequireAdmin Opt("TrayAutoPause", 0) Opt("MustDeclareVars", 1) #include <WinAPISys.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <GuiListView.au3> #include <Crypt.au3> ; ========================================================================================================== #include 'MultiTask.au3' ; <-- get here: https://www.autoitscript.com/forum/topic/192157-multi-task-easily-run-and-mange-many-processes/ ; ========================================================================================================== #Region Global $hHUI = GUICreate("AutoIT Hash Caculator", 791, 640, 652, 117, -1, BitOR($WS_EX_ACCEPTFILES, $WS_EX_WINDOWEDGE)) GUICtrlSetState(-1, $GUI_DROPACCEPTED) GUICtrlCreateLabel("Task 1:", 18, 384, 40, 17) Global $Task1_Label_Status_1 = GUICtrlCreateLabel("DREADY", 73, 384, 55, 17) GUICtrlSetState(-1, $GUI_DROPACCEPTED) Global $Task1_Label_Status_2 = GUICtrlCreateLabel("Calculate CRC32", 140, 384, 130, 17) GUICtrlSetState(-1, $GUI_DROPACCEPTED) Global $Task1_Label_Status_3 = GUICtrlCreateLabel("", 277, 384, 500, 17) GUICtrlSetState(-1, $GUI_DROPACCEPTED) GUICtrlCreateLabel("Task 2:", 18, 416, 40, 17) GUICtrlSetState(-1, $GUI_DROPACCEPTED) Global $Task2_Label_Status_1 = GUICtrlCreateLabel("READY", 73, 416, 55, 17) GUICtrlSetState(-1, $GUI_DROPACCEPTED) Global $Task2_Label_Status_2 = GUICtrlCreateLabel("Calculate MD2", 140, 416, 130, 17) GUICtrlSetState(-1, $GUI_DROPACCEPTED) Global $Task2_Label_Status_3 = GUICtrlCreateLabel("", 277, 416, 500, 17) GUICtrlSetState(-1, $GUI_DROPACCEPTED) GUICtrlCreateLabel("Task 3:", 18, 445, 40, 17) GUICtrlSetState(-1, $GUI_DROPACCEPTED) Global $Task3_Label_Status_1 = GUICtrlCreateLabel("READY", 73, 445, 55, 17) GUICtrlSetState(-1, $GUI_DROPACCEPTED) Global $Task3_Label_Status_2 = GUICtrlCreateLabel("Calculate MD4", 140, 445, 130, 17) GUICtrlSetState(-1, $GUI_DROPACCEPTED) Global $Task3_Label_Status_3 = GUICtrlCreateLabel("", 277, 445, 500, 17) GUICtrlSetState(-1, $GUI_DROPACCEPTED) GUICtrlCreateLabel("Task 4:", 18, 473, 40, 17) GUICtrlSetState(-1, $GUI_DROPACCEPTED) Global $Task4_Label_Status_1 = GUICtrlCreateLabel("READY", 73, 473, 55, 17) GUICtrlSetState(-1, $GUI_DROPACCEPTED) Global $Task4_Label_Status_2 = GUICtrlCreateLabel("Calculate MD5 ", 140, 473, 130, 17) GUICtrlSetState(-1, $GUI_DROPACCEPTED) Global $Task4_Label_Status_3 = GUICtrlCreateLabel("", 277, 473, 500, 17) GUICtrlSetState(-1, $GUI_DROPACCEPTED) GUICtrlCreateLabel("Task 5:", 18, 503, 40, 17) GUICtrlSetState(-1, $GUI_DROPACCEPTED) Global $Task5_Label_Status_1 = GUICtrlCreateLabel("READY", 73, 503, 55, 17) GUICtrlSetState(-1, $GUI_DROPACCEPTED) Global $Task5_Label_Status_2 = GUICtrlCreateLabel("Calculate SHA1 ", 140, 503, 130, 17) GUICtrlSetState(-1, $GUI_DROPACCEPTED) Global $Task5_Label_Status_3 = GUICtrlCreateLabel("", 277, 503, 500, 17) GUICtrlSetState(-1, $GUI_DROPACCEPTED) GUICtrlCreateLabel("Task 6:", 18, 530, 40, 17) GUICtrlSetState(-1, $GUI_DROPACCEPTED) Global $Task6_Label_Status_1 = GUICtrlCreateLabel("READY", 73, 530, 55, 17) GUICtrlSetState(-1, $GUI_DROPACCEPTED) Global $Task6_Label_Status_2 = GUICtrlCreateLabel("Calculate SHA256 ", 140, 530, 130, 17) GUICtrlSetState(-1, $GUI_DROPACCEPTED) Global $Task6_Label_Status_3 = GUICtrlCreateLabel("", 277, 530, 500, 17) GUICtrlCreateLabel("Task 7:", 18, 556, 40, 17) GUICtrlSetState(-1, $GUI_DROPACCEPTED) Global $Task7_Label_Status_1 = GUICtrlCreateLabel("READY", 73, 556, 55, 17) GUICtrlSetState(-1, $GUI_DROPACCEPTED) Global $Task7_Label_Status_2 = GUICtrlCreateLabel("Calculate SHA384 ", 140, 556, 130, 17) GUICtrlSetState(-1, $GUI_DROPACCEPTED) Global $Task7_Label_Status_3 = GUICtrlCreateLabel("", 277, 556, 500, 17) GUICtrlCreateLabel("Task 8:", 18, 581, 40, 17) GUICtrlSetState(-1, $GUI_DROPACCEPTED) Global $Task8_Label_Status_1 = GUICtrlCreateLabel("READY", 73, 581, 55, 17) GUICtrlSetState(-1, $GUI_DROPACCEPTED) Global $Task8_Label_Status_2 = GUICtrlCreateLabel("Calculate SHA512 ", 140, 581, 130, 17) GUICtrlSetState(-1, $GUI_DROPACCEPTED) Global $Task8_Label_Status_3 = GUICtrlCreateLabel("", 277, 581, 500, 17) GUICtrlSetState(-1, $GUI_DROPACCEPTED) GUICtrlCreateLabel("Number of tasks running:", 16, 352, 122, 17) GUICtrlSetState(-1, $GUI_DROPACCEPTED) Global $Label_Tasks_Running = GUICtrlCreateLabel("0", 160, 352, 10, 17) GUICtrlSetState(-1, $GUI_DROPACCEPTED) GUICtrlCreateLabel("Number of completed files:", 200, 352, 129, 17) GUICtrlSetState(-1, $GUI_DROPACCEPTED) Global $Label_Number_Files_Completed = GUICtrlCreateLabel("0", 336, 352, 42, 17) GUICtrlSetState(-1, $GUI_DROPACCEPTED) GUICtrlCreateLabel("Of total files to process: ", 400, 352, 117, 17) GUICtrlSetState(-1, $GUI_DROPACCEPTED) Global $Label_Number_Files_Total = GUICtrlCreateLabel("0", 520, 352, 72, 17) GUICtrlSetState(-1, $GUI_DROPACCEPTED) Global $Button1_Start = GUICtrlCreateButton("Start Calculate ", 512, 8, 123, 33) GUICtrlSetState(-1, $GUI_DROPACCEPTED) Global $Button2_STOP = GUICtrlCreateButton("STOP", 656, 8, 51, 33) GUICtrlSetState(-1, $GUI_DROPACCEPTED) Global $Button3_CLEAR = GUICtrlCreateButton("CLEAR", 720, 8, 51, 33) GUICtrlSetState(-1, $GUI_DROPACCEPTED) Global $Button4_Select_Files = GUICtrlCreateButton("Select file ...", 608, 344, 171, 25) GUICtrlSetState(-1, $GUI_DROPACCEPTED) Global $Group_ListFile = GUICtrlCreateGroup("Drag and Drop files here (this box)", 8, 40, 769, 297, BitOR($GUI_SS_DEFAULT_GROUP, $BS_CENTER)) GUICtrlSetState(-1, $GUI_DROPACCEPTED) Global $idListview = GUICtrlCreateListView("NUM|STATUS|FILE|CRC32|MD2|MD4|MD5|SHA1|SHA256|SHA384|SHA512", 24, 72, 745, 253) GUICtrlSetState(-1, $GUI_DROPACCEPTED) GUICtrlCreateGroup("", -99, -99, 1, 1) Global $Checkbox1_CRC32 = GUICtrlCreateCheckbox("CRC32", 16, 16, 50, 17) GUICtrlSetState(-1, $GUI_DROPACCEPTED + $GUI_CHECKED) Global $Checkbox2_MD2 = GUICtrlCreateCheckbox("MD2", 72, 16, 50, 17) GUICtrlSetState(-1, $GUI_DROPACCEPTED) Global $Checkbox3_MD4 = GUICtrlCreateCheckbox("MD4", 128, 16, 50, 17) GUICtrlSetState(-1, $GUI_DROPACCEPTED) Global $Checkbox4_MD5 = GUICtrlCreateCheckbox("MD5", 184, 16, 50, 17) GUICtrlSetState(-1, $GUI_DROPACCEPTED + $GUI_CHECKED) Global $Checkbox5_SHA1 = GUICtrlCreateCheckbox("SHA1", 240, 16, 52, 17) GUICtrlSetState(-1, $GUI_DROPACCEPTED + $GUI_CHECKED) Global $Checkbox6_SHA256 = GUICtrlCreateCheckbox("SHA256", 296, 16, 60, 17) GUICtrlSetState(-1, $GUI_DROPACCEPTED + $GUI_CHECKED) Global $Checkbox7_SHA384 = GUICtrlCreateCheckbox("SHA384", 360, 16, 65, 17) GUICtrlSetState(-1, $GUI_DROPACCEPTED) Global $Checkbox8_SHA256 = GUICtrlCreateCheckbox("SHA256", 440, 16, 73, 17) GUICtrlSetState(-1, $GUI_DROPACCEPTED) Global $Label_Status = GUICtrlCreateLabel("Status line: All action is completed, ready for the next request!", 16, 608, 757, 17) GUICtrlSetState(-1, $GUI_DROPACCEPTED) GUISetState(@SW_SHOW) #EndRegion _WinAPI_ChangeWindowMessageFilterEx($hHUI, $WM_DROPFILES, $MSGFLT_ALLOW) ; Drag and Drop on Admin _WinAPI_ChangeWindowMessageFilterEx($hHUI, $WM_COPYDATA, $MSGFLT_ALLOW) ; Drag and Drop on Admin _WinAPI_ChangeWindowMessageFilterEx($hHUI, $WM_COPYGLOBALDATA, $MSGFLT_ALLOW) ; Drag and Drop on Admin Global $nMsg, $__aDropFiles GUIRegisterMsg($WM_DROPFILES, "WM_DROPFILES") ; EG DATA TEST GUI START ;~ GUICtrlCreateListViewItem("1|OnProcess|C:\Mikie Hara\Shizuka Nakamura\Buruma Aoi\Satomi Suzuki\Ai Sayama\Nao\Aki Hoshino.MP4|F7331A65|||CCD6116BB67F24905F2B128FBE2B97BA|74BC97D15B9B22649C228BC77D26C7D5011B52B0|EFE6985D1A93D5CDE9E7F5F68AC52AF894B9FC59B3E24B8F635153D526FC940C||", $idListview) ;~ GUICtrlCreateListViewItem("2|OnProcess|C:\Mai Nishida\Suzuka Ishikawa\Ameri Ichinose\Uta Kohaku\The Ca\Noriko Ashiya\Rina Koike.ts|FFFFFFFF|||9F647B59874D8D10CE6F1102D5519C1A|B63F61838E6A93572A0519FF2D0846BCBE6DF370|2774B7FF1108FF9513D6ED1F7F58EFCB0FA30F161246FF2F8E751732560E0902||", $idListview) ;~ GUICtrlCreateListViewItem("3|OnProcess|D:\Megu Fujiura\Rola Takizawa\Maria Ozawa\Ria Sakurai\Shion Utsunomiya\Emiri Suzuhara.mkv|26E70099|||2AB25EC471E53FBF3F241A5D3C51E138|2AA856E6DA6C991094335F64F45138592C451DDF|B0CFCE9490B987EC4359472853BC5007BD345D69475636508E0EB94327CD6669||", $idListview) ;~ GUICtrlCreateListViewItem("4|OnProcess|E:\Saori Hara\Ameri Ichinose\Akiho Yoshizawa\Tsubasa Amami\Risa Tachibana\Tina Yuzuki.mp4|95693338|||CCC322F4B18222858715E22A085659AC|220EB673D4AED9F1652C1CE3D2731CD96A8138F2|044263A3BA067F0967D311782916088BDB723CCC4E15E87FF4B2973E037E593E||", $idListview) ;~ GUICtrlCreateListViewItem("5|OnProcess|F:\Kotone-amamiya\Erika Momotani\Jun Aizawa\Arisa kanno\Yura Sakura\Sana Anjyu (Hina Kurumi).ts|CD5BC9F1|||||||", $idListview) ;~ GUICtrlCreateListViewItem("6|OnProcess|G:\Sora Aoi\Shiori Kamisaki\Takizawa Laura\Rina Ishihara\Rin Higurashi\Aino Kishi\Yui Hatano.mkv||||||||", $idListview) ;~ GUICtrlCreateListViewItem("7|OnProcess|H:\Asuka Ichinose\Anri Sugihara\Ai Shinozaki\Hiyo Nishizuku\Riku Minato\Kirara Asuka\Necoco.MP4||||||||", $idListview) ;~ GUICtrlCreateListViewItem("8|OnProcess|I:\Hina Maeda\Maki Hojo\Yuma Asami\Jessica Kizaki\Kokomi Naruse\Kana Yume\Mihiro Taniguchi.TS||||||||", $idListview) ; EG DATA TEST GUI END ; ========================================================================================================== Local $sFile, $tasks ; ========================================================================================================== While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_DROPPED If ($__aDropFiles[0] > 0) Then For $i = 1 To $__aDropFiles[0] ConsoleWrite($__aDropFiles[$i] & @CRLF) GUICtrlCreateListViewItem($i & "|" & "WAIT|" & $__aDropFiles[$i] & "||||||||", $idListview) Next EndIf Case $Button1_Start ; ========================================================================================================== ; Get filenames directly from the ListView If _GUICtrlListView_GetItemCount($idListview) Then ; for each file run more tasks For $i = 0 To _GUICtrlListView_GetItemCount($idListview) - 1 $sFile = _GUICtrlListView_GetItemText($idListview, $i, 2) ; for each file run 5 tasks _TaskRun($i, @AutoItExe & ' .\hash_hmac.au3' & " MyCriptKey" & " " & $sFile & " MD5", "_SetColumn6") _TaskRun($i, @AutoItExe & ' .\hash_hmac.au3' & " MyCriptKey" & " " & $sFile & " SHA1", "_SetColumn7") _TaskRun($i, @AutoItExe & ' .\hash_hmac.au3' & " MyCriptKey" & " " & $sFile & " SHA256", "_SetColumn8") _TaskRun($i, @AutoItExe & ' .\hash_hmac.au3' & " MyCriptKey" & " " & $sFile & " SHA384", "_SetColumn9") _TaskRun($i, @AutoItExe & ' .\hash_hmac.au3' & " MyCriptKey" & " " & $sFile & " SHA512", "_SetColumn10") Next Do Sleep(250) ; you could perform other jobs here while waiting for the tasks to finish $tasks = _TasksCheckStatus() ; manages the running tasks and get number of tasks still running GUICtrlSetData($Label_Tasks_Running, $tasks) Until Not $tasks ; _TasksCheckStatus() ; <-- this function performs management of running tasks ; and should be called as often as possible MsgBox(0, "Done", "Tasks completed", 2) EndIf ; ========================================================================================================== Case $Button2_STOP Case $Button3_CLEAR ; ========================================================================================================== _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($idListview)) ; empty the listview ; ========================================================================================================== Case $Button4_Select_Files Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _HashFile($sFilePath, $iAlgID, $sIndex = 0) ;~ $CALG_MD2 0x00008001; Hashing algorithm 128-bit ;~ $CALG_MD4 0x00008002; Hashing algorithm 128-bit ;~ $CALG_MD5 0x00008003; Hashing algorithm 128-bit ;~ $CALG_SHA1 0x00008004; Hashing algorithm 160-bit ;~ $CALG_SHA_256 0x0000800c; Hashing algorithm 256-bit ;~ $CALG_SHA_384 0x0000800d; Hashing algorithm 384-bit ;~ $CALG_SHA_512 0x0000800e; Hashing algorithm 512-bit Local $sFileSize = FileGetSize($sFilePath) Local $iTimeInit = TimerInit() Local $dHash = _Crypt_HashFile($sFilePath, $iAlgID) Local $iTimerDiff = TimerDiff($iTimeInit) EndFunc ;==>_HashFile Func _FormatElapsedTime($Input_Seconds = 0) If $Input_Seconds < 1 Then Return 0 $Input_Seconds = $Input_Seconds / 1000 Local $ElapsedMessage = '', $Input = $Input_Seconds, $Minutes, $Hours, $Days Switch $Input_Seconds Case 0 To 59 $ElapsedMessage &= Round($Input, 3) & ' seconds.' Case 60 To 3599 $Minutes = Int($Input / 60) $Input -= ($Minutes * 60) $ElapsedMessage &= $Minutes & ' minutes, ' $ElapsedMessage &= Int($Input) & ' seconds.' Case 3600 To 86399 $Hours = Int($Input / 3600) $Input -= ($Hours * 3600) $ElapsedMessage &= $Hours & ' hours, ' $Minutes = Int($Input / 60) $Input -= ($Minutes * 60) $ElapsedMessage &= $Minutes & ' minutes, ' $ElapsedMessage &= Int($Input) & ' seconds.' Case Else $Days = Int($Input / 86400) $Input -= ($Days * 86400) $ElapsedMessage &= $Days & ' days, ' $Hours = Int($Input / 3600) $Input -= ($Hours * 3600) $ElapsedMessage &= $Hours & ' hours, ' $Minutes = Int($Input / 60) $Input -= ($Minutes * 60) $ElapsedMessage &= $Minutes & ' minutes, ' $ElapsedMessage &= Int($Input) & ' seconds.' EndSwitch Return $ElapsedMessage EndFunc ;==>_FormatElapsedTime Func _ByteSuffix($iBytes, $iRound = 2) ; By Spiff59 Local $a, $aArray[9] = [" B", " KB", " MB", " GB", " TB", " PB", "EB", "ZB", "YB"] While $iBytes > 1023 $a += 1 $iBytes /= 1024 WEnd Return Round($iBytes, $iRound) & $aArray[$a] EndFunc ;==>_ByteSuffix Func WM_DROPFILES($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $ilParam Switch $iMsg Case $WM_DROPFILES Local $aReturn = _WinAPI_DragQueryFileEx($iwParam) If IsArray($aReturn) Then $__aDropFiles = $aReturn Else Local $aError[1] = [0] $__aDropFiles = $aError EndIf EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_DROPFILES ; ========================================================================================================== ; Task's Callback functions ; ------------------------- Func _SetColumn6($aData) _GUICtrlListView_SetItemText($idListview, $aData[0], Binary($aData[1]), 6) ; column 6 MD5 EndFunc ;==>_SetColumn6 Func _SetColumn7($aData) _GUICtrlListView_SetItemText($idListview, $aData[0], Binary($aData[1]), 7) ; column 7 SHA1 EndFunc ;==>_SetColumn7 Func _SetColumn8($aData) _GUICtrlListView_SetItemText($idListview, $aData[0], Binary($aData[1]), 8) ; column 8 SHA256 EndFunc ;==>_SetColumn8 Func _SetColumn9($aData) _GUICtrlListView_SetItemText($idListview, $aData[0], Binary($aData[1]), 9) ; column 9 SHA384 EndFunc ;==>_SetColumn9 Func _SetColumn10($aData) _GUICtrlListView_SetItemText($idListview, $aData[0], Binary($aData[1]), 10) ; column 10 SHA512 EndFunc ;==>_SetColumn10 ; ==========================================================================================================2 points -
Hello guys. Here is a small function to create a hash hmac similar to hash_hmac PHP function. Supported are: SHA512,SHA256,SHA1,SHA384,MD5 and RIPEMD160. Local $sSecret = "SecretKey" Local $sMessage = "AutoIt Rocks!!!" ConsoleWrite("HMAC-SHA256: " & @TAB & @TAB & _HashHMAC("SHA512", $sMessage, $sSecret) & @CRLF) ConsoleWrite("HMAC-SHA256: " & @TAB & @TAB & _HashHMAC("SHA256", $sMessage, $sSecret) & @CRLF) ConsoleWrite("HMAC-SHA1: " & @TAB & @TAB & _HashHMAC("SHA1", $sMessage, $sSecret) & @CRLF) ConsoleWrite("HMAC-SHA384: " & @TAB & @TAB & _HashHMAC("SHA384", $sMessage, $sSecret) & @CRLF) ConsoleWrite("HMAC-MD5: " & @TAB & @TAB & _HashHMAC("MD5", $sMessage, $sSecret) & @CRLF) ConsoleWrite("HMAC-RIPEMD160: " & @TAB & _HashHMAC("RIPEMD160", $sMessage, $sSecret) & @CRLF) Func _HashHMAC($sAlgorithm, $bData, $bKey, $bRaw_Output = False) Local $oHashHMACErrorHandler = ObjEvent("AutoIt.Error", "_HashHMACErrorHandler") Local $oHMAC = ObjCreate("System.Security.Cryptography.HMAC" & $sAlgorithm) If @error Then SetError(1, 0, "") $oHMAC.key = Binary($bKey) Local $bHash = $oHMAC.ComputeHash_2(Binary($bData)) Return SetError(0, 0, $bRaw_Output ? $bHash : StringLower(StringMid($bHash, 3))) EndFunc ;==>_HashHMAC Func _HashHMACErrorHandler($oError) ;Dummy Error Handler EndFunc ;==>_HashHMACErrorHandler It requires .NET Framework 2.0 or higher. Saludos1 point
-
yours does open lots of edge cases, maybe something down this path... (but not this, because it too has many lackings). Local $__ItemPaths = 'C:\Users\user\Contacts\' & @LF & _ 'C:\Users\user2\' & @CRLF & _ 'C:\Users\user' & @CRLF & _ 'C:\Users\user\' & @CRLF & _ 'C:\Users\user2\stuff' $sSearch = "C:\Users\user" ;~ $sOutput = StringRegExpReplace($__ItemPaths, "(\Q" & $sSearch & "\E([\\])\R)", "") ; original $sOutput = StringRegExpReplace($__ItemPaths, "(\Q" & $sSearch & "\E\\*(?:\r|\z))", "") MsgBox(0, '', $sOutput)1 point
-
Aw gee whiz. I've been using AutoIt extensively for about five years and never ran into this problem before. Thanks for your help.1 point
-
https://www.autoitscript.com/autoit3/docs/intro/lang_operators.htm TLDR; use ==1 point
-
@Hiyoal Okay, I think I found the issue. The difference is my xml.au3. It appears that I had found an issue with it a while ago and fixed it in my version. The issue actually was related to Example 6. Please try the xml.au3 file that I have attached. Please let me know if it resolves the issue you are having. You can do a diff between mine and the one in the latest zip if you want to see the modifications. There are only 2 changes. One line was modified and the other line was added. @mLipok If you need an explanation of my modifications, please let me know. I would be happy to explain the issue that I found and how the 2 lines fix the issue with Example 6. XML.au31 point
-
Having a "browse" button in a GUI?
IhaVeNoCluE reacted to i542 for a topic
#include <GUIConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Browse Button Example", 303, 141, 193, 115) $Input1 = GUICtrlCreateInput("", 21, 19, 201, 21) $Button1 = GUICtrlCreateButton("Browse...", 235, 16, 64, 25, 0) $Group1 = GUICtrlCreateGroup("Browse what", 20, 44, 279, 63) $Radio1 = GUICtrlCreateRadio("Folder", 26, 60, 113, 17) $Radio2 = GUICtrlCreateRadio("File to open", 26, 74, 113, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $Button2 = GUICtrlCreateButton("Exit", 166, 111, 75, 25, 0) $Label1 = GUICtrlCreateLabel("i542 ", 0, 0, 27, 17, -1, $GUI_WS_EX_PARENTDRAG) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Select Case $nMsg = $GUI_EVENT_CLOSE Or $nMsg = $Button2 Exit Case $nMsg = $Button1 If GuiCtrlRead($Radio1) = $GUI_CHECKED Then $txt=FileSelectFolder( "Open", "C:\") GUICtrlSetData($Input1,$txt) ElseIf GuiCtrlRead($Radio2) = $GUI_CHECKED Then $txt=FileOpenDialog("Open", "C:\","Text files (*.txt)") GUICtrlSetData($Input1,$txt) Else MsgBox(64,"Browse button example","You must select something.") EndIf EndSelect WEnd Sony Ericsson T290i and J210i owner. i5421 point