while loop after return of shortcuts definition never reached? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
SL5
Posts: 879
Joined: 12 May 2015, 02:10
Contact:

while loop after return of shortcuts definition never reached?

30 Sep 2018, 03:30

while loop after return of shortcuts definition never reached?

Code: Select all

ifWinNotActive, ahk_class Chrome_WidgetWin_1
::^tab::
    send,^n
return

While(1)
	tootip,i want reach this line <=====
do i need to define first a hotkey and define its body later?

this also not works:

Code: Select all

ifWinNotActive, ahk_class Chrome_WidgetWin_1
::Ctrl & tab::Ctrltab2CtrlN()
...
Ctrltab2CtrlN(){
    send,^n
}

Rindis
Posts: 213
Joined: 23 Dec 2013, 13:58
Location: Norway
Contact:

Re: while loop after return of shortcuts definition never reached?

30 Sep 2018, 04:09

Not sure what you want but You'll never reach the while loop, as the script stopr (or returns) at return.

Code: Select all

ifWinNotActive, ahk_class Chrome_WidgetWin_1
::^tab::
    send,^n
return ;this is as far as you get

While(1) ; you need to point to this in your script, could be be a Timer, or included in your hotkey
	tootip ;i want reach this line <===== 

This would get you to while

Code: Select all

ifWinNotActive, ahk_class Chrome_WidgetWin_1
::^tab::
    send,^n


While(1)
	tootip,i want reach this line <=====

return ; the script goes untill here, but this will probably not work as you want
User avatar
SL5
Posts: 879
Joined: 12 May 2015, 02:10
Contact:

Re: while loop after return of shortcuts definition never reached?

30 Sep 2018, 11:32

Rindis wrote:Not sure what you want but You'll never reach the while loop, as the script stopr (or returns) at return.
yes and thats exactly the problem.
i want 1) the hotkey and 2) the while loop running at the script is starting.
i know thats possible. i only dont know how for the moment.
in your code example the while is only starting by with hotkey. the while should not part of the hotkey.
Rindis wrote:

Code: Select all

::^tab::
    send,^n
While(1)
	tootip,i want reach this line <=====
User avatar
SL5
Posts: 879
Joined: 12 May 2015, 02:10
Contact:

Re: while loop after return of shortcuts definition never reached?  Topic is solved

30 Sep 2018, 11:45

solution1:

Code: Select all

#IfWinActive, blablal
Hotkey, Ctrl & t, lblCtrlT2CtrlN

While(1)
   tooltip,bla

return


lblCtrlT2CtrlN:
    Ctrltab2CtrlN()
return
CtrlT2CtrlN(){
    Suspend,on
    send,^n
    Suspend,off
    msgbox,works?
    return
}
solution2:

Code: Select all

fnCtrlT2CtrlN := Func("CtrlT2CtrlN").Bind(Präfix)
#IfWinActive, blablal
Hotkey, Ctrl & t, % fnCtrlT2CtrlN ; works

while(1)
	blalbalsldk

CtrlT2CtrlN(){
	msgbox, hi ho
}

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: ArkuS, Chunjee, downstairs, Frogrammer and 341 guests