Using Filemaker Variables $ and $$ in a calculated Applescript

View: New views
3 Messages — Rating Filter:   Alert me  

Using Filemaker Variables $ and $$ in a calculated Applescript

by Tjebbe van Tijen via Chello :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have been trying to generate an Applescript that will be run from  
within Filemaker (Perform AppleScript)
and using a series of Variables that have been declared/filled with  
content in another script step

My first try did not work

I first run a script like

SetVariable[$$FilePath03; Value: frame::xFile03]

also giving values to the other Variales

then I try to run this calculated AppleScript

set theFile to "$FilePath01" as string
set theNewFile to "$NewFile" as string
tell application "$Application05"
        activate
        open file theFile as PDF with options {page$PDFpage, resolution:
$ResolutionDpi, name:theNewFile}
end tell

and that fails the Variable values in this calculation are not  
replaced/translated by Filemaker
This was just an experiment, before I was using a series of text  
string substitutes
to construct a full AppleScript

set theFile to "#1" as string
set theNewFile to "#2" as string
tell application "#3"
        activate
        open file theFile as PDF with options {page #4, resolution: #5,  
name:theNewFile}
end tell

As I need to use a whole series of different and slightly differing  
AppleScripts I started to make a separate table with Applescripts and  
local and.or global Variables

Any suggestions for calculating an AppleScript and passing  
(Filemaker) declared Variables to it?


Tjebbe van Tijen
Imaginary Museum Projects
Dramatizing Historical Information
http://imaginarymuseum.org




_______________________________________________
The Troi plug-list mailing list
plug-list@...
http://mail.troi.com/mailman/listinfo/plug-list_troi.com

Re: Using Filemaker Variables $ and $$ in a calculated Applescript

by Jake Traynham :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

   Your applescript calculation needs to look something like this:

"set theFile to \"" & $FilePath01 & "\" as string" etc...

You have to get FileMaker to evaluate the value of $FilePath01 and
insert it into your applescript, then FileMaker can pass the calculated
applescript onto the system for processing.

If you are having trouble figuring out the syntax or if the applescript
isn't running or something, try using a Set Field or Custom Dialog with
your calculated applescript to make sure that FileMaker is evaluating it
like you are thinking.  Then copy the calculation back into the perform
applescript step. (I hope that makes sense.)

I hope this helps,
Jake

Tjebbe van Tijen via Chello wrote:

> I have been trying to generate an Applescript that will be run from  
> within Filemaker (Perform AppleScript)
> and using a series of Variables that have been declared/filled with  
> content in another script step
>
> My first try did not work
>
> I first run a script like
>
> SetVariable[$$FilePath03; Value: frame::xFile03]
>
> also giving values to the other Variales
>
> then I try to run this calculated AppleScript
>
> set theFile to "$FilePath01" as string
> set theNewFile to "$NewFile" as string
> tell application "$Application05"
> activate
> open file theFile as PDF with options {page$PDFpage, resolution:
> $ResolutionDpi, name:theNewFile}
> end tell
>
> and that fails the Variable values in this calculation are not  
> replaced/translated by Filemaker
> This was just an experiment, before I was using a series of text  
> string substitutes
> to construct a full AppleScript
>
> set theFile to "#1" as string
> set theNewFile to "#2" as string
> tell application "#3"
> activate
> open file theFile as PDF with options {page #4, resolution: #5,  
> name:theNewFile}
> end tell
>
> As I need to use a whole series of different and slightly differing  
> AppleScripts I started to make a separate table with Applescripts and  
> local and.or global Variables
>
> Any suggestions for calculating an AppleScript and passing  
> (Filemaker) declared Variables to it?
>
>
> Tjebbe van Tijen
> Imaginary Museum Projects
> Dramatizing Historical Information
> http://imaginarymuseum.org
>
>
>
>
> _______________________________________________
> The Troi plug-list mailing list
> plug-list@...
> http://mail.troi.com/mailman/listinfo/plug-list_troi.com
>

--
Jake Traynham
Owner, CNS Plug-ins
http://www.cnsplug-ins.com/

_______________________________________________
The Troi plug-list mailing list
plug-list@...
http://mail.troi.com/mailman/listinfo/plug-list_troi.com

Variables $ and the coming of an eldorado of friendly & open codes

