Prevents Windows Shutting Down

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
aweinberg
Posts: 52
Joined: 08 Feb 2019, 15:38

Prevents Windows Shutting Down

18 Nov 2020, 16:15

What in the script would prevent windows from shutting down? I have to click force shutdown or windows does not shutdown because of this script.

Code: Select all

#NoEnv
#SingleInstance Force
#Warn ClassOverwrite
SendMode Input
SetBatchLines -1
SetTitleMatchMode 2

TooltipHotkeys := [new PremiereTooltip("V", "Selection tool", "The default tool, used to select clips in the timeline.")
				 , new PremiereTooltip("A", "Track Select tool", "Select all clips on a track from a given point, or select multiple tracks.")
				 , new PremiereTooltip("B", "Ripple Edit tool", "Adjust an edit point and move other clips in the timeline to compensate.")
				 , new PremiereTooltip("N", "Rolling Edit tool", "Adjust an edit point between two clips without affecting the rest of the timeline.")
				 , new PremiereTooltip("R", "Rate Stretch tool", "Change the duration of a clip while simultaneously changing the speed to compensate.")
				 , new PremiereTooltip("C", "Razor tool", "Cut a clip (or multiple clips) into two clips.")
				 , new PremiereTooltip("Y", "Slip tool", "Move a clip's in and out points by the same amount simultaneously, so the rest of the timeline is not affected.")
				 , new PremiereTooltip("U", "Slide tool", "Move a clip back and forth in the timeline, while simultaneously adjusting adjacent clips to compensate.")
				 , new PremiereTooltip("P", "Pen tool", "Create control (anchor) points.")
				 , new PremiereTooltip("H", "Hand tool", "Drag the timeline view left and right.")
				 , new PremiereTooltip("Z", "Zoom tool", "Click in the timeline to magnify the view, or drag and select a rectangular area to zoom into.")]

class PremiereTooltip
{
	static GUI_WIDTH := 200
		 , MARGIN := 6
		 , TEXT_WIDTH := PremiereTooltip.GUI_WIDTH - 2 * PremiereTooltip.MARGIN
		 , EXE := "ahk_exe Adobe Premiere Pro.exe"
		 , COLOR_SCHEME := {"BACKGROUND": "1D1D1D"
						  , "SEPARATOR": "313131"
						  , "TITLE": "2D8CEB"
						  , "DESCRIPTION": "A7A7A7"}

	__New(keybind, name, description) {
		

		fn := this.hideDescription.Bind("", hwnd, keybind)
		Hotkey % Format("~{} Up", keybind), % fn

		
	}

	__Delete() {
		Hotkey % Format("~{} Up", this.keybind), Off

		
	}

	isPremiereActive() {
		return WinActive(PremiereTooltip.EXE) && !A_CaretX
	}

	showDescription(hwnd, keybind) {
		

		Send % "{" keybind "}"
	}

	hideDescription(hwnd, keybind) {
		

		if PremiereTooltip.isPremiereActive()
			Send v
			
	}
}













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

Re: Prevents Windows Shutting Down

18 Nov 2020, 16:37

Windows often indicates what the offending program is. Handle can also be used to identify the programs that have a file open. When I have occasional issues like this, Handle can sometimes help me to pinpoint the issue.
aweinberg
Posts: 52
Joined: 08 Feb 2019, 15:38

Re: Prevents Windows Shutting Down

18 Nov 2020, 17:55

Thanks for the quick reply, I found that if instead of hitting force shutdown for AHK I canceled the shutdown and AHK had a message showing what line of the script had an error.

I deleted that line and it shuts down fine now, weird it does not show the error except on shutdown, but fixed anyway.
User avatar
mikeyww
Posts: 27372
Joined: 09 Sep 2014, 18:38

Re: Prevents Windows Shutting Down

18 Nov 2020, 18:13

OK, good. Very annoying how Microsoft does that. Yes, I also usually press "Cancel" to figure out what is happening. I guess it's better that Microsoft gives you the opportunity to do that instead of just forcing a shutdown (which it also sometimes does anyway). Sometimes there are unsaved files to be saved, etc.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot], Lpanatt, peter_ahk and 287 guests