Leaderboard
Popular Content
Showing content with the highest reputation on 10/17/2018 in all areas
-
Gather all functions and Vars into main code
Davidowicza and 3 others reacted to Jos for a topic
mm... not that long yet: Jos4 points -
@Deye This question should have been posted in GH&S. Here's a quick and simple method which does not verify whether paths exist, nor does it verify syntax. It might do what you want, or at least give you some ideas. #include <Array.au3> Local $aTest = _ ['H:\', _ 'False', _ 'False', _ 'False', _ 'Downloads', _ 'Documents', _ 'Control Panel\Network and Internet\Network Connections', _ 'C:\Users\', _ 'C:\'] _ArrayDisplay($aTest, 'Before') For $i = 0 To UBound($aTest) -1 If StringRegExp($aTest[$i], '(\A[A-Z]\:\\)') Then $aTest[$i] = 'z' & $aTest[$i] Else $aTest[$i] = 'a' & $aTest[$i] EndIf Next _ArraySort($aTest) For $i = 0 To UBound($aTest) -1 $aTest[$i] = StringTrimLeft($aTest[$i], 1) Next _ArrayDisplay($aTest, 'After')1 point
-
@caramen You should read the link posted by @mLipok. The Autoit command that triggers the popup doesn't finish executing until the popup is gone, so your ControlClick won't work if it's in the same script.1 point
-
Working Crypt. Dont remember where i took it but i dont have the credit of this script. #include <Crypt.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> Local $bAlgorithm = $CALG_RC4 Local $sFilePath = "" GUICreate("File Encrypter", 425, 100) Local $iSourceInput = GUICtrlCreateInput("", 5, 5, 200, 20) Local $iSourceBrowse = GUICtrlCreateButton("...", 210, 5, 35, 20) Local $iDestinationInput = GUICtrlCreateInput("", 5, 30, 200, 20) Local $iDestinationBrowse = GUICtrlCreateButton("...", 210, 30, 35, 20) GUICtrlCreateLabel("Password:", 5, 60, 200, 20) Local $iPasswordInput = GUICtrlCreateInput("", 5, 75, 200, 20) Local $iCombo = GUICtrlCreateCombo("", 210, 75, 100, 20, $CBS_DROPDOWNLIST) GUICtrlSetData(-1, "3DES|AES (128bit)|AES (192bit)|AES (256bit)|DES|RC2|RC4", "RC4") Local $iEncrypt = GUICtrlCreateButton("Encrypt", 355, 70, 65, 25) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $iSourceBrowse $sFilePath = FileOpenDialog("Select a file to encrypt.", "", "All files (*.*)") ; Select a file to encrypt. If @error Then ContinueLoop EndIf GUICtrlSetData($iSourceInput, $sFilePath) ; Set the inputbox with the filepath. Case $iDestinationBrowse $sFilePath = FileSaveDialog("Save the file as ...", "", "All files (*.*)") ; Select a file to save the encrypted data to. If @error Then ContinueLoop EndIf GUICtrlSetData($iDestinationInput, $sFilePath) ; Set the inputbox with the filepath. Case $iCombo ; Check when the combobox is selected and retrieve the correct algorithm. Switch GUICtrlRead($iCombo) ; Read the combobox selection. Case "3DES" $bAlgorithm = $CALG_3DES Case "AES (128bit)" If @OSVersion = "WIN_2000" Then MsgBox(16, "Error", "Sorry, this algorithm is not available on Windows 2000.") ; Show an error if the system is Windows 2000. ContinueLoop EndIf $bAlgorithm = $CALG_AES_128 Case "AES (192bit)" If @OSVersion = "WIN_2000" Then MsgBox(16, "Error", "Sorry, this algorithm is not available on Windows 2000.") ContinueLoop EndIf $bAlgorithm = $CALG_AES_192 Case "AES (256bit)" If @OSVersion = "WIN_2000" Then MsgBox(16, "Error", "Sorry, this algorithm is not available on Windows 2000.") ContinueLoop EndIf $bAlgorithm = $CALG_AES_256 Case "DES" $bAlgorithm = $CALG_DES Case "RC2" $bAlgorithm = $CALG_RC2 Case "RC4" $bAlgorithm = $CALG_RC4 EndSwitch Case $iEncrypt Local $sSourceRead = GUICtrlRead($iSourceInput) ; Read the source filepath input. Local $sDestinationRead = GUICtrlRead($iDestinationInput) ; Read the destination filepath input. Local $sPasswordRead = GUICtrlRead($iPasswordInput) ; Read the password input. If StringStripWS($sSourceRead, 8) <> "" And StringStripWS($sDestinationRead, 8) <> "" And StringStripWS($sPasswordRead, 8) <> "" And FileExists($sSourceRead) Then ; Check there is a file available to encrypt and a password has been set. Local $iSuccess = _Crypt_EncryptFile($sSourceRead, $sDestinationRead, $sPasswordRead, $bAlgorithm) ; Encrypt the file. If $iSuccess Then MsgBox(0, "Success", "Operation succeeded.") FileDelete(@SCRIPTDIR & '\Settingstest.ini') Else Switch @error Case 1 MsgBox(16, "Error", "Failed to create the key.") Case 2 MsgBox(16, "Error", "Couldn't open the source file.") Case 3 MsgBox(16, "Error", "Couldn't open the destination file.") Case 4 Or 5 MsgBox(16, "Error", "Encryption error.") EndSwitch EndIf Else MsgBox(16, "Error", "Please ensure the relevant information has been entered correctly.") EndIf EndSwitch WEnd Working crypt/decrypt : #include <Crypt.au3> Local Const $sUserKey = "CryptPassword" ; Declare a password string to decrypt/encrypt the data. Local $sData = "..upon a time there was a language without any standardized cryptographic functions. That language is no more." ; Data that will be encrypted. Local $bEncrypted = _Crypt_EncryptData($sData, $sUserKey, $CALG_RC4) ; Encrypt the data using the generic password string. The return value is a binary string. MsgBox(0, "Crypted data", "BinaryToString"&@CRLF&BinaryToString($bEncrypted)) MsgBox(0, "Crypted data", "Nothing"&@CRLF&$bEncrypted) MsgBox(0, "Crypted data", "StringToBinary"&@CRLF&StringToBinary($bEncrypted)) $bEncrypted = _Crypt_DecryptData($bEncrypted, $sUserKey, $CALG_RC4) ; Decrypt the data using the generic password string. The return value is a binary string. MsgBox(0, "Decrypted data", "BinaryToString"&@CRLF&BinaryToString($bEncrypted)) ; Convert the binary string using BinaryToString to display the initial data we encrypted. MsgBox(0, "Decrypted data", "Nothing"&@CRLF&$bEncrypted) MsgBox(0, "Decrypted data", "StringToBinary"&@CRLF&StringToBinary($bEncrypted)) For me it was very hard when i learned it.... From now i can understand everything from this script so easy ... You need help on that ? I can notice directly that you changed the syntaxt... I will be able to help you only if you keep the correct syntaxt. Crypt your inputs with the normal process then send the output in a file without Crypt UDF. It s not needed to do everything in one time. Edit: Added message box with crypted data in exemple 2 so you can see it is crypted then decrypted.1 point
-
[SOLVED] - Help with Popup window on a IE automation
LearnbeforeyouBurn reacted to Danp2 for a topic
Have you tried something like this instead of actually clicking the link? _IENavigate ($oIE, "javascript:canNotAddTax('0');")1 point -
[SOLVED] - Help with Popup window on a IE automation
LearnbeforeyouBurn reacted to mLipok for a topic
take a look here:1 point -
crypt variable on the fly is possible ?
FrancescoDiMuro reacted to Jos for a topic
What about you try yourself to modify the encryptfile UDF you are trying to copy to make it encrypt the string instead of letting others do YOUR work as usual, and ONLY come back when you have an issue with YOUR modifications? Jos1 point -
Try that : Local $MyVar[3] = ["element 1", "element 2", "element 3"] MsgBox (0, "", $MyVar) MsgBox (0, "", $MyVar[0]) MsgBox (0, "", $MyVar[1]) MsgBox (0, "", $MyVar[2]) ;This is equal to $iRow amount (3) - 1 = 2 $iRow = UBound ($MyVar) MsgBox (0, "", $iRow) If $iRow > 3 Then ; With that you dodged the fact to trying to access an non accessible $Variable. in this case it was $MyVar[3] MsgBox (0, "", $MyVar[$iRow-4]);$MyVar[3] MsgBox (0, "", $MyVar[$iRow-3]);$MyVar[2] MsgBox (0, "", $MyVar[$iRow-2]);$MyVar[1] MsgBox (0, "", $MyVar[$iRow-1]);$MyVar[0] EndIf If $iRow > 2 Then MsgBox (0, "", $MyVar[$iRow-3]);$MyVar[2] MsgBox (0, "", $MyVar[$iRow-2]);$MyVar[1] MsgBox (0, "", $MyVar[$iRow-1]);$MyVar[0] EndIf If $iRow > 1 Then MsgBox (0, "", $MyVar[$iRow-2]);$MyVar[1] MsgBox (0, "", $MyVar[$iRow-1]);$MyVar[0] EndIF If $iRow > 0 Then MsgBox (0, "", $MyVar[$iRow-1]) ;$MyVar[0] EndIf Read help file about : UBound IsArray1 point
-
Help with Opt("GUIOnEventMode",1)
Mannyfresh31 reacted to Subz for a topic
Once it goes into the function it's stuck inside the While/Wend loop, instead you could use something like: #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <ProgressConstants.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode",1) Global $Stop = True Global $x = 1, $i = 0 #Region ### START Koda GUI section ### Form= Global $Form1 = GUICreate("Form1", 579, 212, 192, 124) Global $Button1 = GUICtrlCreateButton("Stop", 432, 136, 75, 25) Global $Button2 = GUICtrlCreateButton("Start", 96, 136, 75, 25) Global $Progress1 = GUICtrlCreateProgress(24, 40, 526, 49) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### GUISetOnEvent ($GUI_EVENT_CLOSE, "_exit",$Form1 ) GUICtrlSetOnEvent($Button2,"_Start") GUICtrlSetOnEvent($Button1,"_Stop") While 1 While $Stop = False $i += $X GUICtrlSetData($Progress1,$i) Sleep(80) if $i = 105 Then $X = -1 if $i = 0 Then $X = 1 WEnd Sleep(80) WEnd Func _Stop () $Stop = True EndFunc Func _exit () Exit EndFunc Func _Start () $Stop = False EndFunc1 point -
This changes a single digit "n", into a double digit "0n", when the single digit is in any date format. Local $aDate[] = ["2010/9/1", "2010/9/18", "10/9/2018", "1/9/2018", "1/09/2018", "1-9-2018", "01.9.2018", "01 9 2018"] For $i = 0 To UBound($aDate) - 1 ;$date = StringRegExpReplace($aDate[$i], "(?<=\b)(\d)(?=\b)", "0${1}") ; The RE pattern captures a single digit that is between "word" boundaries. ; See mikell's post: https://www.autoitscript.com/forum/topic/196083-date-day-displays-1-integer-instead-of-2/?do=findComment&comment=1406276 $date = StringRegExpReplace($aDate[$i], "\b(\d)\b", "0${1}") ; The RE pattern captures a single digit that is between "word" boundaries. ConsoleWrite($aDate[$i] & @TAB & " = " & $date & @CRLF) Next #cs ; Returns:- 2010/9/1 = 2010/09/01 2010/9/18 = 2010/09/18 10/9/2018 = 10/09/2018 1/9/2018 = 01/09/2018 1/09/2018 = 01/09/2018 1-9-2018 = 01-09-2018 01.9.2018 = 01.09.2018 01 9 2018 = 01 09 2018 #ce1 point
-
It is not particularly appreciated when you create a new account and ask the same question when you don't get the answers fast enough. Stick to the original thread and this member with be Banned. Next offense both will be banned. Threads merged. Jos1 point
-
yes but you can alter the function to add for example @CRLFs to it and you have an easy formatting solution for mass output of strings. i just wanted to demonstrate that you don't need to have to register a variable for every kind of stuff1 point