by Tjebbe van Tijen via Chello :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

thank you Yake

someone else form this list (thank you also Tom Spivey) send me a  
similar suggestion ...
and yes constructing a string of quotation mark delimited  text  
combined by a & does the job (with the \ marker for literal quotation  
marks)  ... I also started to use this method for formatting a shell  
script (curl) using FMP $Variables and that works fine now as well  
(very touchy on things like having a space or not).

I must say that this kind of coding is not very elegant and confusing  
to write... you easily make a mistake with the quotation marks

but this seems to be the way of Filemaker ... never wanting to allow  
its users a more neat way of formatting a script argument, it makes  
me consider other solutions, but each piece of software will confront  
one with another shortcoming in yet another corner of their script  
method -- is my guess

More concrete examples in the manual next to code syntax would help  
though

which is a remark also aimed at the builders of plug-ins (there are  
those who favor the syntax/grammar & those who like/need syntax  
combined with examples; I am of the last school)

My Filemaker Solutions are getting more & more hybrid using several  
3dParty plug-ins, applescript, perl, javascript, shel script, Image  
Events and data exchange with a whole range of applications passing  
text and images between them (Photoshop Cs3, Graphic Converter,  
Safari, Firefox, Paparazzi, Color Sync, Constrictor ... well there  
must be more)

it is more like a code assemblage, than the implementation of a  
single application

I did not yet try Panorma (that claims to become a FMP competitor)  
but I am sure that not far over the horizon is a new code-land an  
eldorado where the ars combinatoria of friendly and welcoming 'open  
codes' is the most popular sport

tjebbe


On 22-mei-2008, at 16:37, Jake Traynham wrote:

Hello,

    Your applescript calculation needs to look something like this:

"set theFile to \"" & $FilePath01 & "\" as string" etc...

You have to get FileMaker to evaluate the value of $FilePath01 and
insert it into your applescript, then FileMaker can pass the calculated
applescript onto the system for processing.

If you are having trouble figuring out the syntax or if the applescript
isn't running or something, try using a Set Field or Custom Dialog with
your calculated applescript to make sure that FileMaker is evaluating it
like you are thinking.  Then copy the calculation back into the perform
applescript step. (I hope that makes sense.)

I hope this helps,
Jake

Tjebbe van Tijen via Chello wrote:

> I have been trying to generate an Applescript that will be run from
> within Filemaker (Perform AppleScript)
> and using a series of Variables that have been declared/filled with
> content in another script step
>
> My first try did not work
>
> I first run a script like
>
> SetVariable[$$FilePath03; Value: frame::xFile03]
>
> also giving values to the other Variales
>
> then I try to run this calculated AppleScript
>
> set theFile to "$FilePath01" as string
> set theNewFile to "$NewFile" as string
> tell application "$Application05"
> activate
> open file theFile as PDF with options {page$PDFpage, resolution:
> $ResolutionDpi, name:theNewFile}
> end tell
>
> and that fails the Variable values in this calculation are not
> replaced/translated by Filemaker
> This was just an experiment, before I was using a series of text
> string substitutes
> to construct a full AppleScript
>
> set theFile to "#1" as string
> set theNewFile to "#2" as string
> tell application "#3"
> activate
> open file theFile as PDF with options {page #4, resolution: #5,
> name:theNewFile}
> end tell
>
> As I need to use a whole series of different and slightly differing
> AppleScripts I started to make a separate table with Applescripts and
> local and.or global Variables
>
> Any suggestions for calculating an AppleScript and passing
> (Filemaker) declared Variables to it?
>
>
> Tjebbe van Tijen
> Imaginary Museum Projects
> Dramatizing Historical Information
> http://imaginarymuseum.org
>
>
>
>
> _______________________________________________
> The Troi plug-list mailing list
> plug-list@...
> http://mail.troi.com/mailman/listinfo/plug-list_troi.com
>

--
Jake Traynham
Owner, CNS Plug-ins
http://www.cnsplug-ins.com/

_______________________________________________
The Troi plug-list mailing list
plug-list@...
http://mail.troi.com/mailman/listinfo/plug-list_troi.com


_______________________________________________
The Troi plug-list mailing list
plug-list@...
http://mail.troi.com/mailman/listinfo/plug-list_troi.com
LightInTheBox - Buy quality products at wholesale price!