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}
精彩评论