[AppleScript] Débogage Action de Dossier
Le
Une Bévue

je viens de modifier une Action de Dossier "TriMobile".
et depuis cette modif elle ne marche plus.
j'ai testé, à part, l'AppleScript de cette Action de Dossier, ça roule.
(juste en commentant les lignes "on adding folder items to this_folder
after receiving added_items" et "end adding folder items to")
ma modif concerne le remplacement d'un "display dialog" par une
"notification Growl".
je pense que le problème ne vient pas du script en lui-même mais de ma
procédure de modification, ce que j'ai fait :
- Ouverture de l'application (sous ML) "Configuration des actions de
dossier" ;
- choix du script puis "Modifier le script" ;
- le script s'ouvre dans "Éditeur AppleScript"
- je fais mes modifs ;
- je ferme "Éditeur AppleScript" ;
- je ferme "Configuration des actions de dossier" ;
- je fais mon test.
le script en lui-même :
on adding folder items to this_folder after receiving added_items
set isRunning to false
set msgTxt to "Nothing to do."
tell application "System Events"
set isRunning to (count of (every process whose bundle identifier is
"com.Growl.GrowlHelperApp")) > 0
end tell
try
set msgTxt to do shell script "/Users/yt/bin/scripts/tri_mobile.rb"
end try
if isRunning then
tell application id "com.Growl.GrowlHelperApp"
-- Make a list of all the notification types
-- that this script will ever send:
set the allNotificationsList to {"TriMobile Notification", msgTxt}
-- Make a list of the notifications
-- that will be enabled by default.
-- Those not enabled by default can be enabled later
-- in the 'Applications' tab of the Growl preferences.
set the enabledNotificationsList to {"TriMobile Notification"}
-- Register our script with growl.
-- You can optionally (as here) set a default icon
-- for this script's notifications.
register as application "TriMobile" all notifications
allNotificationsList default notifications enabledNotificationsList icon
of application "Script Editor"
-- Send a Notification
notify with name "TriMobile Notification" title "TriMobile
Notification" description msgTxt application name "TriMobile"
notify with name msgTxt title "Another TriMobile Notification :) "
description "Alas — you won't see me until you enable me" application
name "TriMobile"
end tell
end if
end adding folder items to
--
L'homme est imparfait, mais ce n'est pas étonnant
quand on pense à l'époque où il a été créé.
— Alphonse Allais
et depuis cette modif elle ne marche plus.
j'ai testé, à part, l'AppleScript de cette Action de Dossier, ça roule.
(juste en commentant les lignes "on adding folder items to this_folder
after receiving added_items" et "end adding folder items to")
ma modif concerne le remplacement d'un "display dialog" par une
"notification Growl".
je pense que le problème ne vient pas du script en lui-même mais de ma
procédure de modification, ce que j'ai fait :
- Ouverture de l'application (sous ML) "Configuration des actions de
dossier" ;
- choix du script puis "Modifier le script" ;
- le script s'ouvre dans "Éditeur AppleScript"
- je fais mes modifs ;
- je ferme "Éditeur AppleScript" ;
- je ferme "Configuration des actions de dossier" ;
- je fais mon test.
le script en lui-même :
on adding folder items to this_folder after receiving added_items
set isRunning to false
set msgTxt to "Nothing to do."
tell application "System Events"
set isRunning to (count of (every process whose bundle identifier is
"com.Growl.GrowlHelperApp")) > 0
end tell
try
set msgTxt to do shell script "/Users/yt/bin/scripts/tri_mobile.rb"
end try
if isRunning then
tell application id "com.Growl.GrowlHelperApp"
-- Make a list of all the notification types
-- that this script will ever send:
set the allNotificationsList to {"TriMobile Notification", msgTxt}
-- Make a list of the notifications
-- that will be enabled by default.
-- Those not enabled by default can be enabled later
-- in the 'Applications' tab of the Growl preferences.
set the enabledNotificationsList to {"TriMobile Notification"}
-- Register our script with growl.
-- You can optionally (as here) set a default icon
-- for this script's notifications.
register as application "TriMobile" all notifications
allNotificationsList default notifications enabledNotificationsList icon
of application "Script Editor"
-- Send a Notification
notify with name "TriMobile Notification" title "TriMobile
Notification" description msgTxt application name "TriMobile"
notify with name msgTxt title "Another TriMobile Notification :) "
description "Alas — you won't see me until you enable me" application
name "TriMobile"
end tell
end if
end adding folder items to
--
L'homme est imparfait, mais ce n'est pas étonnant
quand on pense à l'époque où il a été créé.
— Alphonse Allais
Bon, j'ajoute que le fichier
~/Bibliothèque/Preferences/com.apple.FolderActions.plist me semble correct :
--
L'homme est imparfait, mais ce n'est pas étonnant
quand on pense à l'époque où il a été créé.
— Alphonse Allais
- un téléchargement restait en attente (le dossier est ~/Download) ;
- un display dialog, de l'ancienne version, restait planqué derrière
une fenêtre.
--
L'homme est imparfait, mais ce n'est pas étonnant
quand on pense à l'époque où il a été créé.
— Alphonse Allais