【问题标题】:applescript - choosed file to pathapplescript - 选择的文件到路径
【发布时间】:2013-10-05 20:07:53
【问题描述】:

我正在写一个脚本,我需要一些特别的东西:

我希望,当我选择一个带有“选择文件”的文件时,有一个变量,路径就像文本一样。我的脚本:

set thePath to choose file
display dialog "The path is: " & thePath buttons {"OK"} default button 1

所以我想看看:“路径是:Macintosh HD/user/.../file.jar”

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

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

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

非常感谢您的宝贵时间

【问题讨论】:

  • 到目前为止你得到了什么代码?另见:sscce.org

标签: path applescript


【解决方案1】:

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

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

【讨论】:

    【解决方案2】:

    也许是一个很晚的答案,但你为什么不尝试这样的事情:

    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)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-07-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-10-17
      • 2016-05-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多