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

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

Recommended Posts

Posted

My FM script has a Perform Applescript, containing the following:

-----

set debugSwitch to (cell debugParameterName of current record)

-----

From what I can guess of the FM error message ("Object not found"), the notion of 'current record' has been forgotten by this point.

In the FM script leading up to Perform Applescript, I have got:

-----

set debugSwitch to (cell debugParameterName of current record)

Set Field["g_CurrentRecordNumber", "Status(CurrentRecordNumber)"] // remember curr rec

[... a Find and a SetField, but no record deletions...]

Show All Records // make sure we're not in a found set

Go to Record["g_CurrentRecordNumber"] // option: Field Value... return to current rec

Set Field["FlagField", "1"] // set a flag in the current record

Set Field["g_GlobalField", "foo"] // set a thingie in a global field

Perform Applescript["etc"] // go and try to operate on the "current record"

-----

Have I done something here to blow the notion of a current record, or does it not even get "inherited" by an AS?

Thanks a bunch,

Chap

Posted

What you've got above is impossible. The first line is AppleScript, but it's not in a Perform AppleScript step. The rest is FileMaker.

It also sounds like you might be expecting AppleScript to "remember" something from one Perform AppleScript to the next. Nope; it has nowhere to "store" it. They are separate. And you don't need to. AppleScript can always find the current record, can always read values from FileMaker. Why are you trying to set it all ahead of time?

I think what you want to do is easy enough. Unless you have some other objective in mind. So far all we know is that you're trying to target the current record for some purpose.

Posted

"From what I can guess of the FM error message ("Object not found"), the notion of 'current record' has been forgotten by this point."

No; Fillemaker doesn't know what you're looking for. This statement is meaningless because you have not declared debugParameterName.

set debugSwitch to (cell debugParameterName of current record)

Maybe you mean this:

set debugSwitch to (cell "debugParameterName" of current record)

Posted

Okay, time out ;-)

I'm not doing a good job of explaining.

I'll attach two sccripts: PRT, and PrintConfirmLetter.

PRT is a script in Peoplle.fp5 which is triggered when you click PRT button in a portal containing related Enrollments records. PrintConfirmLetyter is a script in Enrollments.fp5 that is invoked by PRT.

There is a LOT of debugging stuff in there, no-ops and such. But exactly as it stands, it manifests the essential problem I'm having.

Archive.zip

Posted

AppleScript can always find the current record, can always read values from FileMaker.

That is what I think I;m having trouble with -- it can find the current record if I run the PrintConfirmLetter script directly (manually) from Enrollments, but it doesn't seem to be able to when I run it indirectly, as an external script, from PRT in People.fp5

Posted

BruceR pointed out that I need to explicitly address the Enrollments db when mentioning 'current record'. That helped somewhat, but i'm still far from the prize.

Let me start all over. Here is what I want to do:

-- Two dbs: PeopleDB, and EnrollmentsDB. A one-to-many relationship.

-- PeopleDB has a layout showing a person (Tom) and a portal that lists his enrollments (Math, Biology, English)

-- When you click on a portal row, MS Word creates an enrollment confirmation letter (Tom, you have been enrolled in Biology.)

How would the pros do this? This really doesn't sound complicated at all....

At the risk of obfuscating, here are what I think are a few (maybe) important gotchas.

-- MSWord's FormLetter Merge thingie can pull from FMaker, but only on the basis of a <FMField>=<constant> query.

-- That means I have to flag the enrollment record I want printed.

-- When AS tells the Finder to open the MSWord FormLetter template, Word proceeds to run asynchronously to Filemaker. Therefore there is no predictable time, from the point of view of FM, to subsequently turn off the flag. The best I can think of is, just before starting a new letter, to clear all flags in the EnrollmentDB.

Posted

Why do you want to create a Word doc? Why not just print the letter out of Filemaker? If you do need a document to attach to an email, you could also use the PDF print capabilities of OSX.

Posted

I would LOVE to print it out in Filemaker, or as PDF, or as Simpletext, or as reverse polish notation! I would love to PGP encrypt it and send it to the Mars Rover to write it in the dust. I would love to have it read aloud by Text-to-speech, or to crack the NYTimes website and post it on their front page. Anything but this!

excuse me. it's been a very bad day.

My client insists on having it created in Word. So she can edit it with little personalizations.

Posted

Well - it's pretty much there.

Qualifying "of current record" with "of database "Enrollments.fp5"" in an externally-called script was huge. That was my big Filemaker error.

As to Word, I may have been shooting myself in the foot by using the Unix 'rm' command to delete the old copy of the scratch.doc file before creating a new one from the template via the Unix 'ditto' command. Same name, different file, and doing it in the BSD layer -- it just wasn't working very well. I finally affixed a random number to the file name, and a lot of problems went away.

When Word's data merge manager retrieves data from my Enrollments DB, it creates a found set. Normally the foundset consists of the one record that I flagged for printing, but every once in a while I see that it's set to the first record in the file, and then things break (data merge manager complains that it can't find any records). Usually just trying again restores sanity.

- - -

As to trying to convince the client to make her manual edits using something else besides Word, that is part of a larger problem that I, as an unseasoned independent consultant/application-programmer, will need to get a whole lot better at. That problem may boil down to "how do you say 'no' to a client?"

Thanks for being there, you guys. It's been a long day. ;-)

Chap

This topic is 7351 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.