Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

Print PDF Stored in Container Field - Success! And another problem.


This topic is 6049 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Okay, I've got everything working thanks to Feton's help in my previous topic. I figured out how AppleScript handles file paths (rather poorly) and adjusted my script to take this into account.

Here's my filemaker script:

pdfscript.png

and here's the AppleScript subroutine:

"set filepath to ""  & $tempfilepath[$count] & """ &



"¶tell application “Skim”¶

activate¶

        open filepath¶

        print document 1 print dialog no¶

        close document 1¶

 end tell¶"

On my computer, this works fine! The PDFs get exported, and Skim opens and prints them, no problem! On a co-worker's computer (he's running the latest 10.5, I'm running 10.4.11, both of us on Intel Macs), the PDFs are properly exported and Skim starts, but it doesn't open the files. I don't get any error message or anything. Nothing happens.

Thanks again to Fenton for helping me get this to the "mostly functional" stage. Now I've just gotta get it perfect! Thanks for any help or guesses you might be able to offer!

Posted

It's a little hard to tell. The way you've built the file path with FileMaker with steps of variables means that someone else would have to recreate that script in order to test it. I don't agree with your statement that AppleScript handles file paths poorly. It's just that FileMaker syntax paths are different. So are Unix paths. Though each has its reasons I imagine.

The one thing I don't understand is why you've removed the drive name from the path. Normally an AppleScript path includes the drive name. It works for me without the drive name, but then I'm also running 10.4.11.

I also wonder why you'd export all these PDFs to the FileMaker application folder. First, because it's going to be a mess in there, and second because some people may not have access to that folder, though that's unusual. It's easy enough in AppleScript to check for and create a folder in some other location, like the desktop.


set DT to path to desktop as text

set folderName to "some folder"

set folderPath to DT & folderName



tell application "Finder"

	if not (exists folder folderPath) then

		make new folder at desktop with properties {name:folderName}

	end if

	activate

	open folder folderPath

end tell

Posted

Hi Fenton, thanks for helping again.

Okay, it isn't fair to say that AppleScript handles file paths poorly, but in most programming languages UNIX type paths are what you use on Mac OS X. Why AppleScript needs its own special formatting for file paths I am not sure. To make scripts portable between OS 9 and OS X? Seems iffy. Anyway, that's neither here nor there. I should have said I dislike how it handles file paths, not that it does it poorly. (I guess it points to the file!)

I remove the drive name because the script won't work with it in. Skim will say the file doesn't exist. I noticed some examples of AppleScript file paths on the web omitted the drive name, so I tried it and it worked. You mentioned the fact that I put the files in the FileMaker folder before. As you can see from the code this was done intentionally and is not a problem. It is expected behaviour the users will rely on.

The main problem I am struggling with here is why does Skim (same version on my machine and his) open and print the files just fine on my computer and not his, and since neither Skim or FileMaker pops up an error message, how do I determine where to start? I've chmodded the folder and files a+xrw so I don't think it has to do with permissions. My best guess is AppleScript is different/broken in 10.5, or it has something to do with my co-worker's FileMaker client being 9.0 Pro and mine being 8.5 Advanced. Does AppleScript output error messages to a log or something? I just need some clue or guess as to why this happens.

Posted

As far as AppleScript and Unix file paths, there are mechanisms to work with either. Apple was not going to break practically every single existing AppleScript just because they switched to Unix for the core of the OS. I would say there's pros and cons to either syntax.

path to desktop

-- alias "Macintosh HD:Users:fej:Desktop:"

path to desktop as text

-- "Macintosh HD:Users:fej:Desktop:"

POSIX path of (path to desktop)

-- "/Users/fej/Desktop/"

POSIX file "/Users/fej/Desktop/"

-- file "Macintosh HD:Users:fej:Desktop:"

[The POSIX file line will instantly compile to the resulting AppleScript path.]

You can run Unix command line in AppleScript using: do shell script "command here"

You can also run AppleScript in Unix command line (if you want, which I don't :-).

You can also just get the free FileMaker plug-in zippShell, and run Unix directly in a FileMaker field.

This topic is 6049 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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