iamtheky Posted August 13, 2015 Share Posted August 13, 2015 I agree, this thread is a ridiculous katamari that encourages double posting and creates disjointed conversations about solutions. snippets are examples. ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
guinness Posted August 14, 2015 Share Posted August 14, 2015 i thnk that maybe this should have a section in the example scripts, under snippets, and each one have its own post, otherwise this post will be like the great software thread, cannot remeber name. - a lot of great stuff lost in a 100 pages. But I will give my 4 cents this time, as this is the exact definition of examples. Besides the other issue with search for it in our search engine, would be nearly impossible. Please excuse any spelling mistakes, I am on a cell. It's called Examples or wiki. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Chimaera Posted August 14, 2015 Author Share Posted August 14, 2015 (edited) Once everyone was given powers to post on the wiki, I stopped transferring them to the wiki, because you can all do it yourself now.It even gives you the template to do so in the first posthttps://www.autoitscript.com/wiki/AutoIt_SnippetsBy the look of the wiki snippets i think it has some formatting issues now prob due to the forum changes. Edited August 14, 2015 by Chimaera If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices() Link to comment Share on other sites More sharing options...
guestscripter Posted November 17, 2015 Share Posted November 17, 2015 Once everyone was given powers to post on the wiki, I stopped transferring them to the wiki, because you can all do it yourself now.It even gives you the template to do so in the first posthttps://www.autoitscript.com/wiki/AutoIt_SnippetsBy the look of the wiki snippets i think it has some formatting issues now prob due to the forum changes.I agree, this thread is a ridiculous katamari that encourages double posting and creates disjointed conversations about solutions. snippets are examples.Benefit of posting in the Forum vs in the Wiki: Feedback, Appreciation, Comments, Update Notifications per E-Mail...IMHO maybe there could be a "Snippets 2015", "Snippets 2015" Thread in the forum,or maybe even "Snippets November 2015" etc. then it never gets much too long...Personally I like checking out new posts in this thread. Just wanted to give some counter arguments to the above. ImageSearch15.au3 featuring _ImageSearchStartup() and _ImageSearchShutdown() Link to comment Share on other sites More sharing options...
JohnOne Posted November 17, 2015 Share Posted November 17, 2015 There is nothing stopping you to create new threads with timestamps.Sounds like a good idea to me. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
TheDcoder Posted November 17, 2015 Share Posted November 17, 2015 Maybe a Snippets Sub Forum for storing snippet threads? EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
guinness Posted November 17, 2015 Share Posted November 17, 2015 Maybe a Snippets Sub Forum for storing snippet threads? In hindsight it would have been better to have a submission sub forum and a discussion sub forum. Oh well, considering no one posts here that much, I don't see it being an issue of leaving it as it is. Ain't broke! UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
TheDcoder Posted December 10, 2015 Share Posted December 10, 2015 (edited) Finally another snippet! I use this little function to check if a number is present in a number (Magic numbers)... Magic numbers are powers of 2 (like 16, 32, 64 etc.) which can be added BitORed together to form a magic number... ; #FUNCTION# ==================================================================================================================== ; Name ..........: IsMgcNumPresent ; Description ...: Checks if a number is a present in a number (Magic numbers aka Powers of 2) ; Syntax ........: IsMgcNumPresent($iNumber, $iMagicNumber) ; Parameters ....: $iNumber - Number to check if it exists in $iMagicNumber. ; $iMagicNumber - The number which might contain $iNumber. ; Return values .: Success: True ; Failure: False ; Author ........: Damon Harris (TheDcoder) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: http://bit.ly/IsMgcNumPresentForAutoIt ; Example .......: Yes, see below. ; =============================================================================================================================== Func IsMgcNumPresent($iNumber, $iMagicNumber) Return BitAND($iMagicNumber, $iNumber) = $iNumber EndFunc ; Example Global Const $NUMBER = 32 Global Const $MAGIC_NUMBER = BitOR(32, 64) ConsoleWrite(@CRLF) ConsoleWrite('+> Is ' & $NUMBER & ' present in ' & $MAGIC_NUMBER & '?... Its ' & IsMgcNumPresent($NUMBER, $MAGIC_NUMBER) & @CRLF) ConsoleWrite(@CRLF) UPDATE: I have moved this snippet to Gist, I will no longer maintain this version! please check for updates in the Gist itself! Enjoy, TD Edited October 22, 2016 by TheDcoder UPDATE argumentum 1 EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
Trong Posted January 7, 2016 Share Posted January 7, 2016 (edited) ; EG---------------------------------------------- - Local $sString = StringBetween("<test>C</test><test>B</test><test>A</test>", "<test>", "</test>") MsgBox(0, "StringBetween", "Strings between <test> and </test>" & @CRLF & "Is: " & $sString & @CRLF & "In text: <test>C</test><test>B</test><test>A</test>") ; ------------------------------------------------ - ; #FUNCTION# ==================================================================================================================== ; Name ..........: StringBetween ; Description ...: Find strings between two string delimiters ; Syntax ........: StringBetween($sString, $sStart, $sEnd) ; Parameters ....: $sString - The string to search. ; Parameters ....: $sStart - The beginning of the string to find. ; $sEnd - The end of the string to find. ; Return values .: Success: a found string ; Failure: sets the @error flag to non-zero. ; @error: 1 - No strings found. ; Author ........: Trong ; Related .......: _StringBetween ; Example .......: Yes ; =============================================================================================================================== Func StringBetween($sString, $sStart, $sEnd) $sString = StringReverse(StringTrimLeft($sString, StringInStr($sString, $sStart) + StringLen($sStart) - 1)) $sString = StringReverse(StringTrimLeft($sString, StringInStr($sString, StringReverse($sEnd)) + StringLen($sEnd) - 1)) Return SetError(StringLen($sString) < 1, 0, $sString) EndFunc ;==>StringBetween Edited January 7, 2016 by Trong Regards, Link to comment Share on other sites More sharing options...
guinness Posted January 7, 2016 Share Posted January 7, 2016 StringLen($sString) = ""No, this is awful, as you are relying on type coercion. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Trong Posted January 7, 2016 Share Posted January 7, 2016 Sorry I forgot to fix it here, I thought I had to fix it Thanks for your reminder! Regards, Link to comment Share on other sites More sharing options...
JohnOne Posted February 9, 2016 Share Posted February 9, 2016 This might seem stupid to put here, but in the absence of a shortcut key for past and go in chrome, I always have this running of late. HotKeySet("^b", _Go) While 3 Sleep(333) WEnd Func _Go() Send("^v") Send("{Enter}") EndFunc AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
NotAviable Posted February 15, 2016 Share Posted February 15, 2016 (edited) Hello everyone! I want to add 2-3 simple functions, very very stupid, but because I'm very lazy I'd like them to be included in official AutoIt ;-) They are for writing messages in a simple & concise way, without bothering if you have to deal with strings or arrays. They are mostly for debug pourpose. expandcollapse popup#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7 #include <Array.au3> ; Functions for writing messages in the most concise way (be it strings or array) Local $simpleMsg="Hey you!" Local $aMsg[3]=["Hey you!", "Not you", "You!!"] _showAnyMsg($simpleMsg, "_showAnyMsg example", 0) _msg($simpleMsg, "_msg example") _msg("simplest way") _msg($aMsg, "_msg example with array") _bye("I'm gone!") _msg("I had something else to say...") ;==================================================================================================================== ;Function that displays a message to the user, : ; Parameters ; message_IN: (long) text of the message ; title_IN : (short) title of the message ; msgFlag_IN: tipe of message display (see MsgBox standard function) Func _showAnyMsg (ByRef $message_IN, $title_IN, $msgFlag_IN) If IsArray($message_IN) Then _ArrayDisplay($message_IN, $title_IN) Else MsgBox($msgFlag_IN, $title_IN, $message_IN) EndIf EndFunc ;==>_showAnyMsg ;==================================================================================================================== ;Function that displays a message to the user, using the simplest form: ; Parameters ; message_IN: (long) text of the message ; title_IN : (short) title of the message, default is "Message". ; msgFlag_IN: tipe of message display (see MsgBox standard function), default is 0. Func _msg (ByRef $message_IN, $title_IN = "Message", $msgFlag_IN = 0) _showAnyMsg($message_IN, $title_IN, $msgFlag_IN) EndFunc ;==>_msg ;==================================================================================================================== ;Function that displays a message to the user, using the simplest form: ; Parameters ; message_IN: (long) text of the message ; title_IN : (short) title of the message, default is "Message". ; msgFlag_IN: tipe of message display (see MsgBox standard function), default is 0. Func _bye (ByRef $message_IN, $title_IN = "Terminate", $msgFlag_IN = 0) _showAnyMsg($message_IN, $title_IN, $msgFlag_IN) Exit EndFunc ;==>_bye Edited February 15, 2016 by NotAviable Link to comment Share on other sites More sharing options...
Developers Jos Posted February 15, 2016 Developers Share Posted February 15, 2016 5 minutes ago, NotAviable said: I want to add 2-3 simple functions, very very stupid, but because I'm very lazy I'd like them to be included in official AutoIt ;-) Won't happen because we are lazy too! Just add them in your own include file. Jos NotAviable 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
water Posted February 15, 2016 Share Posted February 15, 2016 I'm even too lazy to post here ... My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Guest Posted February 15, 2016 Share Posted February 15, 2016 (edited) EDITED: REMOVED I prefer to keep it EDIT: Edited February 19, 2016 by Guest Link to comment Share on other sites More sharing options...
AZJIO Posted February 27, 2016 Share Posted February 27, 2016 If _ch1($ch) Then If _ch0($ch) Then Func _ch1($id) Return BitAND(GUICtrlRead($id), $GUI_CHECKED) EndFunc ;==>_ch1 Func _ch0($id) Return BitAND(GUICtrlRead($id), $GUI_UNCHECKED) EndFunc ;==>_ch0 if desired, can be replaced by "If _ch1($ch) Then" to "BitAND(GUICtrlRead($id), $GUI_CHECKED)" My other projects or all Link to comment Share on other sites More sharing options...
Gianni Posted February 28, 2016 Share Posted February 28, 2016 Here an alternative to the _StringRepeat() function: ; returns the passed char (or a whole string) replicated n times ; Example1: ConsoleWrite(_StringReplicate('*', 5) & @CRLF) ; Example2: ConsoleWrite(_StringReplicate('<->', 15) & @CRLF) ; Func _StringReplicate($sChars = "", $iRepeats = 0) $sChars = String($sChars) $iRepeats = Int(Abs(Number($iRepeats))) Return StringReplace(StringFormat('%' & $iRepeats & 's', ""), " ", $sChars) EndFunc ;==>_StringReplicate Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
Jefrey Posted March 16, 2016 Share Posted March 16, 2016 (edited) EnvParse - for passing strings (paths) with environment variables (e.g.: %TEMP%\test): Func EnvParse($str) $vars = StringRegExp($str, "%([^%]+)%", 3) For $var In $vars $get = EnvGet($var) If $get Then $str = StringReplace($str, "%" & $var & "%", $get) EndIf Next Return $str EndFunc Example: EnvParse("%TEMP%\test") will return something like C:\Windows\Temp\test. Edited March 16, 2016 by Jefrey My stuff Spoiler My UDFs _AuThread multithreading emulation for AutoIt · _ExtInputBox an inputbox with multiple inputs and more features · forceUTF8 fix strings encoding without knowing its original charset · JSONgen JSON generator · _TCPServer UDF multi-client and multi-task (run on background) event-based TCP server easy to do · _TCPClient_UDF multi-server and multi-task (runs on background) event-based TCP client easy to do · ParseURL and ParseStr functions ported from PHP · _CmdLine UDF easily parse command line parameters, keys or flags · AutoPHP Create documents (bills, incomes) from HTML by sending variables/arrays from AutoIt to PHP · (Un)Serialize Convert arrays and data into a storable string (PHP compatible) · RTTL Plays and exports to MP3 Nokia-format monophonic ringtones (for very old cellphones) · I18n library Simple and easy to use localization library · Scripting.Dictionary OOP and OOP-like approach · Buffer/stack limit arrays to N items by removing the last one once the limit is reached · NGBioAPI UDF to work with Nitgen fingerprint readers · Serial/Licensing system require license key based on unique machine ID from your users · HTTP a simple WinHTTP library that allows GET, POST and file uploads · Thread true AutoIt threads (under-dev) · RC4 RC4 encryption compatible with PHP and JS · storage.au3 localStorage and sessionStorage for AutoIt Classes _WKHtmlToX uses wkhtmlto* to convert HTML files and webpages into PDF or images (jpg, bmp, gif, png...) Snippets _Word_DocFindReplaceByLongText replace strings using Word UDF with strings longer than 255 characters (MSWord limit) rangeparser parser for printing-like pages interval (e.g.: "1,2,3-5") EnvParser parse strings/paths with environment variables and get full path GUICtrlStaticMarquee static text scrolling Random stuff Super Mario beep sound your ears will hurt Link to comment Share on other sites More sharing options...
iamtheky Posted March 16, 2016 Share Posted March 16, 2016 also: $sPath = "%TEMP%\test\subfolder1\subfolder2" msgbox(0, '' , EnvGet(stringtrimleft(stringtrimright(stringsplit($sPath, "\" , 2)[0] , 1) , 1)) & stringmid($sPath , stringinstr($sPath , "\" , 0 , 1))) ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now