Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

I'm working on exporting my Filemaker layouts to pdf's so I can e-mail them. Since I'm not fond of getting a plugin, I'm relying heavily on applescript.

Right now, I have it setup so that the script exports the pdf to a "Quotes" folder on the users Desktop. I'm trying to rename the pdf with the following applescript.

 set newname to cell "Prospect ID" of current record

set filepath to (((path to desktop) as string) & "Quotes:temp_quote.pdf")

tell application "Finder"



if name of document file (((path to desktop) as string) & "Quotes:" & ((newname as string) & ".pdf"))exists then

		--do nothing

	else

		set name of document file filepath to ((newname as string) & ".pdf")

	end if

end tell 

I'm having a problem getting it to determine if the file its renaming to already exists. any ideas?

It's often dodgy using "exists", 'cause it kicks up an error if it doesn't exist. If you surround what you're trying with a "try" block, then it suppresses errors. It sort of depends on what the logic is, whether you want to trap for errors or not.

Also, the script wasn't happy with all the nested parentheses, perhaps trying to do too much at once. It's easier to set the long file paths into variables earlier, so it's simpler later. The following won't return an error, even if the temp file is missing entirely. Someone may have a better method, but this one's short :-)

set newname to cell "Prospect ID" of current record

set filepath to ((path to desktop as string) & "Quotes:temp_quote.pdf")

set newFile to ((path to desktop as string) & "Quotes:" & newname & ".pdf")

tell application "Finder"

try

if not (exists file newFile) then

set name of document file filepath to (newname & ".pdf")

end if

end try

end tell

With error messages:

set newname to cell "Prospect ID" of current record

set filepath to ((path to desktop as string) & "Quotes:temp_quote.pdf")

set newFile to ((path to desktop as string) & "Quotes:" & newname & ".pdf")

tell application "Finder"

try

if exists file filepath then

try

if not (exists file newFile) then

set name of document file filepath to (newname & ".pdf")

else

display dialog "The "" & newname & ".pdf" file is already there" buttons {"OK"} default button 1

end if

end try

else

display dialog "The "temp_quote.pdf" file is not there" buttons {"OK"} default button 1

end if

end try

end tell

  • Author

Fenton, Thanks for your reply.

I am using the script without error reporting, and it is working perfectly.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.