Mandu Posted August 20, 2004 Posted August 20, 2004 I have an Applescript program that loads a Filemaker database. In order to provide progress feedback, I added a global text field to the layout. The layout is visible during load, and the Applescript periodically updates the global, using tell application "FileMaker Pro" set cell theCell of database theDB to theValue end tell where theValue is the progress message. I formatted the text attributes of the field with font, size, style, alignment, and text color. At some point in the loading process, after displaying correctly for a while, the field appears to lose most of its text attribute settings, reverting from 24-point bold white to 12-point plain black (still centered, though). My understanding is that the only way to override a field layout format is to store styled text into it. Applescript tells me the that class of 'theValue' is TEXT, which I understood to be plain unstyled ASCII. Can anyone suggest what might be going on, or even isolate the problem to being in my Applescript, versus Filemaker? Thanks for your consideration, Chap
CobaltSky Posted August 21, 2004 Posted August 21, 2004 Hi, I suspect you will find that what is going on is that FileMaker's interpretation of AppleScript is that text presented by the tell instruction is in default format - ie 12-point, plain and black. That being the case, if the tell instrtuction occurs when the field is not currently displayed, the incoming data will be placed into the field and will then take on the default attributes for the field instance on the layout in which it subsequently appears. However if the field is already displayed, the explicit default text style will override the style attributes for the current layout and the text will appear in default style. Note that alignment is not part of the default attributes and is therefore not affected. Notwithstanding the above, it would be my inclination to suggest that you merely get the process started using AppleScript, then have FileMaker's native scripting take over from there, performing any further file open actions (invoking sub-routines of AppleScript as and when necessary) and posting the progress messages to the visible layout screen as it goes. AppleScript is great for picking up the threads where FileMaker's native scripting capabilities leave off, but writing text to a field is a standard function in FileMaker that need not be passed over to OS level scripting.
Mandu Posted August 21, 2004 Author Posted August 21, 2004 Notwithstanding the above, it would be my inclination to suggest that you merely get the process started using AppleScript, then have FileMaker's native scripting take over from there, performing any further file open actions (invoking sub-routines of AppleScript as and when necessary) and posting the progress messages to the visible layout screen as it goes. This has been my first adventure with Filemaker and Applescript programming, and a number of people have made this same point. I don't know how others would have undertaken this problem using FM scripting as the primary language - there's an awful lot of data manipulation as data is read from a MySQL database, written into temp files, massaged with Perl, and juggled with such niceties as variables, lists, and sorting & searching algorithms before being stored into FM. However, I took your tip, wrote a one-line FM script, set field ["gProgress", "gProgress"], which I invoke from Applescript immediately after setting cell gProgress to a progress message, and it seems to solve the problem just fine. Thanks, Chap
cjaeger Posted September 13, 2004 Posted September 13, 2004 I certainly disagree here. AppleScript would have been the perfect way to preserve text formatting when migrating from FMP6 to FMP 7, or from any other application to FMP 7. Then you would simply do a ReadAsCss() and you have most of your web page already done. FMP7 is simply ignoring the clipboard styled text info, which is completely unnecessary, since there still is an option "paste unstyled" when setting text in a field in case you want it unstyled. Strange an Apple company completely disregards Apple's programming guidelines....
Recommended Posts
This topic is 7374 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