I experience change in result depending of the manner an AppleScript is invoked in Keyboard Maestro.
Consider this simple test code:
tell application "Path Finder"
set sel_files to (get selection)
repeat with fs in sel_files
set fs1 to item 1 of fs
set m to (class of fs1 as string)
end repeat
end tell
m
When one or more files are selected the value of ‘m’ is:
“fsFile” <= Keyboard Maestro [Execute text script] (hopefully the same as execution inside AppleScript Editor)
but
More annoying changes occurs with characters including diacritic marks…
Is there a way to make the behavior of “Keyboard Maestro [Execute script file]” identical to the (more satisfying) one of “Keyboard Maestro [Execute text script]”?
Keyboard Maestro asks the osascript tool to execute the script, whether it is a text script or a compiled script.
The only reason that would make a difference would be the different environments that the script is compiled in. But I’m afraid that is all black magic as far as I am concerned. Why the system does it one way in one place and another way in another place is well beyond me. Maybe @ccstone has some clue. I don’t.
# Convert Path Finder's fsFile references into more portable aliases.
tell application "Path Finder"
set selList to selection
repeat with i in selList
set (contents of i) to (((POSIX path of i) as POSIX file) as alias)
end repeat
end tell
# Get class of items.
tell application "Finder"
repeat with i in selList
set itemClass to class of (item (i as text))
end repeat
end tell