0
set fold to "/Users/Test/Desktop/"
set file to "/Myfolder/Hi.txt"

How can I join these two variables to get my file path as "/Users/Test/Desktop//Myfolder/Hi.txt"?

1
  • Can your script be used as a contextual menu and lead to appending the folder to the path variable a simple one click? Can you provide the full code for this potentially very useful applescript? Commented Nov 2, 2016 at 9:57

2 Answers 2

5

here ya go

  set aFile to (the POSIX path of (path to desktop)) & "Myfolder/Hi.txt"
Sign up to request clarification or add additional context in comments.

Comments

1

Use the Concatenation operator to join strings:

set the folderPath to "/Users/Test/Desktop/"
set the filePath to "/Myfolder/Hi.txt"
set the fullPath to folderPath & filePath

1 Comment

this returns "/Users/Test/Desktop//Myfolder/Hi.txt" notice the double slashes you don't want that if you go with this method it will work find as long as you take out one of the slashes

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.