This AHK script solves the following. apparently long-standing, problem:
https://portableapps.com/node/28953
___________________________________________________
"[...] did not close properly last time it was run and will now clean up. Please then start [...] again manually."
This is the message I get after restarting my PC and opening some apps. I know the problem is that I let Windows close the apps when I shut down my computer and it doesn't occur if I close the apps manually before the shutdown. But this isn't very cool because I often have 4 or 5 apps open.
___________________________________________________
Install AutoHotkey and edit as needed. It detects log off/restart/shutdown, closes the AppName.exes, and waits (makes the OS wait) until the AppNamePortable.exes have closed.
___________________________________________________
; OnShutdown.ahk
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn ; Recommended for catching common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
SetTitleMatchMode, 2
#SingleInstance, Force
DllCall("kernel32.dll\SetProcessShutdownParameters",UInt,0x4FF,UInt,0)
OnMessage(0x11,"WM_QUERYENDSESSION")
Return
WM_QUERYENDSESSION(wParam,lParam)
{
Process, Close, juice.exe
Process, Close, thunderbird.exe
WinKill, Opera
WinKill, Torrent 3.3
Process, WaitClose, juiceportable.exe,600
Process, WaitClose, thunderbirdportable.exe,600
Process, WaitClose, operaportable.exe,600
Process, WaitClose, utorrentportable.exe,600
ExitApp
}