dbTalk Databases Forums  

Script only works if field shows

comp.databases.filemaker comp.databases.filemaker


Discuss Script only works if field shows in the comp.databases.filemaker forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Narli
 
Posts: n/a

Default Script only works if field shows - 04-23-2004 , 12:14 PM






Hi,

I have the following Applescript:

tell application "FileMaker Pro7"
tell current record of database 1
set xyz to cell "FirstName"
end tell
end tell

This works great if I am in a layout that actually shows the field
"FirstName" I do get an error message if I trigger the script from a layout
that does not show the field. Is there any fix for this?

Thank you very much for your help

Ken


Reply With Quote
  #2  
Old   
Michael M
 
Posts: n/a

Default Re: Script only works if field shows - 04-23-2004 , 12:21 PM






Error trapping.

If [Status(CurrentLayoutName) <> "Correct Layout"
Go To Layout [Correct Layout]
Perform AppleScript
Go To Layout [Original Layout]

Narli wrote:

Quote:
Hi,

I have the following Applescript:

tell application "FileMaker Pro7"
tell current record of database 1
set xyz to cell "FirstName"
end tell
end tell

This works great if I am in a layout that actually shows the field
"FirstName" I do get an error message if I trigger the script from a layout
that does not show the field. Is there any fix for this?

Thank you very much for your help

Ken


Reply With Quote
  #3  
Old   
Narli
 
Posts: n/a

Default Re: Script only works if field shows - 04-23-2004 , 12:35 PM



Thank you for your suggestion Michael, but this is quite inelegant (and
slow) to watch filemaker switch layouts back and forth. Besides if the field
does not show in any layout then the script does not work. Any other
suggestions?

Thanks again

Ken

Quote:
Error trapping.

If [Status(CurrentLayoutName) <> "Correct Layout"
Go To Layout [Correct Layout]
Perform AppleScript
Go To Layout [Original Layout]

Narli wrote:

Hi,

I have the following Applescript:

tell application "FileMaker Pro7"
tell current record of database 1
set xyz to cell "FirstName"
end tell
end tell

This works great if I am in a layout that actually shows the field
"FirstName" I do get an error message if I trigger the script from a layout
that does not show the field. Is there any fix for this?

Thank you very much for your help

Ken



Reply With Quote
  #4  
Old   
Michael M
 
Posts: n/a

Default Re: Script only works if field shows - 04-23-2004 , 12:39 PM



Just add a Freeze Window script step to beginning of script.
Use your "all fields" layout, which should be part of all your
databases, as the Go To layout.

Michael Myett

Narli wrote:

Quote:
Thank you for your suggestion Michael, but this is quite inelegant (and
slow) to watch filemaker switch layouts back and forth. Besides if the field
does not show in any layout then the script does not work. Any other
suggestions?

Thanks again

Ken


Error trapping.

If [Status(CurrentLayoutName) <> "Correct Layout"
Go To Layout [Correct Layout]
Perform AppleScript
Go To Layout [Original Layout]

Narli wrote:


Hi,

I have the following Applescript:

tell application "FileMaker Pro7"
tell current record of database 1
set xyz to cell "FirstName"
end tell
end tell

This works great if I am in a layout that actually shows the field
"FirstName" I do get an error message if I trigger the script from a layout
that does not show the field. Is there any fix for this?

Thank you very much for your help

Ken




Reply With Quote
  #5  
Old   
Oke Fireberg
 
Posts: n/a

Default setting repeated field value - 04-23-2004 , 04:31 PM



I've got a numeric field with 5 repetitions iin a FMPro 7 database.

I want to make a script that will set the value "0" to all the
repetitions of that field in the current record.

I could of course do that by repeating
SetField (Table::Fieldname[1]; 0)
SetField (Table::Fieldname[2]; 0)
SetField (Table::Fieldname[3]; 0)
SetField (Table::Fieldname[4]; 0)
SetField (Table::Fieldname[5]; 0)

But I feel that there should be a more elegant was such as

loop
for 1 to (the number of repetitions) in Fieldname
SetField Fieldname;0
end loop

Can I do something like that?

Oke


Reply With Quote
  #6  
Old   
donbro at mac.com
 
Posts: n/a

Default Re: Script only works if field shows - 04-29-2004 , 03:10 PM



I've seen this problem too. Though switching layouts and/or hiding a
field somewhere on the layout will work, I seem to remember a similar
problem when applescripting an earlier version of Filemaker.

Try adding the magic qualifier: "cellValue of" before the cell
reference:

Change this form:

get cell "volume name" of (every record of table "Volumes" whose
(cell "volume create seconds" = 3.096480049E+9))

(* when field is not on current layout, the error is: "FileMaker Pro
7 got an error: Event not handled." *)

to this:

get cell "volume name" of (every record of table "Volumes" whose
(cellValue of cell "volume create seconds" = 3.096480049E+9))

(* even with no field on the layout, works fine *)



Michael M <mmyett (AT) hotmail (DOT) com> wrote

Quote:
Just add a Freeze Window script step to beginning of script.
Use your "all fields" layout, which should be part of all your
databases, as the Go To layout.

Michael Myett

Narli wrote:

Thank you for your suggestion Michael, but this is quite inelegant (and
slow) to watch filemaker switch layouts back and forth. Besides if the field
does not show in any layout then the script does not work. Any other
suggestions?

Thanks again

Ken


Error trapping.

If [Status(CurrentLayoutName) <> "Correct Layout"
Go To Layout [Correct Layout]
Perform AppleScript
Go To Layout [Original Layout]

Narli wrote:


Hi,

I have the following Applescript:

tell application "FileMaker Pro7"
tell current record of database 1
set xyz to cell "FirstName"
end tell
end tell

This works great if I am in a layout that actually shows the field
"FirstName" I do get an error message if I trigger the script from a layout
that does not show the field. Is there any fix for this?

Thank you very much for your help

Ken




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.