
Floops
Active Members-
Posts
92 -
Joined
-
Last visited
-
Days Won
1
Everything posted by Floops
-
StringSplit returns an array which can't be displayed using a MsgBox. Use _ArrayDisplay instead.
-
Not sure if I understand your question completely but would the following work? $cK = False For $k = 0 to $iMax - 1 If isArray ($cArr[$k]) Then $cK = True EndIf Next Consolewrite("Result: " & $cK & @LF)
-
You passed "" as the third argument which is equal to @SW_HIDE Try this instead: Run("C:\adwcleaner_7.0.5.0.exe","" ,@SW_MAXIMIZE )
-
Because you are calling a function every x milliseconds. That doesn't guarantee that it runs after every line of code. You could set the interval very low but then that function gets spammed which could be CPU-heavy.
-
I see, what about AdlibRegister() ? Might not be the prettiest solution but it's better than putting an if-statement on every line.
-
Couldn't you put something like this into your loop? If WinExists("Error Window") Then ControlClick("Error Window", "", "[CLASS:Button; INSTANCE:1]") EndIf
-
@rootx Good example but wouldn't using BitOR($STDOUT_CHILD, $STDERR_CHILD) be better here? Of course you want to read both channels but you don't want them to be combined. Correct me if I'm wrong though!
-
Have you tried $STDERR_MERGED instead of $STDOUT_CHILD ?
-
regular expression.... y u no express!!
Floops replied to gruntydatsun's topic in AutoIt General Help and Support
Don't worry you're not alone! I am also pretty bad at regular expressions but since I'm willing to learn more on the topic I gave it a try anyways. #include <Array.au3> #include <StringConstants.au3> $sTest = "C:\SharedData\CAT\v1.5.23\Back_2.7.2_Test.html" $sPattern = "(.*\\)(.*)\.(\w{1,4})$" $aMatches = StringRegExp($sTest, $sPattern, $STR_REGEXPARRAYGLOBALMATCH) _ArrayDisplay($aMatches) There's probably a better way to do it but it seems to work for me. -
@IAMK I'm afraid I don't know. Using lowercase p neither paused nor unpaused it for me while using Shift+P worked in both cases. Maybe it's OS or language specific? I'm using Windows 7 x64 with a German keyboard layout.
-
Using a lowercase "p" in HotKeySet() should work.
-
Excuse me if I'm missing something here but isn't the code that I posted exactly doing what you are describing? Once you press F1 it goes into the function Sleeper and stays there until you press F2, then the function Resume is called which allows Sleeper to return exactly where you were before you initially called Sleeper.
-
How about this? Global $bSleep = False HotKeySet ("{F1}", "Sleeper") HotKeySet ("{F2}", "Resume") start() Func start() WinActivate("New Text Document - Notepad", "") for $start = 0 to 100 Step +1 Send($start) Sleep(500) Next EndFunc Func Resume() $bSleep = False EndFunc Func Sleeper() $bSleep = True While $bSleep Sleep(10) WEnd EndFunc
-
Just throwing in my interpretation/solution of your problem. Global $currentFunc = 1 HotKeySet("1", "previous_func") HotKeySet("2", "next_func") For $currentFunc = 1 To 10 Call("func" & $currentFunc) Sleep(500) Next Func previous_func() $currentFunc -= 1 EndFunc Func next_func() $currentFunc += 1 EndFunc Func func1() ConsoleWrite("func1" & @CRLF) EndFunc Func func2() ConsoleWrite("func2" & @CRLF) EndFunc Func func3() ConsoleWrite("func3" & @CRLF) EndFunc Func func4() ConsoleWrite("func4" & @CRLF) EndFunc Func func5() ConsoleWrite("func5" & @CRLF) EndFunc Func func6() ConsoleWrite("func6" & @CRLF) EndFunc Func func7() ConsoleWrite("func7" & @CRLF) EndFunc Func func8() ConsoleWrite("func8" & @CRLF) EndFunc Func func9() ConsoleWrite("func9" & @CRLF) EndFunc Func func10() ConsoleWrite("func10" & @CRLF) EndFunc Edit: Nevermind, probably not what you are looking for then.
-
Interesting task, maybe something like this would be what you're looking for? Global $bPause = False AdlibRegister("_pause") HotKeySet("{ESC}", "_toggle_pause") While 1 ConsoleWrite("Not paused" & @CRLF) Sleep(50) WEnd Func _pause() While $bPause = True ConsoleWrite("Paused..." & @CRLF) Sleep(50) WEnd EndFunc Func _toggle_pause() $bPause = Not $bPause EndFunc Edit: I should really learn to read the helpfiles before posting. There is already an example for a pause toggle in the HotKeySet() help: ; Press Esc to terminate script, Pause/Break to "pause" Global $g_bPaused = False HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") While 1 Sleep(100) ConsoleWrite("Script is running..." & @CRLF) WEnd Func TogglePause() $g_bPaused = Not $g_bPaused While $g_bPaused Sleep(100) ConsoleWrite("Script is paused..." & @CRLF) WEnd EndFunc ;==>TogglePause Func Terminate() Exit EndFunc ;==>Terminate
-
The variable stores what is assigned to it. If you assign a function to a variable it only stores the return value of that function. For what you want to do it would be best to make your own function and call it using its name. If you really want to use a variable you could assign the name of the function to the variable and call it using the Call() function. Here is an example: #include <File.au3> _FileCreate(@DesktopDir & "\Log.txt") $test = "name_of_func" Call($test) Func name_of_func() FileWriteLine(@DesktopDir & "\Log.txt", @CRLF ) EndFunc Now you can call the function as often as you want using Call($test). Hope it helps!
-
Autoit save Listview Data to file
Floops replied to Renderer's topic in AutoIt General Help and Support
Alternatively there is also _GUICtrlListView_SaveTxt() - Exports the details of a ListView to a .txt file. -
_IECreate returns an object, however WinExists requires a handle. As to your second problem, it seems that calling WinExists with an empty string (or an unassigned variable in your case) for the Window Name always returns True. If you set it to 0 it won't say that the window exists. #include <MsgBoxConstants.au3> #include <IE.au3> Global $oIE2 = 0, $oIE3 = 0 Example() Func Example() $oIE3 = _IECreate("www.google.com") $hWnd = _IEPropertyGet($oIE3, "hwnd") ; Wait 10 seconds for the Notepad window to appear. Sleep(10000) ; Test if the window exists and display the results. If WinExists($hWnd) Then MsgBox($MB_SYSTEMMODAL, "1", "Window exists") Else MsgBox($MB_SYSTEMMODAL, "1", "Window does not exist") EndIf If WinExists($oIE2) Then MsgBox($MB_SYSTEMMODAL, "2", "Window exists") Else MsgBox($MB_SYSTEMMODAL, "2", "Window does not exist") EndIf EndFunc ;==>Example
-
Looks like you need to use nested loops. Try the following: For $i = 1 To UBound($array) - 1 For $j = 0 To UBound($array, 2) - 1 MouseClick('primary', 585, 210, 1, 0) Sleep(300) Send($array[$i][$j]) Sleep(300) Next Next
-
Reading file returns number instead of string
Floops replied to stojko22's topic in AutoIt General Help and Support
Damn I never knew of this until now. I should really pay more attention to the help files.. -
Reading file returns number instead of string
Floops replied to stojko22's topic in AutoIt General Help and Support
Something like this should work $file = FileOpen("test.ini") ; open file $i = 0 Do $i += 1 $bb = FileReadLine($file, $i) $iError = @error If StringInStr($bb, "Blode") Then ConsoleWrite("Substring found in line: " & $i & " | Text: " & $bb & @CRLF) Until $iError = -1 FileClose($file) -
So you post a thread about wanting to automate a game, then get told that it's against the rules and then you repost the same thread just this time without mentioning that it's for a game?
-
HotKeySet is your friend. This should work, otherwise report back here HotKeySet("f", "send_keys") HotKeySet("{ESC}", "exit_script") While 1 Sleep(50) WEnd Func send_keys() Send("G") Sleep(735) Send("H") EndFunc Func exit_script() Exit EndFunc
-
Grabbing file directory Question
Floops replied to samsphsw's topic in AutoIt General Help and Support
Hmm, the syntax looks correct, when using that code I get full paths. Can you try a different folder/mask and see if it works then?