Triggering an OSAX's function in a tell block generates a non fatal error.
tell application "Finder"
do shell script "date +%F"
end tell
The log report is dirty :
tell application "Finder"
do shell script "date +%F"
--> error number -1708
«event ascrgdut»
--> error number -1708
do shell script "date +%F"
--> error number -10004
end tell
tell current application
do shell script "date +%F"
--> "2014-01-20"
end tell
If we really need to leave the offending instruction in the tell block we may code :
tell application "Finder"
tell me to do shell script "date +%F"
end tell
and the log report will be the clean :
tell current application
do shell script "date +%F"
--> "2014-01-20"
end tell
Here is an other example :
tell application "System Preferences"
set switchTo_loc to localized string "Switch to Space 1" from table ¬
"DefaultShortcutsTable" in bundle file ((path to system folder as text) & "Library:PreferencePanes:Keyboard.prefPane:")
end tell
The log is :
tell application "System Preferences"
path to system folder as text
--> error number -1708
«event ascrgdut»
--> error number -1708
path to system folder as text
--> "Macintosh HD:System:"
localized string "Switch to Space 1" from table "DefaultShortcutsTable" in bundle file "Macintosh HD:System:Library:PreferencePanes:Keyboard.prefPane:"
--> "Passer au Bureau 1"
end tell
In fact the culprit is not localized string, it's path to.
Run this cleaned code :
(path to system folder as text)
tell application "System Preferences"
set switchTo_loc to localized string "Switch to Space 1" from table ¬
"DefaultShortcutsTable" in bundle file (result & "Library:PreferencePanes:Keyboard.prefPane:")
end tell
This time the log in clean :
tell current application
path to system folder as text
--> "Macintosh HD:System:"
end tell
tell application "System Preferences"
localized string "Switch to Space 1" from table "DefaultShortcutsTable" in bundle file "Macintosh HD:System:Library:PreferencePanes:Keyboard.prefPane:"
--> "Passer au Bureau 1"
end tell
No need to tell me that I was able to use :
path to library folder from system domain
--> alias "Macintosh HD:System:Library:"
or
path to "sprf"
--> alias "Macintosh HD:System:Library:PreferencePanes:"
I'm aware of that ;-)
Yvan KOENIG (VALLAURIS, France) lundi 20 janvier 2014 11:32:16