Force close utorrent before shutdown or restart?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
rogeriodec
Posts: 21
Joined: 22 Mar 2016, 18:26

Force close utorrent before shutdown or restart?

23 Oct 2016, 17:51

Windows 8.1 does not wait utorrent to close completely when the computer restarts or shuts down.
So utorrent always comes into check mode for files that are being downloaded.
I wonder if there are any script that intercepts the Windows shutdown process, forcing windows to wait for the complete closure of utorrent to only then proceed with the shutdown?
User avatar
Masonjar13
Posts: 1555
Joined: 20 Jul 2014, 10:16
Location: Не Россия
Contact:

Re: Force close utorrent before shutdown or restart?

23 Oct 2016, 21:56

Certainly.

Code: Select all

#persistent

dllCall("kernel32.dll\SetProcessShutdownParameters","UInt",0x4FF,"UInt",0)
onMessage(0x11,"WM_QUERYENDSESSION")
return

WM_QUERYENDSESSION(wParam,lParam){
    winClose, ahk_exe utorrent.exe
    winWaitClose
    return 1
}
This does not force-kill utorrent, it's a soft-close. winWaitClose will wait indefinitely for utorrent to close, then continue with the shutdown/restart.
OS: Windows 10 Pro | Editor: Notepad++
My Personal Function Library | Old Build - New Build
rogeriodec
Posts: 21
Joined: 22 Mar 2016, 18:26

Re: Force close utorrent before shutdown or restart?

25 Oct 2016, 13:12

Masonjar13 wrote:Certainly.

Code: Select all

#persistent

dllCall("kernel32.dll\SetProcessShutdownParameters","UInt",0x4FF,"UInt",0)
onMessage(0x11,"WM_QUERYENDSESSION")
return

WM_QUERYENDSESSION(wParam,lParam){
    winClose, ahk_exe utorrent.exe
    winWaitClose
    return 1
}
This does not force-kill utorrent, it's a soft-close. winWaitClose will wait indefinitely for utorrent to close, then continue with the shutdown/restart.
Thank you, but it seems that this script does not work.
It seems it is not closing utorrent before restarting computer.
Even with this script running, when I restart the computer, utorrent will verify the files that were in dowloand, that is, nothing has changed. :cry:
mikeman61

Re: Force close utorrent before shutdown or restart?

10 Jul 2017, 09:47

Old I know but I ended up here seeking the solution for a similar problem, the solution for me was enabling hidden window detection and toggling the "close to tray" option in uTorrent. So below is my working script for launching a specific online game and above that an excerpt of relevant parts:

Code: Select all

DetectHiddenWindows, On
WinClose µTorrent	;Definitely not 'uTorrent'

Code: Select all

;@ECHO OFF	this script was born a .bat, they grow up so fast :')
#NoEnv
#Warn 
#SingleInstance force
DetectHiddenWindows, On

run SpeCopy.ahk	;Separate script to switch default audio device (to SPEakers)
WinClose µTorrent	;Definitely not 'uTorrent'
run, taskkill /f /im Dropbox.exe
run, taskkill /f /im Flux.exe
run, taskkill /f /im "Google Photos Backup.exe"
run, C:\Windows\System32\powercfg.exe /s 4e878fc9... unique code for high performance mode
run, steam://rungameid/252950 ;yes very hardcore gamer I know

;taskkill /f /im "Explorer.exe"	;Used this on Laptop to squeeze even harder for performance
;taskkill /f /im "Chrome.exe"	;As above just to make sure Chrome was closed but corrupted profiles or somethign every so often, will replace with a soft close when cbf

User avatar
Masonjar13
Posts: 1555
Joined: 20 Jul 2014, 10:16
Location: Не Россия
Contact:

Re: Force close utorrent before shutdown or restart?

10 Jul 2017, 18:28

I hadn't realized that this was unsolved. For historical purposes:

You can force-close an application using Process.

Code: Select all

#persistent

dllCall("kernel32.dll\SetProcessShutdownParameters","UInt",0x4FF,"UInt",0)
onMessage(0x11,"WM_QUERYENDSESSION")
return

WM_QUERYENDSESSION(wParam,lParam){
    process,close,utorrent.exe
    return 1
}
OS: Windows 10 Pro | Editor: Notepad++
My Personal Function Library | Old Build - New Build

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Lamron750 and 246 guests