xkazz Posted July 27, 2021 Posted July 27, 2021 (edited) Hey guys, I'm following some guide on youtube and I'm stuck at a certain command "ToolTip" when used alone it shows a tooltip but I tried to use the script from the video and it somehow doesn't work, I tried the prod auto correct and it didn't detect any error. expandcollapse popupHotKeySet("{F2}", "GG") $wait = 1000 $left = 0 $right = 0 Func GG() While 1 Progress($left, $right) Send("{LEFT}") Sleep($wait) $left = $left + 1 Progress($left, $right) Send("{RIGHT}") Sleep($wait) $right = $right + 1 Progress($left, $right) WEnd EndFunc Func Progress($left, $right) Local $hotkey = "" if @HotKeyPressed = "{F2}" Then $hotkey = "You Are gooood" EndIf ToolTip("Hotkey: " & $hotkey & " " & @hotkeypressed & @CRLF & _ "Left: " & $left & @CRLF & _ "right: " & $right & @CRLF & _ "Time: " & time($left, $right), _ 400, 500, "_____Thanks so much!_____") EndFunc Func time($left, $right) $totalSecs = (($left - $right) * $wait) / 1000 $hrs = Floor($totalSecs / 3600) $mins = Floor( ( ($totalSecs / 3600) - $hrs ) *60) $secs = Floor( ( ($totalSecs / 60) - Floor(($totalSecs / 60)) ) * 60) Return $hrs & " HR: " & $mins & "MIN: " & $secs & " S" EndFunc Where is the error in the code ? why is it not showing the tooltip ? Edited July 27, 2021 by xkazz
Solution Musashi Posted July 28, 2021 Solution Posted July 28, 2021 (edited) 11 hours ago, xkazz said: Where is the error in the code ? why is it not showing the tooltip ? The script ends immediately right after the start ( before you can press F2). You will need e.g. a main loop. expandcollapse popupHotKeySet("{ESC}", "_Terminate") HotKeySet("{F2}", "GG") Local $wait = 1000, $left = 0, $right = 0 ; -------------- Main-Loop ----------------- While 1 Sleep(100) WEnd ; ------------------------------------------- Func GG() While 1 Progress($left, $right) Send("{LEFT}") Sleep($wait) $left = $left + 1 Progress($left, $right) Send("{RIGHT}") Sleep($wait) $right = $right + 1 Progress($left, $right) WEnd EndFunc ;==>GG Func Progress($left, $right) Local $hotkey = "" If @HotKeyPressed = "{F2}" Then $hotkey = "You Are gooood" EndIf ToolTip("Hotkey: " & $hotkey & " " & @HotKeyPressed & @CRLF & _ "Left: " & $left & @CRLF & _ "right: " & $right & @CRLF & _ "Time: " & time($left, $right), _ 400, 500, "_____Thanks so much!_____") EndFunc ;==>Progress Func time($left, $right) $totalSecs = (($left - $right) * $wait) / 1000 $hrs = Floor($totalSecs / 3600) $mins = Floor((($totalSecs / 3600) - $hrs) * 60) $secs = Floor((($totalSecs / 60) - Floor(($totalSecs / 60))) * 60) Return $hrs & " HR: " & $mins & "MIN: " & $secs & " S" EndFunc ;==>time Func _Terminate() ConsoleWrite("! Script terminated by user" & @CRLF) Exit; EndFunc ;==>_Terminate Edited July 28, 2021 by Musashi xkazz and JockoDundee 1 1 "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."
xkazz Posted July 29, 2021 Author Posted July 29, 2021 On 7/28/2021 at 5:51 AM, Musashi said: The script ends immediately right after the start ( before you can press F2). You will need e.g. a main loop. expandcollapse popupHotKeySet("{ESC}", "_Terminate") HotKeySet("{F2}", "GG") Local $wait = 1000, $left = 0, $right = 0 ; -------------- Main-Loop ----------------- While 1 Sleep(100) WEnd ; ------------------------------------------- Func GG() While 1 Progress($left, $right) Send("{LEFT}") Sleep($wait) $left = $left + 1 Progress($left, $right) Send("{RIGHT}") Sleep($wait) $right = $right + 1 Progress($left, $right) WEnd EndFunc ;==>GG Func Progress($left, $right) Local $hotkey = "" If @HotKeyPressed = "{F2}" Then $hotkey = "You Are gooood" EndIf ToolTip("Hotkey: " & $hotkey & " " & @HotKeyPressed & @CRLF & _ "Left: " & $left & @CRLF & _ "right: " & $right & @CRLF & _ "Time: " & time($left, $right), _ 400, 500, "_____Thanks so much!_____") EndFunc ;==>Progress Func time($left, $right) $totalSecs = (($left - $right) * $wait) / 1000 $hrs = Floor($totalSecs / 3600) $mins = Floor((($totalSecs / 3600) - $hrs) * 60) $secs = Floor((($totalSecs / 60) - Floor(($totalSecs / 60))) * 60) Return $hrs & " HR: " & $mins & "MIN: " & $secs & " S" EndFunc ;==>time Func _Terminate() ConsoleWrite("! Script terminated by user" & @CRLF) Exit; EndFunc ;==>_Terminate Thank you it worked. There is a little issue with the seconds in the time and I'll fix it.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now