Mandu Posted October 8, 2004 Posted October 8, 2004 I want for a global field to contain an Applescript template that I can copy and modify at runtime with a FM script. How can I initialize this field? SetField doesn't like its being >253 characters. And I don't think I should simply initialize it once, manually, because it could possibly be deleted. Thanks! Chap
-Queue- Posted October 8, 2004 Posted October 8, 2004 You should be able to store up to 64K characters in a text field. Are you sure it isn't set to number?
Mandu Posted October 8, 2004 Author Posted October 8, 2004 Sorry, I wasn't really clear - the problem is how to *initialize* the field to contain the script text. One option is using SetField, but the value of the calculation to which the field is set is limited to 253 chars. I suppose I could build the value by using a series of SetFields to concatenate the full text, but I'm hoping there's an easier way. The other is to manually paste the text in via a field on a layout, but I fear losing the contents of the global somehow (like Delete All Records... I understood that globals are meaningless when there are no records). I hope that clears up my question...?
-Queue- Posted October 8, 2004 Posted October 8, 2004 You could make it an auto-enter calculation so the default text is entered whenever a new record is created. Or you could make it a global and set the default value in single-user mode. When the file is opened in multi-user mode, it will revert to its default even if changes have been made to it by users, as long as it wasn't in single-user mode when the changes were made. You can delete all records and the global will still contain its value. As long as you don't save as a clone, globals always retain their default values.
Mandu Posted October 8, 2004 Author Posted October 8, 2004 Auto-enter calculations (or data specifications) are limited to 255 chars. And I do use cloning in order to distribute updates. I think the best way would be for me to manually set the global once (it's not a user-changeable value) and use something other than cloning to distribute the "shell" of a database. Thanks for your help, Chap
-Queue- Posted October 8, 2004 Posted October 8, 2004 Each group of textual data is limited to 253 characters, but the calculation itself is not. So "<253 chars>" & "<253 chars>" & "<253 chars>" will work.
bruceR Posted October 9, 2004 Posted October 9, 2004 "Sorry, I wasn't really clear - the problem is how to *initialize* the field to contain the script text." No, I don't think that's the problem. I think you are on completely the wrong track. Put the script in a perform applescript script step. Making scripts out of concatenated text is just a big mess. Capture record data at the top of the script. Simple example: property messageField: "SomeFieldName" display dialog (cell messageField of current record)
Mandu Posted October 9, 2004 Author Posted October 9, 2004 <whacking self on side of head> Right. I really just needed a way to "pass parameters" to a Filemaker Applescript (to recall an earlier discussion), and _that's_ how to do it. Thanks a million -- the box I was thinking inside of was getting smaller and smaller. -) (Edit: hey, I'm a journeyman!)
cjaeger Posted October 9, 2004 Posted October 9, 2004 simply set the result of your calculation to text, not number. just have a look at the lower left corner of the define calc window .... ;_)
Mandu Posted October 9, 2004 Author Posted October 9, 2004 Maybe I should start another thread, but to follow up on BruceR's suggestion: Here's the code I've got now. It's part of a Perform Applescript step in a FM script which is stored in the file Enrollments.fp5. And it works fine when I run it from Enrollments. But when I run it as an external script from a script in People.fp5, I get a FM error "Object not found" at the point where it tries to access cells in the "current record". Where *is* that dang object?! People has a layout with a portal into Enrollments. When you click on a portal row, it runs a script that begins, roughly: ----- Goto Related Record[EnrollmentsByPeopleID] // same rel.ship used by the portal Perform Script[subscripts, External: Enrollments.fp5] // namely, the following script... ----- Here's how the FM script in Enrollments begins (as you can see I wasn't quite certain how specific I had to be about what app/database I was referring to). ----- property debugParameterName: "c_Debug" property fileNameParameterName: "g_ScratchFileName" global debugSwitch global scratchFileName try --tell application "Filemaker Pro" --tell database "Enrollment.fp5" set debugSwitch to (cell debugParameterName of current record) set scratchFileName to (cell fileNameParameterName of current record) --end tell -- end tell on error errMsg display dialog "BUG - couldn't fetch cells '" & debugParameterName & "' or '" & fileNameParameterName & "' from current record." & return & return & "Error=" & errMsg error end try -----
bruceR Posted October 9, 2004 Posted October 9, 2004 You have not specified a window. Therefore your applescript is acting on window 1, which is NOT Enrollment.fp5. Either put a window refresh/bring to front statement in the Enrollment.fp5 script before the perform applescript statement; or do something like this: set debugSwitch to (cell debugParameterName of current record of database "Enrollment.fp5")
Recommended Posts
This topic is 7691 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 accountSign in
Already have an account? Sign in here.
Sign In Now