Try catch errors Topic is solved

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
Master_X
Posts: 33
Joined: 04 Aug 2023, 13:59

Try catch errors

06 Aug 2023, 17:13

I read somewhere a block that gets executed does not continue after catching an error. Can confirm this :D

I fixed my script already but seems a bit weird for me. I think there is another way to execute the block and not using 2 try and 2 catch.

Or is there something I can add to completely ignore the error if the window can't be closed?

Code: Select all

#notrayicon

SetTimer Label, 250

Label()
{
	try
	{	WinClose "ahk_class CreativeView ahk_exe TeamViewer.exe"
		WinClose "Gesponserte Sitzung ahk_class #32770 ahk_exe TeamViewer.exe"
	}
	catch
	{
	}
}

Persistent

Code: Select all

#notrayicon

SetTimer Label, 250

Label()
{	try
		WinClose "ahk_class CreativeView ahk_exe TeamViewer.exe"
	catch
		try
			WinClose "Gesponserte Sitzung ahk_class #32770 ahk_exe TeamViewer.exe"
		catch
			return
}

Persistent
User avatar
mikeyww
Posts: 27370
Joined: 09 Sep 2014, 18:38

Re: Try catch errors  Topic is solved

06 Aug 2023, 19:13

Code: Select all

#Requires AutoHotkey v2.0

SetTimer label, 250

label() {
 Try WinClose 'ahk_class CreativeView ahk_exe TeamViewer.exe'
 Try WinClose 'Gesponserte Sitzung ahk_class #32770 ahk_exe TeamViewer.exe'
}

Return to “Ask for Help (v2)”

Who is online

Users browsing this forum: costelpislac, Descolada and 49 guests