In applescript, I get one file path that I have to open.
The path to the file is in the format /Users/xxx/my/file/to/open.xyz .
I want to open it using the default program. If it is AVI, I need to open it with a video program, if it is xls, with excel, ...
I tried several things without success:
--dstfile contains the previous path tell application "Finder" activate open document dstfile end tell
-> I get error 1728 telling me that he could not get the document
tell application "Finder" activate open document file dstfile end tell
-> same thing here
tell application "Finder" activate open document POSIX file dstfile end tell
-> same thing here
I am sure that the file exists because I do this before executing this code:
if not (exists dstfile) then display dialog "File isn't existing" end if
I cannot use synthax open.xyz from of ... because I get this as a parameter.
Please help me in despair: '(
The answer . Based on the answers, I get the following:
set command to "open " & quoted form of dsturl do shell script command
scripting applescript
J4n
source share