
xcal
Active Members-
Posts
841 -
Joined
-
Last visited
Everything posted by xcal
-
Retrieving data from command window execution
xcal replied to LeeSylvester's topic in AutoIt General Help and Support
Run it with @SW_HIDE and use StdoutRead to get the data. -
Maybe _ChooseColor
-
number of occurances of a string in another string
xcal replied to maqleod's topic in AutoIt General Help and Support
I don't think your StringOccurrences works properly? It seems to return an extra occurrence. -
number of occurances of a string in another string
xcal replied to maqleod's topic in AutoIt General Help and Support
I made this a bit ago... might work for you. ; _GetCharPos(string, what to search for) ; Returns an array of starting positions ; $array[0] = total returns #include <array.au3> ; just for _ArrayDisplay() $somevar = _GetCharPos('this is some string. this is the string to find the word is in.', 'is') _ArrayDisplay($somevar) Func _GetCharPos($string, $search) Local $array[1], $i = 1, $ret While 1 $ret = StringInStr($string, $search, 0, $i) If $ret = 0 Then ExitLoop ReDim $array[UBound($array) + 1] $array[$i] = $ret $i += 1 WEnd $array[0] = UBound($array) - 1 Return $array EndFunc -
Shutdown() not working correctly?
xcal replied to bmckenzie's topic in AutoIt General Help and Support
No... Microsoft doesn't make Autoit, which is what I'm talking about. Maybe you should have been more clear from the start. -
Shutdown() not working correctly?
xcal replied to bmckenzie's topic in AutoIt General Help and Support
Well, the math will be performed before the function is executed (someone correct me if I'm wrong), so it is essentially still 4. I wouldn't call it a bug, but maybe a missing feature? -
Shutdown() not working correctly?
xcal replied to bmckenzie's topic in AutoIt General Help and Support
Well, 0+4=4, so I'm guessing it's just doing "force" shutdown. I'd guess there's no force logoff. -
Identifying data in any order
xcal replied to Fossil Rock's topic in AutoIt General Help and Support
#region - create the array/items for testing. #include <Array.au3> ; only needed for _ArrayDisplay Global $set1[4] = ['Banana', 'Grape', 'Lemon', 'Cherry'] Global $set2[4] = ['Green', 'Blue', 'Red', 'Yellow'] Global $set3[4] = ['5', '12', '17', '30'] Global $list[100] For $i = 0 To 99 $list[$i] = $set1[Random(0, 3, 1) ] & ',' & _ $set2[Random(0, 3, 1) ] & ',' & _ $set3[Random(0, 3, 1) ] Next #endregion _ArrayDisplay($list, 'Before Checking') For $i = 0 To 99 If SomeFuncName($list[$i]) Then $list[$i] = $list[$i] & ' <<<<< match here' Next _ArrayDisplay($list, 'After Checking') Func SomeFuncName($str) If StringInStr($str, 'Cherry') And _ StringInStr($str, '5') And _ StringInStr($str, 'Red') _ Then Return True Return False EndFunc -
Identifying data in any order
xcal replied to Fossil Rock's topic in AutoIt General Help and Support
MsgBox(0, '', SomeFuncName('5,Red,Cherry')) MsgBox(0, '', SomeFuncName('Red,5,Cherry')) MsgBox(0, '', SomeFuncName('Red,Cherry,5')) MsgBox(0, '', SomeFuncName('Blue,Cherry,5')) Func SomeFuncName($str) If StringInStr($str, 'Cherry') And _ StringInStr($str, '5') And _ StringInStr($str, 'Red') _ Then Return True Return False EndFunc -
I pronounce it "supercalifragilisticexpialidocious."
-
Global $array[4] = ['abc_01_xyz', 'abcd_32_xyz', 'ab_01_wxyz', 'def_ghi'] For $i = 0 To 3 $ret = StringRegExp($array[$i], '01|[a-z]_[a-z]', 0) If $ret Then ConsoleWrite(@LF & $array[$i]) Next ConsoleWrite(@LF) ConsoleWrite(@LF)
-
I had this laying around for finding files. I just modded it real quick, so it's not pretty (no error checking, function options etc), so it'll find extensions. Just run it and put in the extension you want to find (ex: jpg with no '.'). #include <array.au3> ; just for _ArrayDisplay $input = InputBox('What to Search for...', 'Find what ext? (ex: jpg)', 'ext', '', 200, 120) If @error Then Exit _ArrayDisplay(_findfile($input)) Func _findfile($ext) Local $rets[1] Local $output = Run(@ComSpec & " /c " & 'dir ' & '"' & @HomeDrive & '\' & '' & '*.' & $ext & '" /b /s', '', @SW_HIDE, 2) While 1 $stdout = StdoutRead($output) If @error Then ExitLoop $found = StringSplit(StringStripCR($stdout), @LF) For $i = 1 To UBound($found) - 1 If $found[$i] = '' Then ContinueLoop ReDim $rets[UBound($rets)+1] $rets[UBound($rets)-1] = $found[$i] Next WEnd $rets[0] = UBound($rets) - 1 Return $rets EndFunc
-
Not possible to pass var to function using HotKeySet?
xcal replied to coasty's topic in AutoIt General Help and Support
You can't determine the value of your var in the function itself? -
_GUICtrlListViewGetColumnHeaderText
xcal replied to JohnBailey's topic in AutoIt General Help and Support
Poor Zelda -
A way to control another program
xcal replied to Nbanonimous's topic in AutoIt General Help and Support
edit - nevermind... was thinking of the wrong warcraft. -
Split this string into 4
xcal replied to WeMartiansAreFriendly's topic in AutoIt General Help and Support
Why not just StringSplit at the spaces? edit - And StringReplace, of course, to get rid of the brackets. #include <array.au3> ; just for arraydisplay $str = StringReplace('47.5% (.Word) Description (10527/13/4)', '(', '') $str = StringReplace($str, ')', '') $ret = StringSplit($str, ' ') _ArrayDisplay($ret) -
SWwwoooooooosh
-
That's a really good question. They should add that to the Support Forum FAQ. If it does get added, I'd make it Q3.
-
Sounds like the FileOpenDialog function is directly in the loop, and not within a Case or something.
-
You mean something like this? #include <GUIConstants.au3> #include <GUIListView.au3> GUICreate('Some GUI', 300, 200) $btn = GUICtrlCreateButton('Add File', 10, 10, 60, 26) $lv = GUICtrlCreateListView('Files', 10, 46, 280, 144, -1, $LVS_EX_GRIDLINES) _GUICtrlListViewSetColumnWidth($lv, 0, 276) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $btn $file = FileOpenDialog('Select a file', 'c:\', 'All Files (*.*)') If Not @error Then _GUICtrlListViewInsertItem($lv, 0, $file) ; edit - change 0 to -1 to append Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd
-
Ubound($array) - 1
-
Heh he's not saying there's an actual error. It's has more to do with his $iBase = 1 option. Like if you don't want to include the [0] element, for example. When I make a little UDF thingy, I'm more like... DO THIS. Smoke is like... do this... but here's a nice option... lets check for errors... etc. He's more thorough than me.