Need help with relative paths

I want to save files on the desktop in application AS, and then move them via Finder AS. I have it all working but with absolute paths, and I need this to work from one machine to another.

Can anyone help me with relative paths? So the 1) file will be generated on any desktop? And 2) then moved to another folder relative to the desktop?

Thanks.

Is this along the lines of what you are looking for?

set deskPath to path to desktop as Unicode text
tell application "TextEdit"
	set theDoc to make new document with properties {text:"Hi, I'm a test document."}
	close theDoc saving yes saving in (deskPath & "the_doc.txt")
end tell
tell application "Finder"
	move file (deskPath & "the_doc.txt") to folder (deskPath & "newlocation:")
end tell

Just FYI: It isn’t necessary to specify a path if said path is the desktop or a folder only one level down inside it.

But this works only, if the target application is the Finder :wink: