Leaderboard
Popular Content
Showing content with the highest reputation on 05/20/2013 in all areas
-
Everything on earth has it's pros and cons. Even my wife - I really love her - has her pros and cons. Cons depend on weather, calendar, her weight ...2 points
-
[NEW VERSION] - 2 Aug 18 Added: When specifying the icon to use, if the $vIcon parameter is set to the name of an ico or exe file, the main icon within will be displayed, but if a trailing "|" followed by the icon index is added to the name, that icon from within the file is used New UDF and example in the zip below. Details of previous versions: Changelog.txt A forum query about the small pop-ups that some apps produce from the systray led me to create my version of how this can be done. By the way, I call these small GUIs "Toasts" for obvious reasons! A zip containing the UDF, an example script and my StringSize UDF (which is also required): Toast.zip As always, kind comments and constructive criticisms welcome - particularly the former! M231 point
-
here is a one liner from the helpfile(also an array of arrays): Local $data[10] For $i = 0 To UBound($data)-1 $data[$i] = StringSplit("Abe|Jack|Bobby|Marty", "|",2) Next1 point
-
You can do two liners, but that's creating array of arrays, and not a 2d array. Local $data[10] For $i = 0 To UBound($data)-1 Local $array[3] = [1398, "Toothbrush", "$3.00"] $data[$i] = $array Next1 point
-
couple examples #include <Array.au3> $iTotalAmountOfItems = 10 Global Enum $iArray_ID, $iArray_Name, $iArray_Price, $iArray_UBound Global $aArray[$iTotalAmountOfItems][$iArray_UBound] For $i = 0 To UBound($aArray)-1 For $j = 0 To UBound($aArray,2)-1 Switch $j Case $iArray_ID $aArray[$i][$j] = "ID:" & $i & "," & $j Case $iArray_Name $aArray[$i][$j] = "Name:" & $i & "," & $j Case $iArray_Price $aArray[$i][$j] = "Price:" & $i & "," & $j EndSwitch Next Next _ArrayDisplay($aArray) Global $aArray2[$iTotalAmountOfItems][$iArray_UBound] For $i = 0 To UBound($aArray)-1 $aArray2[$i][$iArray_ID] = "ID:" & $i $aArray2[$i][$iArray_Name] = "Name:" & $i $aArray2[$i][$iArray_Price] = "Price:" & $i Next _ArrayDisplay($aArray2)1 point
-
Comically ironic, albeit hardly "intentional"... MirnesC2 - Your answers are in the previous posts, please don't read into the text things that are not there. Yo want to populate a 2D array using the syntax "array[row][column]". Do not exceed the boundaries of any subscripts (your last error). There are thousands of examples of 2D arrays on the forum. Put something together, identify exactly what the problems are and you will get all the help you need. kylomas1 point
-
Solved !! $MyExcel.activesheet.range("A11:A" & $amount+11).value = $arr1 point
-
How the read content of browser or hta application ON Mouseclick
somdcomputerguy reacted to DaleHohm for a topic
@squadjot, I've been waiting almost 5 years to see if you knew anything about this. Thanks for clearing that up. Dale1 point -
I see. In this case I would just give the user a well structured word document. I think it would be too much effort to create a script for this (hopefully rare case).1 point
-
Sure you can connect to Word. Either by using the builtin Word UDF or my WordEX UDF.1 point
-
Big array search slow, how to improve searching time?
michaelslamet reacted to kylomas for a topic
michaelslamet, I don't know if this matters to you but _arraybinarysearch returns the first ocurrence of a search argument within an array whereas the code that I posted returns index numbers for all elements. They both run in appx the same time, see code below for comparison. #include<array.au3> #include<userudfs.au3> Local $st = TimerInit() local $array1[15] = ['A4','B3','A0','Z9','Q2','A0','A2','D3','A0','A0','Z9','B3','A0','Z9','B3'] local $array2[4] = ['A0','A4','Z9','B3'] ConsoleWrite(StringFormat('> %-40s %2.4f seconds', 'Time to generate arrays ', TimerDiff($st) / 1000) & @LF) ;================================================================================= ; ; Initialize PsuedoSearch with array to be searched. Can be 1D or 2D ; ;================================================================================= $st = TimerInit() _PsuedoSearchInit($array1) If @error <> 0 Then ConsoleWrite('PsuedoSearch Initialization Error...Exiting...' & @LF) Exit EndIf ConsoleWrite(StringFormat('> %-40s %2.4f seconds', 'Time to initialize PsuedoSearch ', TimerDiff($st) / 1000) & @LF) ;================================================================================= ; ; Search array2 for all elements in array1 using PsuedoSearch ; ;================================================================================= local $str = '' $st = timerinit() For $1 = 0 To UBound($array2) - 1 switch ubound($array2,0) case 1 $Ret = _PsuedoSearch($array2[$1]) case 2 for $2 = 0 to ubound($array2,2)- 1 $Ret = _PsuedoSearch($array2[$1][$2]) next endswitch If IsArray($Ret) Then ; returns a 2D array as ; [0][0] = # of times found ; [0][1] = String searched for ; [n][0] = row found in ; [n][1] = column found in ; ; if the array to search is a 1D array then [n][1] will be blank $str &= $Ret[0][1] For $d = 1 To $Ret[0][0] $str &= @TAB & StringFormat('found at row [%04i] col [%04i]', $Ret[$d][0], $Ret[$d][1]) & @LF Next Else $str &= $array2[$1] & ' not found' & @LF EndIf Next ConsoleWrite(StringFormat('> %-40s %2.4f seconds', 'Total time for search ', TimerDiff($st) / 1000) & @LF) ConsoleWrite($str & @LF) ;================================================================================= ; ; Search array2 for all elements in array1 using _arraysort and _arraybinarysearch ; ;================================================================================= Local $st = TimerInit(), $str _arraysort($array1) For $1 = 0 To UBound($array2) - 1 $Ret = _arraybinarysearch($array1,$array2[$1]) switch $Ret case -1 ConsoleWrite($array2[$1] & ' not found' & @LF) case else ConsoleWrite($array2[$1] & ' found at ' & $ret & @LF) endswitch Next ConsoleWrite(StringFormat('> %-40s %2.4f seconds', 'Total time for search ', TimerDiff($st) / 1000) & @LF) ; #FUNCTION# ==================================================================================================================== ; Name ..........: _PsuedoSearchInit ; Description ...: Creates Global vars to be used to search against. Vars contain row-column info. ; Syntax ........: _PsuedoSearchInit(Byref $aTargetArray) ; Parameters ....: $aTargetArray - The array to be searched, either 1D or 2D ; Return values .: - @error = 1 parameter is not an array ; |- @error = 2 parameter is not a 1D or 2D array ; Author ........: kylomas ; Modified ......: 5/18/2013 ; Remarks .......: Created V1.1.0 ; Related .......: _PsuedoSearch ; Link ..........: ; Example .......: Yes ; =============================================================================================================================== Func _PsuedoSearchInit(ByRef $aTargetArray) If Not IsArray($aTargetArray) Then Return SetError(1) If UBound($aTargetArray, 0) > 2 Then Return SetError(2) Local $instance = 0 Switch UBound($aTargetArray, 0) Case 1 For $1 = 0 To UBound($aTargetArray, 1) - 1 $instance = 1 While 1 If IsDeclared("a" & $aTargetArray[$1] & '_' & $instance) Then $instance += 1 Else Assign("a" & $aTargetArray[$1] & '_' & $instance, $1, 2) ExitLoop EndIf WEnd Next Case 2 For $1 = 0 To UBound($aTargetArray, 1) - 1 For $2 = 0 To UBound($aTargetArray, 2) - 1 $instance = 1 While 1 If IsDeclared("a" & $aTargetArray[$1][$2] & '_' & $instance) Then $instance += 1 Else Assign("a" & $aTargetArray[$1][$2] & '_' & $instance, $1 & '_' & $2, 2) ExitLoop EndIf WEnd Next Next EndSwitch EndFunc ;==>_PsuedoSearchInit ; #FUNCTION# ==================================================================================================================== ; Name ..........: _PsuedoSearch ; Description ...: Search the array specified in _PsuedosearchInit() ; Syntax ........: _PsuedoSearch($str) ; Parameters ....: $str - The string to search for ; Return values .: - "0" = search argument not found ; |- If the search argument is found then return a 2D array as ; | [0][0] = # of times found ; | [0][1] = String searched for ; | [n][0] = row found in ; | [n][1] = column found in ; Author ........: kylomas ; Modified ......: 5/18/2013 ; Remarks .......: Created V1.1.0 ; Related .......: _PsuedoSearchInit ; Link ..........: ; Example .......: Yes ; =============================================================================================================================== Func _PsuedoSearch($str) Local $instance = 1, $aRet[1][2] = [[0, 0]] While IsDeclared("a" & $str & '_' & $instance) $aTmp = StringSplit(Eval("a" & $str & '_' & $instance), '_') $aRet[0][0] = $instance $aRet[0][1] = $str $instance += 1 ReDim $aRet[UBound($aRet) + 1][2] switch ubound($aTmp) case 2 $aRet[UBound($aRet) - 1][0] = $aTmp[1] case 3 $aRet[UBound($aRet) - 1][0] = $aTmp[1] $aRet[UBound($aRet) - 1][1] = $aTmp[2] endswitch WEnd If $aRet[0][0] = 0 Then Return 0 Else Return $aRet EndIf EndFunc ;==>_PsuedoSearch kylomas edit: as the searched array gets larger the comparison widens. At 50000 randomly generated entries the binary search runs in 3.8 seconds and mine runs in 21 seconds. If you only need the first ocurrence of a match then this is the way to go.1 point -
@monoceres - obviously I was too subtle with my humor ... too tongue-in-cheek for your toes. I'm a perfect example of perfection without any Cons ... especially when wielding my trusty hammer. Back in my teens, I even wrote a song about Thor the God Of Thunder and Lightning ... one of my very first song creations. P.S. I like to mix up seriousness with silliness ... keeps people on their toes ... so hopefully they won't get TOO serious. I love playing with Irony too.1 point
-
Resources UDF + Checkbox + BS_PUSHLIKE
Armag3ddon reacted to Zedna for a topic
It should work this way - conversion from PNG to BMP does _ResourceSetImageToCtrl() internally for you: #AutoIt3Wrapper_Res_File_Add=your_icon.png, rt_rcdata, QE_ICON $quickedit = GUICtrlCreateCheckbox("", 595,536, 24,24, BitOR($GUI_SS_DEFAULT_CHECKBOX, $BS_PUSHLIKE, $BS_BITMAP)) _ResourceSetImageToCtrl($quickedit, "QE_ICON", $RT_RCDATA)1 point