Applescript combining file paths
I am using applescript with QuarkXpress and want to save a fi开发者_如何学Gole into eps format. The saving is perfectly fine, except for the location of the saved file. Here's the relevant code:
set newFileName to "e.eps"
set newFilePath to "/Users/user123"
save page 1 in (newFilePath & newFilePath) EPS format EPSFormat EPS data EPSData scale EPSScale without transparent page
This saved the file in the QuarkXpress application folder with the name "/Users/user123/e.eps". How can i avoid this? Thanks
Unfortunately, because of AppleScript's origins during the pre-Mac OS X days, it doesn't use POSIX paths by default. You can either specify the path using AppleScript's native format (Hard Drive Name:Users:user123:e.eps
) or by translating a POSIX path into an AppleScript path using (POSIX file "/Users/user123/") & "e.eps"
.
it just depends where you want to put it.
set dt to path to desktop
set newFileName to "e.eps"
set newFilePath to "" & dt & newFileName
save page 1 in (newFilePath) EPS format EPSFormat EPS data EPSData scale EPSScale without transparent page
maybe the desktop ?
精彩评论