adam51

just a quick one

2 posts in this topic

#1 ·  Posted

I wrote this script to keep clicking down so that I can play the music with my guitar and not have to keep on stopping to press down, Im sure there is probably an even better way, but anyway, this is the second exit script that I have tried writing at the end, but it does not stop it running when im pressing exit

this is the other exit script I tried:

#include <msgboxconstants.au3>

;press Esc to terminate script, pause/break to "pause"

Global $g_bpaused = False

HotKeySet ( " {pause} " , "togglepause" )
HotKeySet ( " {ESC} " , "Terminate" )
HotKeySet ( " +!d" , "showMessage ") ; shift-alt-D

while 1
   sleep(100)
WEnd
func Togglepause()
   $g_bpaused = Not $g_bpaused
   While $g_bpaused
      sleep(100)
      ToolTip( 'script is "paused" ' , 0, 0)
   WEnd
   ToolTip(" ")
EndFunc    ;==>Togglepause

Func Terminate( )
   Exit
EndFunc    ;==>Terminate

Func showmessage ( )
   MsgBox($MB_systemmodal,  " " , "this is a message." )
   EndFunc   ;==>Showmessage

 

any ideas why it wont stop stop the script please?

i have been racing to tools and stop script as I dont seem to have the break button

pinpoint.au3

Share this post


Link to post
Share on other sites



#2 ·  Posted

You need to use curly brackets i.e. HotKeySet("{ESC}", "close") not HotKeySet("(ESC)", "close"), it also needs to be set at the top of your script, + you need an EndFunc on Close().

Couple of alternative  methods, IE Scroll.

#include <IE.au3>
HotKeySet("{ESC}", "close")
Local $i = 0
Local $iDown = 200 ; Scroll down 200 Pixels

Local $oIE = _IECreate("https://tabs.ultimate-guitar.com/j/james_arthur/say_you_wont_let_go_ver3_crd.htm", 1)
_IELoadWait($oIE)
AdlibRegister("_IEScroll", 4000)
While 1
    Sleep(10)
WEnd

Func _IEScroll()
    $oIE.document.parentwindow.scroll(0, $i)
    $i += $iDown
EndFunc

Func close ()
   Exit
EndFunc

Notepad + Scroll.

#include <IE.au3>
#include <ScrollBarsConstants.au3>
#include <GuiEdit.au3>

HotKeySet("{ESC}", "close")

Global $oIEBrowse = _IECreate("https://tabs.ultimate-guitar.com/l/led_zeppelin/stairway_to_heaven_ver2_crd.htm", 1)
    _IELoadWait($oIEBrowse)
Global $oSong = _IEGetObjById($oIEBrowse, "cont")
    If @error Then Exit
Run("Notepad.exe")
Global $hWnd = WinWait("[CLASS:Notepad]", "", 10)
    ControlSetText($hWnd, "", "Edit1", $oSong.InnerText)
Global $hCtrl = ControlGetHandle($hWnd, "", "Edit1")
AdlibRegister("_ScrollText", 8000)

While 1
    Sleep(10)
WEnd

Func _ScrollText()
    _GUICtrlEdit_Scroll($hCtrl, $SB_PAGEDOWN)
EndFunc

 

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now