To continue this topic, I have a question on task queueing.
I added the code below to several scripts.
They all have an action button that opens a Finder folder.
Of course, the folders are different for each script.
If I run 2 or more scripts one after another, clicking on their action buttons will open the same folder: the folder defined in the last ran script.
Is it possible to manage this with NSNotificationQueue
or some task management method?
use AppleScript version "2.5"
use framework "Foundation"
use scripting additions
my displayNotif("Script Debugger", "Applications", "Cliquez ici pour ouvrir le dossier de sauvegarde.")
on displayNotif(theTitle, theSub, theInfo)
set theNotif to current application's NSUserNotification's alloc()'s init()
tell theNotif
its setTitle:theTitle
its setSubtitle:theSub
its setInformativeText:theInfo
its setSoundName:"Purr"
its setHasActionButton:true
its setActionButtonTitle:"Révéler"
its setOtherButtonTitle:"Fermer"
end tell
tell current application's NSUserNotificationCenter's defaultUserNotificationCenter()
its setDelegate:me
its deliverNotification:theNotif
end tell
end displayNotif
on userNotificationCenter:theCenter shouldPresentNotification:theNotif
return yes
end userNotificationCenter:shouldPresentNotification:
on userNotificationCenter:theCenter didActivateNotification:theNotif
set thePath to current application's NSString's stringWithString:"/Applications"
set thePath to (thePath's stringByExpandingTildeInPath())
set theWorkspace to current application's NSWorkspace's sharedWorkspace()
(theWorkspace's openFile:thePath)
end userNotificationCenter:didActivateNotification: