Leaderboard
Popular Content
Showing content with the highest reputation on 12/06/2017 in all areas
-
This is a program that I made to help my self learn better regular expressions. There are a lot of other programs/website with the similar functions. The main advantage of this program is that you don't have to click a button after every changes. The program detected changes and react on it. Function: Match Match of arrays Match and replace Load source data from website Load source data from a website with GET/POST Load text data from file Clear fields Export and Import settings (you can finish the expression a other time, just export/import it) Cheat sheet DPI aware Generate AutoIt code example code The source code is not difficult and I think most user will understand it. In the zip file there is a export files (reg back example), you can drag and drop this files on the gui to import it. EDIT: Updated to version V1.2.0 Changes are: Expand and collapse of the cheat sheet (Thanks to Melba23 for the Guiextender UDF) Usefull regular expressions websites links included in the program Text data update time EDIT: Updated to version V1.3.0 Changes are: Automatic generate AutoIt code Icons on the tab Few minor bug fixes EDIT: Updated to version V1.4.0 Changes are: Link to AutoIt regex helpfile If the regular expression has a error than the text becomes red Option Offset with Match and array of Matches Option Count with Match and replace Some small minor bug fixed EDIT: Updated to version V1.4.1 Changes are: Small bug in "create AutoIt" code fixed EDIT: Updated to version V1.4.2 Changes are: Small bug in "create AutoIt" code fixed Bug with website data fixed EDIT: Updated to version V1.4.3 Changes are: DPI aware Click function on cheat sheet to insert function in the regex input field (Sourcode, example and compiled exe file) Regex toolkit.zip2 points
-
Password Generator
AlmarM and one other reacted to Page2PagePro for a topic
Thank you AlmarM for the inspiration. I added UUID, Dictionary and other customizations. Confirming and corrective feedback appreciated. #cs [FileVersion] #ce ;; ############################################################################ #NoTrayIcon #Region #AutoIt3Wrapper_UseX64=N #AutoIt3Wrapper_icon=PadLock.ico #AutoIt3Wrapper_res_fileversion=1.2.1.5 #AutoIt3Wrapper_Res_ProductVersion=1.2.1.5 #AutoIt3Wrapper_Res_Field=PrivateBuild|2017-12-05 #AutoIt3Wrapper_res_legalcopyright=Page2PagePro.com #AutoIt3Wrapper_res_language=1033 #AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker #AutoIt3Wrapper_Res_File_Add=WORDS_filtered.txt, rt_rcdata, TXT_WORDS #AutoIt3Wrapper_Res_File_Add=M0nac0.ttf, rt_rcdata, TTF_MONACO #EndRegion ;~ Revisions: #cs 1.0.0.0 2015-05-13 - AlmarM: https://www.autoitscript.com/forum/topic/120728-password-generator/ 1.1.0.0 2015-10-05 - Added UUID (GUID is M$ version of UUID) version 4 - https://en.wikipedia.org/wiki/Universally_unique_identifier - Changed _SETPOOL to Select - Added HasCharPool() - Added Arguments to ValidateMinimumLength() 1.2.0.0 2016-09-06 - Added Dictionary Search Tool and made default - https://svnweb.freebsd.org/csrg/share/dict/words?view=co 1.2.0.5 2016-12-06 - Added Unicode U+23B5 which *implies* using a space as separator 1.2.1.0 2016-12-08 - words.txt --> WORDS_filtered_1.txt - 25,487 words starting - 1) Remove words with "dots" - Notepad++: Regular express; Uncheck matches newline; Check wrap around; Check Match case - ^(.*)(\.)(.*)\n - 5 removed - e.g - i.e - Ph.D - U.S - U.S.A - 2) Remove words with apostrophes - Notepad++: Regular express; Uncheck matches newline; Check wrap around; Check Match case - ^(.*)(')(.*)\n - 104 removed - ain't - etc - 3) Remove proper nouns (1st letter capialized): - Notepad++: Regular express; Uncheck matches newline; Check wrap around; Check Match case - ^([A-Z])(.*)\n - 4987 (4968) removed - 4) Remove short words (length 1 - 4 characters): - ^[A-Za-z]{1,4}\n - 3108 (2466) removed - 5) Remove long words (length over 10 characters) = 2208 words: - ^[A-Za-z]{11,}\n - 2208 (2049) removed - 14895 words remain 1.2.1.5 2017-12-05 - Grouped dependencies for publishing #ce Opt("MustDeclareVars", 1) Opt("GUIOnEventMode", 1) #include <GUIConstants.au3> #include <FontConstants.au3> ;~ #include <Resources.au3> #include "Resources.au3" #include <Array.au3> #include <ScrollBarConstants.au3> #include <GUIEdit.au3> Const $RES_TTF_MONACO = "M0nac0.ttf" Global $sWordsFileName = "WORDS_filtered.txt" ;~ Create Dictionary Array Global $WordsPool If @Compiled Then _ResourceSaveToFile(@TempDir & "\" & $sWordsFileName, "TXT_WORDS", $RT_RCDATA, 0, 1) $WordsPool = @TempDir & "\" & $sWordsFileName Else $WordsPool = ".\" & $sWordsFileName EndIf Global Const $WORDS = FileReadToArray($WordsPool) If @error Then MsgBox($MB_SYSTEMMODAL, "", "There was an error reading the " & $sWordsFileName & " file. @error: " & @error) ; An error occurred reading the current script file. Exit EndIf FileDelete(@TempDir & "\" & $sWordsFileName) Global Const $CHR_AZ_LOW = StringLower("abcdefghijklmnopqrstuvwxyz") Global Const $CHR_AZ_UP = StringUpper("ABCDEFGHIJKLMNOPQRSTUVWXYZ") Global Const $CHR_AZ_LOW_HEX = StringLower("abcdef") Global Const $CHR_AZ_UP_HEX = StringUpper("ABCDEF") Global Const $CHR_NUMBERS = "0123456789" Global Const $CHR_SPECIAL = "`~!@#$%^&*()-_=+[]{};:'" & '"' & "<>,./?\|" Global Const $CHR_SPECIAL_DICT = "`~!@#$%^&()=[]{};:'" & '"' & "<>,/?\|" Global $sUseCharacters = "WORDS + " & $CHR_NUMBERS & $CHR_SPECIAL_DICT Global $hGUI, $hPasswordLength, $hPasswordLengthUpDown, $hCharacters, $hCurrentSequence Global $hPasswordLengthLbl Global $hWordQuantity, $hNumberQuantity, $hSymbolQuantity, $hCapitalizeFirst, $hWordSeparator Global $hWordQuantityLbl, $hNumberQuantityLbl, $hSymbolQuantityLbl, $hCapitalizeFirstLbl, $hWordSeparatorLbl Global $hGenerate, $hClearHistory, $hPassword, $hHistory Global $hPasswordClip, $hHistoryClip Global $hStatus, $hFont ;~ Status Bar Vars Global $sRead, $sPassword Global $iPasswordLength = 64 Global $sMinimumPattern ;~ http://stackoverflow.com/questions/19605150/regex-for-password-must-be-contain-at-least-8-characters-least-1-number-and-bot Global $iMinimumLength ;~ Establish if Compiled or ran from SciTE Global $ScriptName, $ScriptExt, $ScriptDir, $ScriptIniFull, $ScriptVersion, $ScriptRevised $ScriptDir = @ScriptDir & "\" $ScriptName = StringLeft(@ScriptName, StringLen(@ScriptName) - 4) $ScriptIniFull = $ScriptDir & $ScriptName & ".ini" If @Compiled = 1 Then $ScriptExt = ".exe" ;~ VERSION from Binary $ScriptVersion = FileGetVersion(@ScriptFullPath) $ScriptRevised = FileGetVersion(@ScriptFullPath, $FV_PRIVATEBUILD) ;~ When compiled extract Custom Font to Temp Folder _ResourceSaveToFile(@TempDir & "\" & $RES_TTF_MONACO, "TTF_MONACO", $RT_RCDATA, 0, 1) _WinAPI_AddFontResourceEx(@TempDir & "\" & $RES_TTF_MONACO, $FR_PRIVATE) Else $ScriptExt = ".au3" $ScriptVersion = IniRead(@ScriptFullPath, "FileVersion", "#AutoIt3Wrapper_res_fileversion", "0.0.0.0") ;~ REVISED from script region text $ScriptRevised = IniRead(@ScriptFullPath, "FileVersion", "#AutoIt3Wrapper_Res_Field", "PrivateBuild|YYYY-MM-DD@HHMM") Local $aToken = StringSplit($ScriptRevised, "|") $ScriptRevised = $aToken[2] ;~ When ran for debugging use TTF in CommonFiles\tonts _WinAPI_AddFontResourceEx(".\" & $RES_TTF_MONACO, $FR_PRIVATE) EndIf CreateGUI("Password Generator v(" & $ScriptVersion & ")") Loop() ;; ############################################################################ Func Loop() While 1 Sleep(309) WEnd EndFunc ;==>Loop ;~ ____________________________________________________________________________ Func CreateGUI($sTitle) ;~ GUI $hGUI = GUICreate($sTitle, 775, 225 + 20) ;~ 175 + 20 for StatusBar GUISetOnEvent($GUI_EVENT_CLOSE, "_exit") ;~ GROUP GUICtrlCreateGroup("Options", 5, 5, 280, 125) ;~ Password Length $hPasswordLengthLbl = GUICtrlCreateLabel("Password length:", 10, 30) GUICtrlSetState(-1, 32 + 128) $hPasswordLength = GUICtrlCreateInput($iPasswordLength, 100, 27, 40) GUICtrlSetState(-1, 32 + 128) $hPasswordLengthUpDown = GUICtrlCreateUpdown($hPasswordLength) GUICtrlSetLimit(-1, 64, 1) GUICtrlSetState(-1, 32 + 128) ;~ Password Characters GUICtrlCreateLabel("Characters:", 10, 53) $hCharacters = GUICtrlCreateCombo("", 80, 50, 200, 20, 0x0003) GUICtrlSetData(-1, "a-z|A-Z|0-9|a-zA-Z|a-z0-9|A-Z0-9|a-zA-Z0-9|a-z0-9(min 1,1)|A-Z0-9(min 1,1)|a-zA-Z0-9(min 1,1,1)|a-zA-Z0-9<SPECIAL>(min 1,1,1,1)|DICTIONARY(min 1,1,1,1)|<HEX A-F0-9>|<10-Key Numpad 0-9/*-+>|UUIDv4(upper)|UUIDv4(lower)|< User defined ... >", "DICTIONARY(min 1,1,1,1)") GUICtrlSetOnEvent(-1, "_SETPOOL") ;~ Dictionary Options $hWordQuantityLbl = GUICtrlCreateLabel("Words:", 10, 75) ;~ GUICtrlSetState(-1, 32 + 128) $hWordQuantity = GUICtrlCreateCombo("", 52, 73, 35, 20, 0x0003) ;~ GUICtrlSetState(-1, 32 + 128) GUICtrlSetData(-1, "0|1|2|3|4|5|6|7|8|9", "2") $hNumberQuantityLbl = GUICtrlCreateLabel("Numbers:", 100, 75) ;~ GUICtrlSetState(-1, 32 + 128) $hNumberQuantity = GUICtrlCreateCombo("", 153, 73, 35, 20, 0x0003) ;~ GUICtrlSetState(-1, 32 + 128) GUICtrlSetData(-1, "0|1|2|3|4|5|6|7|8|9", "1") $hSymbolQuantityLbl = GUICtrlCreateLabel("Symbols:", 197, 75) ;~ GUICtrlSetState(-1, 32 + 128) $hSymbolQuantity = GUICtrlCreateCombo("", 245, 73, 35, 20, 0x0003) ;~ GUICtrlSetState(-1, 32 + 128) GUICtrlSetData(-1, "0|1|2|3|4|5|6|7|8|9", "1") $hCapitalizeFirstLbl = GUICtrlCreateLabel("Cap 1st?", 10, 99) ;~ GUICtrlSetState(-1, 32 + 128) $hCapitalizeFirst = GUICtrlCreateCheckbox("", 60, 96, 35, 20, 0x0003) ;~ GUICtrlSetState(-1, 32 + 128) GUICtrlSetState(-1, 1) $hWordSeparatorLbl = GUICtrlCreateLabel("Separator:", 100, 99) ;~ GUICtrlSetState(-1, 32 + 128) $hWordSeparator = GUICtrlCreateCombo("", 153, 96, 35, 20, 0x0003) ;~ GUICtrlSetState(-1, 32 + 128) ;~ http://www.fileformat.info/info/unicode/char/23b5/index.htm ;~ Unicode Character 'BOTTOM SQUARE BRACKET' (U+23B5) GUICtrlSetData(-1, " |-|.|*|_|+|" & ChrW(9141), " ") ;~ GENERATE $hGenerate = GUICtrlCreateButton("Generate", 5, 160, 135, 25) GUICtrlSetOnEvent(-1, "_GENERATE") ;~ CLEAR $hClearHistory = GUICtrlCreateButton("Clear history", 155, 160, 135, 25) GUICtrlSetOnEvent(-1, "_CLEAR") ;~ OUTPUT $hPassword = GUICtrlCreateInput("", 155, 197, 465, 22, $ES_CENTER) GUICtrlSetFont($hPassword, 9, 400, 0, "Monaco") ;~ HISTORY $hHistory = GUICtrlCreateEdit("", 295, 10, 475, 125, BitOR(0x0800, 0x0040, 0x00200000)) ; Use monospaced Monaco font, size 9 GUICtrlSetFont($hHistory, 9, 400, 0, "Monaco") ;~ CLIPBOARD $hPasswordClip = GUICtrlCreateButton("Copy ONE Clipboard", 5, 195, 135, 25) GUICtrlSetOnEvent(-1, "_CLIPBOARD_ONE") $hHistoryClip = GUICtrlCreateButton("Copy ALL Clipboard", 635, 195, 135, 25) GUICtrlSetOnEvent(-1, "_CLIPBOARD_ALL") ;~ TOOL TIP $hCurrentSequence = GUICtrlCreateLabel("Hover me to see your current sequence.", 10, 140, 280, 15, 0x01) GUICtrlSetColor(-1, 0x000000) GUICtrlSetBkColor(-1, 0xC0DCC0) GUICtrlSetTip($hCurrentSequence, $sUseCharacters) ;~ STATUS BAR $hStatus = GUICtrlCreateLabel("Page2PagePro.com", 0, 225, 775, 20, $SS_SUNKEN + $SS_CENTER) GUICtrlSetFont(-1, 9, 400, "", "Monaco") ;~ SHOW GUI GUISetState(@SW_SHOW) EndFunc ;==>CreateGUI ;~ ____________________________________________________________________________ Func _exit() _WinAPI_DeleteObject($hFont) GUIDelete() ConsoleWrite("Exit" & @CRLF) Exit EndFunc ;==>_exit ;~ ____________________________________________________________________________ Func _IsChecked($idControlID) Return BitAND(GUICtrlRead($idControlID), 1) = 1 EndFunc ;==>_IsChecked ;~ ____________________________________________________________________________ Func CapitalizeFirst($s) Return StringUpper(StringLeft($s, 1)) & StringMid($s, 2) EndFunc ;==>CapitalizeFirst ;~ ____________________________________________________________________________ Func StringJoin(Const ByRef $avArray, $sDelim_Item = "|", $iStart_Row = -1, $iEnd_Row = -1, $sDelim_Row = @CRLF, $iStart_Col = -1, $iEnd_Col = -1) Return _ArrayToString($avArray, $sDelim_Item, $iStart_Row, $iEnd_Row, $sDelim_Row, $iStart_Col, $iEnd_Col) EndFunc ;==>StringJoin ;~ ____________________________________________________________________________ Func GenerateDictionaryPassword() Local $iWordsToUse = GUICtrlRead($hWordQuantity) Local $bAlwaysCapitalizeFirstLetter = _IsChecked($hCapitalizeFirst) Local $iNumbersToUse = GUICtrlRead($hNumberQuantity) Local $iSymbolsToUse = GUICtrlRead($hSymbolQuantity) Local $aPassword[0] Local $sTemp, $iLocation ;~ Select Two Random Words and add to Empty Array For $j = 1 To $iWordsToUse $sTemp = $WORDS[Random(0, UBound($WORDS) - 1, 1)] If $bAlwaysCapitalizeFirstLetter Then $sTemp = CapitalizeFirst($sTemp) _ArrayAdd($aPassword, $sTemp) Next ;~ If Numbers are to be used, add them between the two words (for now) For $j = 1 To $iNumbersToUse ;~ $iLocation = 2 $iLocation = Random(0, UBound($aPassword), 1) ConsoleWrite($iLocation & " " & UBound($aPassword) & @CR) $sTemp = Random(0, 9, 1) If $iLocation = UBound($aPassword) Then _ArrayAdd($aPassword, $sTemp) Else _ArrayInsert($aPassword, $iLocation, $sTemp) EndIf Next ;~ If Symbols are to be used, Randomlly insert into array Local $aSpecial = StringSplit($CHR_SPECIAL_DICT, "", 2) For $j = 1 To $iSymbolsToUse $iLocation = Random(0, UBound($aPassword), 1) $sTemp = $aSpecial[Random(0, UBound($aSpecial) - 1, 1)] If $iLocation = UBound($aPassword) Then _ArrayAdd($aPassword, $sTemp) Else _ArrayInsert($aPassword, $iLocation, $sTemp) EndIf Next ;~ Add Separator if combo isn't "null" (It's actually a SPACE) If StringCompare(GUICtrlRead($hWordSeparator), " ") = 0 Then ;~ Do Nothing Else If StringCompare(GUICtrlRead($hWordSeparator), ChrW(9141)) = 0 Then ;~ MsgBox("","",GUICtrlRead($hWordSeparator)) $sTemp = StringJoin($aPassword, " _") $aPassword = StringSplit($sTemp, "_", 2) Else $sTemp = StringJoin($aPassword, GUICtrlRead($hWordSeparator) & " ") $aPassword = StringSplit($sTemp, " ", 2) EndIf EndIf Return $aPassword EndFunc ;==>GenerateDictionaryPassword ;~ ____________________________________________________________________________ Func _GENERATE() ;~ Deselect History and scroll to end to leiminate overwiting highlighed/selected Local $iEnd = StringLen(GUICtrlRead($hHistory)) _GUICtrlEdit_SetSel($hHistory, $iEnd, $iEnd) _GUICtrlEdit_Scroll($hHistory, $SB_SCROLLCARET) If StringCompare(GUICtrlRead($hCharacters), "DICTIONARY(min 1,1,1,1)") = 0 Then Local $aPassword = GenerateDictionaryPassword() ;~ _ArrayDisplay($aPassword) $sPassword = StringJoin($aPassword, "") Else If ValidateMinimumLength($iMinimumLength, GUICtrlRead($hPasswordLength)) And HasCharPool($sUseCharacters) Then $iPasswordLength = GUICtrlRead($hPasswordLength) $sPassword = _GeneratePassword($iPasswordLength, $sUseCharacters) EndIf EndIf GUICtrlSetData($hPassword, $sPassword) GUICtrlSetData($hHistory, $sPassword & @CRLF, "|") EndFunc ;==>_GENERATE ;~ ____________________________________________________________________________ Func _CLEAR() GUICtrlSetData($hHistory, "") EndFunc ;==>_CLEAR ;~ ____________________________________________________________________________ Func _SETPOOL() $sMinimumPattern = "" $iMinimumLength = 0 $sRead = GUICtrlRead($hCharacters) ConsoleWrite($sRead & @CR) ;~ WARNING: Switch statements are case-insensitive. ;~ Select statements are care-sensitive GUICtrlSetState($hPasswordLengthLbl, 16 + 64) GUICtrlSetState($hPasswordLength, 16 + 64) GUICtrlSetState($hPasswordLengthUpDown, 16 + 64) GUICtrlSetState($hWordQuantity, 32 + 128) GUICtrlSetState($hNumberQuantity, 32 + 128) GUICtrlSetState($hSymbolQuantity, 32 + 128) GUICtrlSetState($hCapitalizeFirst, 32 + 128) GUICtrlSetState($hWordQuantityLbl, 32 + 128) GUICtrlSetState($hNumberQuantityLbl, 32 + 128) GUICtrlSetState($hSymbolQuantityLbl, 32 + 128) GUICtrlSetState($hCapitalizeFirstLbl, 32 + 128) Select Case $sRead == "a-z" $sUseCharacters = $CHR_AZ_LOW Case $sRead == "A-Z" $sUseCharacters = $CHR_AZ_UP Case $sRead == "0-9" $sUseCharacters = $CHR_NUMBERS Case $sRead == "a-zA-Z" $sUseCharacters = $CHR_AZ_LOW & $CHR_AZ_UP Case $sRead == "a-z0-9" $sUseCharacters = $CHR_AZ_LOW & $CHR_NUMBERS Case $sRead == "A-Z0-9" $sUseCharacters = $CHR_AZ_UP & $CHR_NUMBERS Case $sRead == "a-zA-Z0-9" $sUseCharacters = $CHR_AZ_LOW & $CHR_AZ_UP & $CHR_NUMBERS Case $sRead == "a-z0-9(min 1,1)" $sUseCharacters = $CHR_AZ_LOW & $CHR_NUMBERS $sMinimumPattern = "(?=.*[a-z])(?=.*[0-9])" $iMinimumLength = 2 Case $sRead == "A-Z0-9(min 1,1)" $sUseCharacters = $CHR_AZ_UP & $CHR_NUMBERS $sMinimumPattern = "(?=.*[A-Z])(?=.*[0-9])" $iMinimumLength = 2 Case $sRead == "a-zA-Z0-9(min 1,1,1)" $sUseCharacters = $CHR_AZ_LOW & $CHR_AZ_UP & $CHR_NUMBERS $sMinimumPattern = "(?=.*[a-z])(?=.*[A-Z])(?=.*\d)" $iMinimumLength = 3 Case $sRead == "a-zA-Z0-9<SPECIAL>(min 1,1,1,1)" $sUseCharacters = $CHR_AZ_LOW & $CHR_AZ_UP & $CHR_NUMBERS & $CHR_SPECIAL $sMinimumPattern = "(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[\W])" $iMinimumLength = 4 Case $sRead == "DICTIONARY(min 1,1,1,1)" $sUseCharacters = "WORDS + " & $CHR_NUMBERS & $CHR_SPECIAL_DICT GUICtrlSetState($hPasswordLengthLbl, 32 + 128) GUICtrlSetState($hPasswordLength, 32 + 128) GUICtrlSetState($hPasswordLengthUpDown, 32 + 128) GUICtrlSetState($hWordQuantity, 16 + 64) GUICtrlSetState($hNumberQuantity, 16 + 64) GUICtrlSetState($hSymbolQuantity, 16 + 64) GUICtrlSetState($hCapitalizeFirst, 16 + 64) GUICtrlSetState($hWordQuantityLbl, 16 + 64) GUICtrlSetState($hNumberQuantityLbl, 16 + 64) GUICtrlSetState($hSymbolQuantityLbl, 16 + 64) GUICtrlSetState($hCapitalizeFirstLbl, 16 + 64) Case $sRead == "<HEX A-F0-9>" $sUseCharacters = $CHR_AZ_UP_HEX & $CHR_NUMBERS Case $sRead == "<10-Key Numpad 0-9/*-+>" $sUseCharacters = $CHR_NUMBERS & "/*-+" Case $sRead == "UUIDv4(upper)" ;~ $sUseCharacters = $CHR_AZ_UP_HEX & $CHR_NUMBERS ;~ http://stackoverflow.com/questions/6223185/php-preg-match-uuid-v4 ;~ $sMinimumPattern = "[A-F0-9]{8}-[A-F0-9]{4}-4[A-F0-9]{3}-(8|9|A|B)[A-F0-9]{3}-[A-F0-9]{12}" ;~ $iMinimumLength = 32 $sUseCharacters = $CHR_AZ_UP_HEX & $CHR_NUMBERS GUICtrlSetState($hPasswordLengthLbl, 32 + 128) GUICtrlSetState($hPasswordLength, 32 + 128) GUICtrlSetState($hPasswordLengthUpDown, 32 + 128) Case $sRead == "UUIDv4(lower)" $sUseCharacters = $CHR_AZ_LOW_HEX & $CHR_NUMBERS GUICtrlSetState($hPasswordLengthLbl, 32 + 128) GUICtrlSetState($hPasswordLength, 32 + 128) GUICtrlSetState($hPasswordLengthUpDown, 32 + 128) Case $sRead == "< User defined ... >" $sUseCharacters = InputBox("Password Generator", "Enter a character sequence.", $CHR_SPECIAL, "", 200, 130) Case Else MsgBox(16, "ERROR", "Selected POOL not understood.") $sUseCharacters = "" EndSelect GUICtrlSetTip($hCurrentSequence, $sUseCharacters) ValidateMinimumLength($iMinimumLength, GUICtrlRead($hPasswordLength)) EndFunc ;==>_SETPOOL ;~ ____________________________________________________________________________ Func ValidateMinimumLength($iMinimumLength, $iTest) If $iTest < $iMinimumLength Then MsgBox(64, "WARNING!", "The Pool selected requires " & ($iMinimumLength - $iTest) _ & " more characters to your length. Please change.") Return False EndIf Return True EndFunc ;==>ValidateMinimumLength ;~ ____________________________________________________________________________ Func HasCharPool($sUseCharacters) If $sUseCharacters = "" Then MsgBox(16, "ERROR", "Character POOL is empty") Return False EndIf Return True EndFunc ;==>HasCharPool ;~ ____________________________________________________________________________ ;Version 4 UUID generator ; credits goes to mimec (http://php.net/uniqid#69164) ;~ https://www.autoitscript.com/forum/topic/134387-version-4-uuid-generator/ Func uuid($strCase = "lower") Local $strUUID = StringFormat('%04x%04x-%04x-%04x-%04x-%04x%04x%04x', _ Random(0, 0xffff), Random(0, 0xffff), _ Random(0, 0xffff), _ BitOR(Random(0, 0x0fff), 0x4000), _ BitOR(Random(0, 0x3fff), 0x8000), _ Random(0, 0xffff), Random(0, 0xffff), Random(0, 0xffff) _ ) Return (StringUpper($strCase) = "UPPER" ? StringUpper($strUUID) : $strUUID) EndFunc ;==>uuid ;~ ____________________________________________________________________________ Func _GeneratePassword($iLength, $sSequence) Local $sResult, $bPass Local $aSplit = StringSplit($sSequence, "", 2) If StringLeft($sRead, 6) = "UUIDv4" Then $sResult = uuid(StringMid($sRead, 8, 5)) Else Do $sResult = "" $bPass = False For $i = 1 To $iLength $sResult &= $aSplit[Random(0, UBound($aSplit) - 1, 1)] Next If StringRegExp($sResult, $sMinimumPattern) Then $bPass = True ConsoleWrite("+ " & $bPass & " ... " & $sResult & @CR) Until $bPass EndIf Return $sResult EndFunc ;==>_GeneratePassword ;~ ____________________________________________________________________________ Func _GUICtrlStatusBar_SetFont($hWnd, $iHeight = 15, $iWeight = 400, $iFontAtrributes = 0, $sFontName = "Arial") $hFont = _WinAPI_CreateFont($iHeight, 0, 0, 0, $iWeight, BitAND($iFontAtrributes, 2), BitAND($iFontAtrributes, 4), _ BitAND($iFontAtrributes, 8), $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, _ $DEFAULT_QUALITY, 0, $sFontName) _SendMessage($hWnd, $WM_SETFONT, $hFont, 1) EndFunc ;==>_GUICtrlStatusBar_SetFont ;~ ____________________________________________________________________________ Func _CLIPBOARD_ONE() ClipPut(GUICtrlRead($hPassword)) EndFunc ;==>_CLIPBOARD_ONE ;~ ____________________________________________________________________________ Func _CLIPBOARD_ALL() ClipPut(GUICtrlRead($hHistory)) EndFunc ;==>_CLIPBOARD_ALL ;~ ____________________________________________________________________________ passwordGenerator_v1.2.1.5.zip2 points -
Idle Timer from Local System Account?
Skysnake reacted to chaoticyeshua for a topic
I ended up resolving this by applying the following registry keys in Group Policy: HKEY_CURRENT_USER\Control Panel\Desktop Value Type: REG_SZ Value Name: AutoEndTasks Value Data: 1 Value Type: REG_SZ Value Name: HungAppTimeout Value Data: (time in ms to wait before killing tasks)1 point -
This functions lets you check if a window is responding or not. Equal to checking if a Window goes white after a while using your eye #include <WinAPISys.au3> ; #FUNCTION# ==================================================================================================================== ; Name ..........: IsWindowNotResponding ; Description ...: Checks if a Window is not responding ; Syntax ........: IsWindowNotResponding($hWindow[, $iTimeout = 5000]) ; Parameters ....: $hWindow - A window handle. ; $iTimeout - [optional] Shouldn't matter, Timeout in milliseconds. Default is 5000. ; Return values .: @error set by _WinAPI_SendMessageTimeout ; Author ........: Damon Harris (TheDcoder) ; Remarks .......: The way it works is that it exploits SendMessageTimeout's SMTO_ABORTIFHUNG option. ; Do more research on Process.Responding and how it works (C# function for checking if a window is responding) ; Link ..........: https://git.io/vbcvJ ; Example .......: If IsWindowNotResponding($hWindow) Then DoSomething() ; =============================================================================================================================== Func IsWindowNotResponding($hWindow, $iTimeout = 5000) _WinAPI_SendMessageTimeout($hWindow, 0, 0, 0, $iTimeout, $SMTO_ABORTIFHUNG) Return @error EndFunc1 point
-
It's up to you. If you want to use the Ini* functions then you have to create somewhere a temp ini file (and delete it later) because these funcs need an existing file to be read If you want no file, then as _INetGetSource returns the whole source code of the page as a string, you must use String* functions. In this case you might have the uploaded text as simple as possible, to make the script easier Just an example below #include <Array.au3> ; uploaded text as it could be returned by Inet + the 1st StringRegExpReplace from the previous script $string = "Servername=mywebsite.com" & @crlf & "Username=sandanet" & @crlf & "Pass=123" Msgbox(0,"", $string) Msgbox(0,"Servername", StringRegExpReplace($string, '(?s).*Servername=(\S*).*', "$1") ) Msgbox(0,"Username", StringRegExpReplace($string, '(?s).*Username=(\S*).*', "$1") ) Msgbox(0,"Pass", StringRegExpReplace($string, '(?s).*Pass=(\S*).*', "$1") ) $res = StringRegExp($string, '=(\S*)', 3) _ArrayDisplay($res)1 point
-
Read and Delete Excel Connections
Earthshine reacted to water for a topic
Glad you like the UDF If there are any questions, just post and I will do my very best to assist.1 point -
1 point
-
Read and Delete Excel Connections
Earthshine reacted to water for a topic
You have to do it in a loop as the VBA example does: #include <Excel.au3> Global $sFilePath = "..." Global $oExcel = _Excel_Open(False) If @error Then Exit MsgBox(0, "Error", "Error returned by _Excel_Open. @error = " & @error & ", @extended = " & @extended) Global $oWorkbook = _Excel_BookOpen($oExcel, $sFilePath & "\TestBook.xls") If @error Then Exit MsgBox(0, "Error", "Error returned by _Excel_BookOpen. @error = " & @error & ", @extended = " & @extended) For $oConnection In $oWorkbook.Connections If $oConnection.Name = "ConnectionName" Then MsgBox(0, "Info", "Connection Name: " & $oConnection.Name) ; Display the Data Connection name for testing purpose $oConnection.Delete If @error Then Exit MsgBox(0, "Error", "Error returned when deleting connection " & $oConnection.Name & ". @error = " & @error & ", @extended = " & @extended) Else MsgBox(0, "Info", "Connection " & $oConnection.Name & " successfully deleted.") EndIf EndIf Next _Excel_Close($oExcel)1 point -
HotKeySet("{F10}", "SendKeys") While 1 Sleep(100) WEnd Func SendKeys() Send("999") EndFunc1 point
-
Download and run piece of code from FTP
Miliardsto reacted to careca for a topic
Could this work? #include <File.au3> $file_url = "http://nirsoft.net/utils/regfromapp-x64.zip" $download_result = InetGet($file_url, @scriptdir & "\regfromapp-x64.zip", 3) if $download_result <> 0 Then MsgBox(64, 'Result', 'No Errors') Else MsgBox(64, 'Result', 'Error') endif InetClose() I mean if it's a not pw protected ftp.1 point -
Download and run piece of code from FTP
Miliardsto reacted to jdelaney for a topic
You can download the script as a compiled exe or script via some ftp function. There are also ways to execute au3 files via the command line...search command line in the helpfile. _FTP* functions.1 point