Je prévois de déployer un kiosque sans clavier ni souris. Quelqu'un a-t-il une idée de la manière de permettre un arrêt sécurisé ? Je pense que le bouton d'alimentation affichera une invite utilisateur qui nécessite un clavier ou une souris. La seule chose à laquelle j'ai pensé est une touche entrée usb. C'est idiot, donc je demande de l'aide.
Réponse
Trop de publicités?
jorfus
Points
151
Trouver une réponse ici avec applescript
on idle
set i to 0
tell application "System Events"
-- Get a count of all the windows belonging to the process
set numberOfWindows to count windows of process "loginwindow"
-- Check each window for a "Shut Down" button....
repeat numberOfWindows times
set i to i + 1
-- ....and shut down if found
if exists button "Shut Down" of window i of process "loginwindow" then
click button "Shut Down" of window i of process "loginwindow"
end if
end repeat
end tell
-- How often the script checks for the window (in seconds). Change it as you see fit.
return 7
end idle
Je ne l'ai pas encore testé, mais cela semble raisonnable.
éditer
Option 2 Très simple (en supposant qu'aucune application ouverte ne demande d'abord une interaction avec l'utilisateur)
tell app "System Events" to shut down
Option 3 (variante de l'option 1)
tell application "System Events" to set the visible of every process to true
set white_list to {"Finder"}
set white_list to {"Shutdown"}
try
tell application "Finder"
set process_list to the name of every process whose visible is true
end tell
repeat with i fron 1 to (number of items in process_list)
set this_process to item i of the process_list
if this_process is not in white_list then
tell application this_process
quit
end tell
end if
end repeat
on error
tell application "finder"
shutdown
end tell
end try
delay 2
tell application "Finder"
shut down
end tell