Developers Jos Posted January 12, 2005 Author Developers Share Posted January 12, 2005 While I was working on it I think I found an error in the code in ArraySort()If UBound($aArray) < $iUbound Or Not IsNumber($iUbound) ThenI believe this should be If UBound($aArray) <= $iUbound Or Not IsNumber($iUbound) Then<{POST_SNAPBACK}>Red, you are correct .. i have updated the include file. tnxWill also implement the last version of _ArrayTrim you PMed... 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...
Blue_Drache Posted January 14, 2005 Share Posted January 14, 2005 I'd like to nominate "ControlSendPlus" for the generalized release. But it's not mine, so I don't know if that counts. Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache Link to comment Share on other sites More sharing options...
CyberSlug Posted January 15, 2005 Share Posted January 15, 2005 BEFORE I FORGET:http://userfs.cec.wustl.edu/~plg1/AutoItHelp/MiscUDFs.au3They might need updated..... Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
Developers Jos Posted January 15, 2005 Author Developers Share Posted January 15, 2005 BEFORE I FORGET:http://userfs.cec.wustl.edu/~plg1/AutoItHelp/MiscUDFs.au3They might need updated.....<{POST_SNAPBACK}>You have a some useful UDF's there...Would be happy to include them when they are submitted in this form:==> Page containing all info needed to qualify for inclusion of a UDF. 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...
Chris_1013 Posted January 15, 2005 Share Posted January 15, 2005 (edited) I vote for ShellExecute to be added. It's on the forum somewhere, can remember who wrote it, but I'm happy to find it and edit it to desired format if it'll be useful.Edit: Here it is http://www.autoitscript.com/forum/index.ph...hl=ShellExecute Edited January 15, 2005 by Chris_1013 Link to comment Share on other sites More sharing options...
this-is-me Posted January 15, 2005 Share Posted January 15, 2005 (edited) I made the original: expandcollapse popup#include-once func shellexecute($file, $verb, $wait) local $oldopt = opt("expandenvstrings", 0) $ext = StringTrimLeft($file, StringInStr($file, ".", 0, -1)) $fltp = RegRead("HKEY_CLASSES_ROOT\." & $ext, "") if @error Then $fltp = $ext & "file" $defverb = RegRead("HKEY_CLASSES_ROOT\" & $fltp & "\shell", "") if $defverb = "" Then $defverb = "Open" if $verb = "" Then $cmd = RegRead("HKEY_CLASSES_ROOT\" & $fltp & "\shell\" & $defverb & "\command", "") Else $cmd = RegRead("HKEY_CLASSES_ROOT\" & $fltp & "\shell\" & $verb & "\command", "") EndIf if @error Then $cmd = RegEnumKey("HKEY_CLASSES_ROOT\" & $fltp & "\shell", 1) if @error Then Return 2 EndIf $cmd = StringReplace($cmd, "%l", FileGetLongName($file)) $cmd = StringReplace($cmd, "%1", $file) $cmd = StringReplace($cmd, "%*", "") for $i = 2 to 9 $cmd = StringReplace($cmd, "%" & $i, "") Next ;Why do I have to do this instead of expandenvstrings? $env = StringInStr($cmd, "%", 0, 1) if not @error Then for $i = 1 to 5 Step 2 if not StringInStr($cmd, "%", 0, $i) Then ExitLoop $envx = StringMid($cmd, StringInStr($cmd, "%", 0, $i) + 1, StringInStr($cmd, "%", 0, $i + 1) - 2) $cmd = StringReplace($cmd, "%" & $envx & "%", EnvGet($envx)) Next EndIf if $wait Then RunWait($cmd) Else Run($cmd) EndIf opt("expandenvstrings", $oldopt) endfunc There is also another one made by ezzetabi that is an expansion of mine. Edited January 15, 2005 by this-is-me Who else would I be? Link to comment Share on other sites More sharing options...
steve8tch Posted January 18, 2005 Share Posted January 18, 2005 I have put my head above the parapet and offered up _menu UDF This enables you to create a simple list of items/options for a user to choose from. A couple of examples are shown below of how you would use it. The idea is that if you are scripting something and you need to put some options to the user - this allows you to do that without using multiple MsgBox's or having to spend time creating a GUI for your questions. #Include <menu.au3> ;example 1 $x = _menu(1,"Choose a colour","red","blue","green","yellow") MsgBox(0, "", $x[1]) ;example 2 $x = _menu(5,"Choose up to five colours","red","blue","green","yellow","brown","black","pink","white","purple") $msg = "" For $y = 1 to $x[0] $msg = $msg & @CRLF & $x[$y] Next MsgBox(0, "","You chose " & $x[0] & " colours" & @CRLF & $msg) ;example 3 $x = _menu(1,"This computer cannot be migrated to the domain" & @CRLF & "This could be due to" & @CRLF& @CRLF & _ "1 - you are not logged on with an account with appropriate permissions" & @CRLF & _ "2 - the computer account has been disabled" & @CRLF & _ "3 - the computer account has not been created" & @CRLF & @CRLF &_ "Please choose form the following options","Pause script and add create conputer account in domain",_ "Log on with different account and continue script","Rename computer then continue script",_ "Exit script and remove all script files","Try migrating again") MsgBox(0, "", $x[1]) Menu.au3 Please try it out - I am open to any suggestion for improvements Link to comment Share on other sites More sharing options...
layer Posted February 8, 2005 Share Posted February 8, 2005 Func SetPixel ($handle, $x, $y, $color) $dc= DllCall ("user32.dll", "int", "GetDC", "hwnd", $handle) DllCall ("gdi32.dll", "long", "SetPixel", "long", $dc[0], "long", $x, "long", $y, "long", $color) DllCall ("user32.dll", "int", "ReleaseDC", "hwnd", 0, "int", $dc[0]) EndFunc FootbaG Link to comment Share on other sites More sharing options...
steveR Posted March 16, 2005 Share Posted March 16, 2005 Awesome work! Thanks AutoIt3 online docs Use it... Know it... Live it...MSDN libraryglobal Help and SupportWindows: Just another pane in the glass. Link to comment Share on other sites More sharing options...
Valik Posted March 16, 2005 Share Posted March 16, 2005 Here's mine....It allows controls and/or Child windows to be added to virtually ANY Gui window(or some controls) whether AutoIt created them or not... Massive Kudo's and Credit to Valik and Larry, who showed me how this works!!!<snip>There are several design issues with that that make it not very conducive to a library. First of all, global variables. Global variables are bad. Especially when you give them common names as you have. I'm almost positive this will clash. Second, the code looks flawed. I see "If Not <lvalue> = <rvalue>" which probably doesn't work the way you think it should. It should be "If <lvalue> <> <rvalue>" or "If Not (<lvalue> = <rvalue>)"Back to the globals, I see no reason for them. In fact, I see no reason for their to be anything more than a single "private" GUI child creation function and a bunch of wrapper function which use it and create the actual control. This would then return an array containing at the least, the parent HWND, child HWND and control ID. The only thing that should be exposed are the functions which create the control on the child window.There are a lot of issues that don't make this very user-friendly as a library. Link to comment Share on other sites More sharing options...
Valik Posted March 17, 2005 Share Posted March 17, 2005 Thats a little better. However, you do realize GUICreate() returns a HWND right, so you've got all kinds of extraneous code getting the HWND at least two more times in all the function calls? Don't you think you should also return the ControlID as returned from GUICtrlCreate*? Isn't that more useful than the HWND of the control (Although the HWND should also be returned). And lastly, declare your variable scope. That script is completly useless to me because I can't run it without fixing 0382593289582 variable declaration errors (See Opt("MustDeclareVars", 1) in the helpfile). Link to comment Share on other sites More sharing options...
Valik Posted March 17, 2005 Share Posted March 17, 2005 This isn't rocket science; just use common sense. What makes the most sense to go where? What's the most likely to be used compared to the least likely to be used? As for variable scope, I suggest you read the helpfile for that. Link to comment Share on other sites More sharing options...
layer Posted April 6, 2005 Share Posted April 6, 2005 (edited) Hmm... This is more of a "Users defined function" because JdeB and Larry helped me out a bit... And I had my number one critic, Valik This code just flashes a window handle, not title specified... You can specify a number of times the window should flash and/or the delay in between each flash. But those paremeters are optional...Func _WinFlash($hWnd, $OptDelay = 500, $OptFlashes = 2);Thanks to Larry and JdeB If NOT WinExists(WinGetTitle($hWnd)) then MsgBox(16, "_WinFlash Error", "Error! The window handle supplied doesn't exist!") Exit EndIf $Dll = DllOpen("user32.dll") For $x = 1 To $OptFlashes DllCall($Dll, "int", "FlashWindow", "hWnd", $hWnd, "int", 1) Sleep($OptDelay) Next DllClose($Dll) EndFunc ;==>_WinFlash ;Test _WinFlash(WinGetHandle("Windows Media Player"))Although the error check I made doesn't work... I couldn't figure out why, so I'll just post it anyways...EDIT: Spelling... EDIT2: Working on this: http://www.autoitscript.com/autoit3/scite/...F_Standards.htm and fixing the error checking... Edited April 6, 2005 by layer FootbaG Link to comment Share on other sites More sharing options...
GaryFrost Posted April 12, 2005 Share Posted April 12, 2005 Puts a border around controls using the GUICtrlCreateGraphicEdge UDFs SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
quick_sliver007 Posted April 12, 2005 Share Posted April 12, 2005 Func _MoveItemBetweenLVs($Source_List_View,$Destination_List_view) GUICtrlCreateListViewItem(GUICtrlRead(GUICtrlRead($Source_List_View)), $Destination_List_view) Dim $LVM_DELETEITEM, $a, $ItemCount, $Source_Title $LVM_DELETEITEM = 0x1008 $ItemCount = ControlListView("", "", $Source_List_View, "GetItemCount") For $a = 0 To $ItemCount - 1 If ControlListView("", "", $Source_List_View, "IsSelected", $a) Then GUICtrlSendMsg($Source_List_View, $LVM_DELETEITEM, $a, 0) EndIf Next EndFunc This function moves the selected item between list view. I believe this function is very useful for GUIs with more then one list view. Like a list view to list all items and a 2nd list view to move items to; with the 2nd list view being used in the program to gather info to do stuff. . Link to comment Share on other sites More sharing options...
kjactive Posted May 17, 2005 Share Posted May 17, 2005 (edited) I just done a new UDF function library that some 'autoitters' might find usefull - Word.au3 contains some word related function that I needed as AutoIt StringSplit / StringInStr functions can't handle both 0x09 and 0x20 characters in the same string without some hasle - this is words in string handle no matter...This UDF library contains word related function to be included into autoit3 include directory and return @error = 1 as failure:Name: Word.au3AutoIt Version: 3.1.1Language: EnglishDescription: Functions to assist working with string data.Requirement(s): NoneAuthor: Kåre Johansson ( kjactive )Functions:_Word( $sString, $iInt )_Words( $sString )_Strip( $sString, $sKey )_Copies( $sString, $iInt )_SubWord( $sString, $iInt ,$iInt )_DelWord( $sString, $iInt )_WordIndex( $sString, $iInt )_DelString( $sString, $iInt, $iInt )_Insert( $sString, $sString, $iInt )_Say( $sString ) // just a fast consolewrite debug function.Free to download or include into AutoIt system:http://www.sitecenter.dk/latenight/nss-fol...pports/Word.zipI could provide documentation in Html form if needed...Kjactive Edited May 17, 2005 by kjactive Au3PP 4.1 - Autoit3 preprocessor, optimize speed, performance to scripts and do executes....[/url]Au3Calibur - Create libraries of commonly used code excerptsWords manipulate UDF, functions that is lent from the rexx language, topics and index file includedCustomDialog UDF to include custom made dialogs like a extended colorpick requester to scripts...[url="ftp://fritidshjemmet.com/Autoit3/SysColor.zip"]SysColor UDF a low level color library to manipulate RGB and Hex values...Shell32 UDF to Automate Windows® operating tasks from native dialog and Wizards browsers... Optimized the CodeWicard with options to generate browser code etc... Link to comment Share on other sites More sharing options...
kjactive Posted May 17, 2005 Share Posted May 17, 2005 (edited) Well I just written the Html documentations that could be attached directly into autoit topics if any wants to include these...included in the .zip file...download .zip from site:http://www.sitecenter.dk/latenight/nss-fol...pports/Word.zip kjactive Edited May 17, 2005 by kjactive Au3PP 4.1 - Autoit3 preprocessor, optimize speed, performance to scripts and do executes....[/url]Au3Calibur - Create libraries of commonly used code excerptsWords manipulate UDF, functions that is lent from the rexx language, topics and index file includedCustomDialog UDF to include custom made dialogs like a extended colorpick requester to scripts...[url="ftp://fritidshjemmet.com/Autoit3/SysColor.zip"]SysColor UDF a low level color library to manipulate RGB and Hex values...Shell32 UDF to Automate Windows® operating tasks from native dialog and Wizards browsers... Optimized the CodeWicard with options to generate browser code etc... Link to comment Share on other sites More sharing options...
Developers Jos Posted May 17, 2005 Author Developers Share Posted May 17, 2005 (edited) Well I just written the Html documentations that could be attached directly into autoit topics if any wants to include these...included in the .zip file...download .zip from site:http://www.sitecenter.dk/latenight/nss-fol...pports/Word.zip kjactive <{POST_SNAPBACK}>To get UDF's added to the standard library you will have to follow the standards as defined in the first post in this thread...Its also better to publish your UDF's in the Scripts and Scraps forum first so people can comment/test them so we can see if people like to have them included in the standard library and if they find bugs or have ideas about changes. Edited June 19, 2005 by JdeB 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...
tylo Posted May 25, 2005 Share Posted May 25, 2005 (edited) Mainly an improvement of _ArrayReverse(). Added $i_Bound parameter, and speeded it up by an order of magnitude. It is actually so fast that it is better to do an _ArrayReverse() after sorting 1D arrays than to check for $i_Decending during sorting. Hence the update of _ArraySort(). I call the private __ArrayQSort1() and __ArrayQSort2() with ByRef params only, which makes it faster. Cheers. expandcollapse popup;=============================================================================== ; ; Function Name: _ArrayReverse() ; Description: Takes the given array and reverses the order in which the ; elements appear in the array. ; Author(s): Brian Keene <brian_keene@yahoo.com> ; ; Modified: Added $i_Base parameter and logic (Jos van der Zande) ; Added $i_UBound parameter and rewrote it for speed. (Tylo) ;=============================================================================== Func _ArrayReverse(ByRef $avArray, $i_Base = 0, $i_UBound = 0) If Not IsArray($avArray) Then SetError(1) Return 0 EndIf Local $tmp, $last = UBound($avArray) - 1 If $i_UBound < 1 Or $i_UBound > $last Then $i_UBound = $last For $i = $i_Base To $i_Base + Int(($i_UBound - $i_Base - 1) / 2) $tmp = $avArray[$i] $avArray[$i] = $avArray[$i_UBound] $avArray[$i_UBound] = $tmp $i_UBound = $i_UBound - 1 Next Return 1 EndFunc ;==>_ArrayReverse ;=============================================================================== ; ; Function Name: _ArraySort() ; Description: Sort an 1 or 2 dimensional Array on a specific index ; using the quicksort/insertsort algorithms. ; Parameter(s): $a_Array - Array ; $i_Descending - Sort Descending when 1 ; $i_Base - Start sorting at this Array entry. ; $I_Ubound - End sorting at this Array entry. ; Default UBound($a_Array) - 1 ; $i_Dim - Elements to sort in second dimension ; $i_SortIndex - The Index to Sort the Array on. ; (for 2-dimensional arrays only) ; Requirement(s): None ; Return Value(s): On Success - 1 and the sorted array is set ; On Failure - 0 and sets @ERROR = 1 ; Author(s): Jos van der Zande <jdeb@autoitscript.com> ; LazyCoder - added $i_SortIndex option ; Tylo - implemented stable QuickSort algo ; ;=============================================================================== ; Func _ArraySort(ByRef $a_Array, $i_Decending = 0, $i_Base = 0, $i_UBound = 0, $i_Dim = 1, $i_SortIndex = 0) ; Set to ubound when not specified If Not IsArray($a_Array) Then SetError(1) Return 0 EndIf Local $last = UBound($a_Array) - 1 If $i_UBound < 1 Or $i_UBound > $last Then $i_UBound = $last If $i_Dim = 1 Then __ArrayQSort1($a_Array, $i_Base, $i_UBound) If $i_Decending Then _ArrayReverse($a_Array, $i_Base, $i_UBound) Else __ArrayQSort2($a_Array, $i_Base, $i_UBound, $i_Dim, $i_SortIndex, $i_Decending) EndIf Return 1 EndFunc;==>_ArraySort ; Private Func __ArrayQSort1(ByRef $array, ByRef $left, ByRef $right) If $right - $left < 10 Then ; InsertSort - fastest on small segments (= 25% total speedup) Local $i, $j, $t For $i = $left + 1 To $right $t = $array[$i] $j = $i While $j > $left And $array[$j - 1] > $t $array[$j] = $array[$j - 1] $j = $j - 1 Wend $array[$j] = $t Next Return EndIf ; QuickSort - fastest on large segments Local $pivot = $array[Int(($left + $right)/2)], $t Local $L = $left Local $R = $right Do While $array[$L] < $pivot $L = $L + 1 Wend While $array[$R] > $pivot $R = $R - 1 Wend ; Swap If $L <= $R Then $t = $array[$L] $array[$L] = $array[$R] $array[$R] = $t $L = $L + 1 $R = $R - 1 EndIf Until $L > $R __ArrayQSort1($array, $left, $R) __ArrayQSort1($array, $L, $right) EndFunc ; Private Func __ArrayQSort2(ByRef $array, ByRef $left, ByRef $right, ByRef $dim2, ByRef $sortIdx, ByRef $decend) If $left >= $right Then Return Local $t, $d2 = $dim2 - 1 Local $pivot = $array[Int(($left + $right)/2)][$sortIdx] Local $L = $left Local $R = $right Do If $decend Then While $array[$L][$sortIdx] > $pivot $L = $L + 1 Wend While $array[$R][$sortIdx] < $pivot $R = $R - 1 Wend Else While $array[$L][$sortIdx] < $pivot $L = $L + 1 Wend While $array[$R][$sortIdx] > $pivot $R = $R - 1 Wend EndIf If $L <= $R Then For $x = 0 To $d2 $t = $array[$L][$x] $array[$L][$x] = $array[$R][$x] $array[$R][$x] = $t Next $L = $L + 1 $R = $R - 1 EndIf Until $L > $R __ArrayQSort2($array, $left, $R, $dim2, $sortIdx, $decend) __ArrayQSort2($array, $L, $right, $dim2, $sortIdx, $decend) EndFunc Edited May 25, 2005 by tylo blub Link to comment Share on other sites More sharing options...
FuryCell Posted May 28, 2005 Share Posted May 28, 2005 (edited) here are mine:_FileList();=============================================================================== ; ; Description: lists all files and folders in a specified path (Similar to using Dir with the /B Switch) ; Syntax: _FileList($sPath) ; Parameter(s): $sPath = Path to generate filelist for ; Requirement(s): None ; Return Value(s): On Success - Returns an array containing the list of files and folders in the specified path ; On Failure - Returns an empty string "" if no files are found and sets @Error to 1 if the path is not found ; Author(s): SolidSnake <MetalGearX91@Hotmail.com> ; Note(s): The array returned is one-dimensional and is made up as follows: ; $array[0] = Number of Files\Folders returned ; $array[1] = 1st File\Folder ; $array[2] = 2nd File\Folder ; $array[3] = 3rd File\Folder ; $array[n] = nth File\Folder ;================================================================================ _RegValueList();=============================================================================== ; ; Description: lists the names of all values in a specified key ; Syntax: _RegValueList($sKey) ; Parameter(s): $sKey = Key to generate valuelist for ; Requirement(s): None ; Return Value(s): On Success - Returns an array containing the list of values in the specified path ; On Failure - Returns an empty string "" if no values are found and sets @Error to 1 if the key is not found ; Author(s): SolidSnake <MetalGearX91@Hotmail.com> ; Note(s): The array returned is one-dimensional and is made up as follows: ; $array[0] = Number of values returned ; $array[1] = 1st value ; $array[2] = 2nd value ; $array[3] = 3rd value ; $array[n] = nth value ;=============================================================================== _RegKeyList();=============================================================================== ; ; Description: lists all subkeys in a specified key ; Syntax: _RegKeyList($sKey) ; Parameter(s): $sKey = Key to generate keylist for ; Requirement(s): None ; Return Value(s): On Success - Returns an array containing the list of subkeys in the specified path ; On Failure - Returns an empty string "" if no Keys are found and sets @Error to 1 if the key is not found ; Author(s): SolidSnake <MetalGearX91@Hotmail.com> ; Note(s): The array returned is one-dimensional and is made up as follows: ; $array[0] = Number of Keys returned ; $array[1] = 1st Key ; $array[2] = 2nd Key ; $array[3] = 3rd Key ; $array[n] = nth Key ;===============================================================================Edit:Go here for updated version:http://www.autoitscript.com/forum/index.php?showtopic=11943I added flags and turned the two reg functions into oneUDFs.au3 Edited May 30, 2005 by SolidSnake HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code. Link to comment Share on other sites More sharing options...
Recommended Posts