开发者

I have a path that's a variable and a generic filename, how do I tell applescript to replace the generic filename with New_Name

开发者 https://www.devze.com 2023-03-31 07:47 出处:网络
EDIT: It\'s working nowm this is the final script: tell application \"Finder\" display dialog \"new_name_dialogue\" default answer \" \"

EDIT:

It's working nowm this is the final script:

tell application "Finder"

display dialog "new_name_dialogue" default answer " "

set new_name to (text returned of result)

set Selected_Finder_Item to (folder of the front window) as text

duplicate file "Macintosh HD:x:7:n7:GTD scripting:template folder:x.txt" to Selected_Finder_Item

set Path_Of_X to Selected_Finder_Item & "x.txt" as string

set name of file Path_Of_X to (new_name as text) & ".txt"
end tell

I have a variable that is a path, it's called Selected_Finder_Item. I also have a generic file, x.txt, that's duplicated into Selected_Finder_Item. How do I make changing the name of x.txt to the variable new_name a part of the script?

This is my script:

tell a开发者_JAVA技巧pplication "Finder"

display dialog "new_name_dialogue" default answer " "

set new_name to (text returned of result)

set Selected_Finder_Item to (folder of the front window) as text

duplicate file "Macintosh HD:x:7:n7:GTD scripting:template folder:x.txt" to Selected_Finder_Item
[HERE I NEED SOMETHING THAT CHANGES THE FILE NAME OF "Selected_Finder_Item"+"x.txt" TO "new_name"]

end tell

I can't make it work. Any help would be appreciated!


This should do it...

set the name of Selected_Finder_Item to new_name

UPDATE: To set multiple variables to one variable, do something like this:

set a to {b, c, d}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号