Jump to content

xcal

Active Members
  • Posts

    841
  • Joined

  • Last visited

Everything posted by xcal

  1. Vague? You've got to be kidding. Every function has an example, it's all indexed, and there's a perfectly good search.
  2. Run it with @SW_HIDE and use StdoutRead to get the data.
  3. FileInstall
  4. Maybe _ChooseColor
  5. I don't think your StringOccurrences works properly? It seems to return an extra occurrence.
  6. 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
  7. No... Microsoft doesn't make Autoit, which is what I'm talking about. Maybe you should have been more clear from the start.
  8. 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?
  9. Well, 0+4=4, so I'm guessing it's just doing "force" shutdown. I'd guess there's no force logoff.
  10. #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
  11. 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
  12. I pronounce it "supercalifragilisticexpialidocious."
  13. 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)
  14. 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
  15. You can't determine the value of your var in the function itself?
  16. edit - nevermind... was thinking of the wrong warcraft.
  17. 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)
  18. SWwwoooooooosh
  19. 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.
  20. Sounds like the FileOpenDialog function is directly in the loop, and not within a Case or something.
  21. 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
  22. Ubound($array) - 1
  23. 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.
×
×
  • Create New...