如何告诉Applescript在与脚本相同的目录中打开文件

时间:2014-10-14 17:43:50

标签: applescript

tell application "SpriteBuilder" to activate
tell application "SpriteBuilder"
    open "portrait.spritebuilder"
end tell

portrait.spritebuilder目录与脚本位于同一目录中。我想我需要一条绝对的道路,但我似乎无法让它发挥作用。我尝试过调整this的建议,但没有运气。有什么想法吗?

1 个答案:

答案 0 :(得分:2)

链接的答案应该有效。你把它放在Finder块中了吗?像这样:

tell application "Finder"
    set myFolder to container of (path to me) as text
end tell

tell application "SpriteBuilder"
    activate
    open myFolder & "portrait.spritebuilder"
end tell