Path applescript-选择的文件路径

Path applescript-选择的文件路径,path,applescript,Path,Applescript,我在写剧本,我需要一些特别的东西: 我想,当我选择一个带有“choose file”的文件时,有一个变量,路径就像文本一样。我的剧本: set thePath to choose file display dialog "The path is: " & thePath buttons {"OK"} default button 1 所以我想看到:“路径是:Macintosh HD/user/../file.jar” (如果需要:选择的文件是.jar文件) 当我启动脚本时,我可以看到路

我在写剧本,我需要一些特别的东西:

我想,当我选择一个带有“choose file”的文件时,有一个变量,路径就像文本一样。我的剧本:

set thePath to choose file
display dialog "The path is: " & thePath buttons {"OK"} default button 1
所以我想看到:“路径是:Macintosh HD/user/../file.jar”

(如果需要:选择的文件是.jar文件)

当我启动脚本时,我可以看到路径

我希望你能理解我。我来自德国,英语说得不好:-)


非常感谢您抽出时间

我不知道您到底在问什么。也许是这样的?这显示了如何将文本变量添加到路径中的给定位置

set myVariable to "some text "

set thePath to (choose file) as text

set thePath1 to text 1 thru 10 of thePath
set thePath2 to text 11 thru end of thePath

set newPath to thePath1 & myVariable & thePath2

display dialog "Original path: " & thePath & return & return & "New Path: " & newPath buttons {"OK"} default button 1

也许是一个很晚的答案,但你为什么不试试这样的方法呢:

set thepath to (choose file) -- (or folder if you want to)
display dialog "The chosen path is" & thepath & "If the chosen path is ok then press the button continue." buttons {"Cancel","Continue"} default button 2 cancel button "Cancel" with title "Choose your path" with icon note -- You can make the note icon custom (search for custom applet.icns)

到目前为止你有什么代码?另见: