Menu NoStandard & Loop funktionieren zusammen nicht

Post a reply


In an effort to prevent automatic submissions, we require that you complete the following challenge.
Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :| :mrgreen: :geek: :ugeek: :arrow: :angel: :clap: :crazy: :eh: :lolno: :problem: :shh: :shifty: :sick: :silent: :think: :thumbup: :thumbdown: :salute: :wave: :wtf: :yawn: :facepalm: :bravo: :dance: :beard: :morebeard: :xmas: :HeHe: :trollface: :cookie: :rainbow: :monkeysee: :monkeysay: :happybday: :headwall: :offtopic: :superhappy: :terms: :beer:
View more smilies

BBCode is ON
[img] is OFF
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Menu NoStandard & Loop funktionieren zusammen nicht

Re: Menu NoStandard & Loop funktionieren zusammen nicht

Post by Guest » 16 May 2018, 11:31

@just me:

Perfekt, vielen Dank, läuft wie gewümscht   :D

Re: Menu NoStandard & Loop funktionieren zusammen nicht

Post by just me » 16 May 2018, 11:23

Moin,

der oberste Teil Deines Skript vor der ersten Return Anweisung nennt sich Auto-execute Section. Alles, was ohne eine Benutzeraktion oder einen Timer ausgeführt werden soll, muss in diese Sektion (oder von dort aufgerufen werden), also auch Deine Loop:

Code: Select all

#Persistent
Menu, tray, NoStandard
Menu, tray, add, Exit, ExitHandler
OnExit, ExitSub

Loop,
{
	If (A_TimeIdle < 5000) {
		Sleep, 1000
	} else {
		MsgBox, 64, For Your Information, Checkout done at %A_Hour%:%A_Min%
	}
}

return ; <<<<< Ende der auto-execute section

ExitHandler:
	ExitApp
return

ExitSub:
if A_ExitReason not in Logoff,Shutdown
{
	MsgBox, 64, For Your Information, Exit-Checkout done at %A_Hour%:%A_Min%
}
ExitApp
Für den Traytip gibt es eine eigene Option.

Und zu Deiner letzten Frage: Nein! Ein Programm, das nicht mehr geladen ist, kann auch keine MsgBox mehr anzeigen.

Menu NoStandard & Loop funktionieren zusammen nicht

Post by Slevin » 16 May 2018, 10:37

Hallo Leute,

ich bin kompletter Neuling was AHK angeht, von daher sorry für zwei vielleicht komplett simple Fragen.

Ich möchte, dass mein Script nach einer bestimmten AFK Zeit alle eingebundenen Platten auswirft. Das klappt soweit erst mal (Script gekürzt):

Code: Select all

Loop,
{
	If (A_TimeIdle < 5000) {
		Sleep, 1000
	} else {
		MsgBox, 64, For Your Information, Checkout done at %A_Hour%:%A_Min%
	}
}
Aber ich will auch, dass das kompilierte Script im Tray-Menu nur "Exit" beinhaltet, und eine OnExit Routine sicherstellt, dass im Exit-Fall die Platten ebenfalls ausgeworfen werden. Leider ist das bisher nur Wunsch, die Loop-Operation wird nicht ausgeführt:

Code: Select all

#Persistent
Menu, tray, NoStandard
Menu, tray, add, Exit, ExitHandler
OnExit, ExitSub  
return

ExitHandler:
	ExitApp
return

ExitSub:
if A_ExitReason not in Logoff,Shutdown
{
	MsgBox, 64, For Your Information, Exit-Checkout done at %A_Hour%:%A_Min%
}
ExitApp 

Loop,
{
	If (A_TimeIdle < 5000) {
		Sleep, 1000
	} else {
		MsgBox, 64, For Your Information, Checkout done at %A_Hour%:%A_Min%
	}
}
Schön wäre es auch noch, wenn man irgendwie den Tooltip von "Dateiname.exe" auf "Fantasiename" ändern könnte.

Gibt es außerdem eine Möglichkeit, das Script zu beenden obwohl die MessageBox noch am Display steht? Also eine Art Good-Bye Information zu hinterlassen, obwohl das Script selbst bereits nicht mehr im System ist.

Vielen Dank schon mal für jedwede Hilfe
Slevin

Top