Jump to content

[AHK] Got problem. Help.

Hi there.

 

Noob to AHK here. Just found it yesterday. Found it super interesting, but I got problems.

 

Spoiler

SetBatchLines -1

IfWinExist ahk_class wxWindowNR
{
	Pause::
	WinActivate ahk_class wxWindowNR
	Click 33, 469
	return
}
else
{
	msgbox ,4,AHK: Aegisub,Aegisub program isn't running. Do you want me to wait until it exist?,
	IfMsgBox, Yes
		{
		TrayTip ,AHK: Aegisub, Waiting for Aegisub to run. You can ignore this message.,,
		WinWait ,ahk_class wxWindowNR,,,,,	
		TrayTip ,AHK: Aegisub, wxWindowNR found. Continuing script,, ; Replace the text with something better.
		return
		}
	else
		{
		ExitApp
		return
		}
}

 

 

Issues:

  1. Apparently then statement from IfWinExist in the first one got activated even if I'm on else. I can press Pause button and it do the thing I said, outside then statement.
  2. After the first issue got resolved, how to tell the script (on IfMsgBox, Yes) to come back and listen to Hotkey that I set on the aforementioned then statement? (After WinWait passed.)

 

Again, I'm super noob and kinda stuck here. Any suggestion for solutions will be helpful!

Link to comment
https://linustechtips.com/topic/691604-ahk-got-problem-help/
Share on other sites

Link to post
Share on other sites

Okay, solved my own issues.

 

Spoiler

SetBatchLines -1

IfWinExist ahk_class wxWindowNR
{
	Hotkey Pause, PlayFromSelectedLine
}
else
{
	msgbox ,4,AHK: Aegisub,Aegisub program isn't running. Do you want me to wait until it exist?,
	IfMsgBox, Yes
		{
			TrayTip ,AHK: Aegisub, Waiting for Aegisub to run. You can ignore this message.,,
			WinWait ,ahk_class wxWindowNR,,,,,	
			TrayTip ,AHK: Aegisub, wxWindowNR found. Continuing script,, ; Replace the text with something better.
			Hotkey Pause, PlayFromSelectedLine
			return
		}
	else
		{
			ExitApp
			return
		}
}

PlayFromSelectedLine:
WinActivate ahk_class wxWindowNR
Click 33, 469
return

 

 

Link to comment
https://linustechtips.com/topic/691604-ahk-got-problem-help/#findComment-8873568
Share on other sites

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

×