In an applescript, I receive one filepath that I've to open.
The filepath is in the format "/Users/xxx/my/file/to/open.xyz".
I want to open it with the default program. If it's an AVI, I need to open it with a video program, if it's an xls, with excel, ...
I tried several things without any success:
--dstfile contains the previous path
tell application "Finder"
activate
open document dstfile
end tell
-->I'm getting the error 1728, telling me that he wasn't able to get the document
tell application "Finder"
activate
open document file dstfile
end tell
--> Same here
tell application "Finder"
activate
open document POSIX file dstfile
end tell
--> Same here
I'm sure that the file exists because I do this before this code execution:
if not (exists dstfile) then
display dialog "File isn't existing"
end if
I cannot use the synthax open.xyz of to of... because I receive this as a parameter.
Please help I'm desperate :'(
Answer: Based on answers, I end up with this:
set command to "open " & quoted form of dsturl
do shell script command