I have been trying to figure out just what I am supposed to use to set a checkbox in Filemaker via applescript - I have tried 1/0, true/false, “on”/“off”, “yes”/“No”, “y”/“n”… Does anybody have a sample line of code to point the way?
Why use applescript for this?
To learn more about how checkbox fields work, make a copy of the field on the layout and then format it as NOT a checkbox field.
Go back into browse mode and try entering data by checking and unchecking items in the checkbox version. If you format the checkbox to have choices Red, Green, Blue then check Red and Blue, you will see the actual contents of the field are:
You will see that a checkox field is just a standard text field that displays data in a different way.
So to answer your question:
Set newValue to “Green”
Set OldContents to (Get data cell “MyCheckbox” of current record)
– preserves any items you may have already checked
Copy oldContents & return & newValue to cell “MyCheckbox” of current record
Checkbox fields can be misleading because they only let you see the items in the value list (Red, Green Blue in this example) but the actual contents of the field can have OTHER values.
So for instance in the non-checkbox version of the field, enter
The checkbox version of the field will only indicate Red.
Well, because I am entering data into an existing database which, in a related table, has two checkboxes: one to be checked in an address correction is requested and one to be checked if the job is priority. The only possible state for either is checked or unchecked. Now if I get the gist of your post you are telling me that the data that needs to go in the cell that corresponds to the check box is the ‘value’ it was given (ie: “Change” and “Priority”).
Just tried it and damned if it didn’t work like a charm. Thanks bfr00.
Glad it worked. Still don’t see why you’re using applescript though as standard FileMaker scripting will do this.
Ah, now I understand the question.
The reason I am doing this via applescript is because it is just one small part in a much larger automated system that starts with receiving files in an FTP directory, checking the files against an Excel list, checking the files for a variety of other criteria, making sure the requesting user is in the database, preprocessing the files, forwarding them on to Photoshop, Indesign, and/or GoLive, adding an entry in the database for that user, zipping the final work files and moving them into the users outbox, sending an automated e-mail that they are ready to pick up, cleaning out the "scratch disk and emptying the trash then checking the queue for the next job to be processed. If everything goes as planned (and it seems to be) there should be virtualy no further input from me except for adding new users into the database and setting up their FTP accounts.
Maybe this could be scripted within Filemaker more efficiently, though I really have minimal experience with that shy of a few calculated fields. Once I’m done with this project I plan on going back into it and re-writing it for increased eficiency and because I have learned so much more than when I began this about five months ago. Next on the docket is learning unix but Filemaker will be high on the list.
Nice. Looks like you’re handling a complex workflow well.