Cross Platform Scripting

11 messages Options
Embed this post
Permalink
Eric Wright-2

Cross Platform Scripting

Reply Threaded More More options
Print post
Permalink
Hi experts

Posted this to Technet as Cross Platfomr Abstraction but got zero  
responses.
Not sure how to better express it so hopefully here someone has some  
tips.

We have a 70 odd file solution that has been grown in FM6 and been  
migrated to 9 this year all on a mac platform.

I need now to take it cross platform and although layouts and look are  
done with both platforms in mind there are a number of exports and  
print scripts that have never been addressed.

Any suggestions for the quickest and most efficient way to abstract  
Get System Platform to handle the differences where needed.

By abstraction I was meaning code snippets (utility scripts) that I  
can write once then re-use wherever I know there'll be an issue.

Likewise there are levels of abstraction that can be applied up to  
where a script is unique to a context.

Normally I do something then realize I've done it three tiems in three  
scripts and think I should lift it out.

I'm thinking oythers have been down this path already and might have  
some pointers to easily generalizable snippets.

Any thoughts ?

Kind Regards
Eric
_______________________________________________
FMPexperts mailing list
[hidden email]
http://lists.ironclad.net.au/listinfo.cgi/fmpexperts-ironclad.net.au
Daniel Farnan

Re: Cross Platform Scripting

Reply Threaded More More options
Print post
Permalink
Eric,

Not sure how much help this will be, but these are the things I  
noticed the last time I took a system to Windows from a Mac:

1. Printing. OMG. There is a world of hurt here, and  
Get(SystemPlatform) just won't cut it. I found the most success by  
using FM under Windows to create a second copy of each printing layout  
(NOT duplicating, RECREATING FROM SCRATCH) with the default printer in  
FM set to the printer and tray combination that would be required by  
the layout. On occasion, this meant quitting FM, clearing the registry  
key relating to printing, setting the default Windows printer to the  
new printer and tray combination, and then relaunching FM to create  
the new layout. AFTER you have done all this you can use  
Get(SystemPlatform) to vary your printing scripts.

2. More printing. In v9 you can store more than one print setup per  
script, so it is possible to change all of your current printing  
scripts to just branch based on the Get(SystemPlatform) value. In my  
opinion, you are better off using this opportunity to abstract the  
printing process so that you call one of a small number of scripts  
that do the actual printing from all of your existing print scripts.  
That is, your existing print scripts call one script that decides,  
based on the target layout and the Get(SystemPlatform) value, which  
script to call that executes the Print Setup and Print steps. It is  
also useful to have these scripts open a new window on the target  
layout just for the purposes of printing, and close it when finished  
so that the user (hopefully) never notices that another window was  
created.

3. More printing - if all else fails, allow the user to control the  
print process if they are on Windows. I found the Mac side of things  
continued to work like a charm, and while the Windows users complained  
they recognised that it was better to have the job go to the right  
printer than to save a few seconds and have it go to the printer they  
_last_ printed to.

4. Exporting - should be mostly OK; the best setup is to set a  
variable to the path of the export file using the "file:" prefix to  
specify a path. You can use "filemac:" or "filewin:" if you have to  
define an explicit path, but you can calculate that fiarly easily. You  
might even want to set that value into a global variable on system  
startup, so that you can use the value in all of your export scripts  
without having to declare it every time, and/or you can create a  
custom function to return the appropriate value. Other than that, all  
you need to remember is to give the file a suffix (eg ".txt") so that  
it will be properly recognised under Windows.



Plan this process carefully, make heavy use of the DDR to identify  
your printing and export scripts, and test as much as possible.


--
Daniel Farnan
Developer/Consultant
DeskPower Computers Pty Ltd
http://www.deskpower.com.au

Ignorance is curable, not preventable.




On 27/10/2009, at 8:52 PM, Eric Wright wrote:

> Hi experts
>
> Posted this to Technet as Cross Platfomr Abstraction but got zero  
> responses.
> Not sure how to better express it so hopefully here someone has some  
> tips.
>
> We have a 70 odd file solution that has been grown in FM6 and been  
> migrated to 9 this year all on a mac platform.
>
> I need now to take it cross platform and although layouts and look  
> are done with both platforms in mind there are a number of exports  
> and print scripts that have never been addressed.
>
> Any suggestions for the quickest and most efficient way to abstract  
> Get System Platform to handle the differences where needed.
>
> By abstraction I was meaning code snippets (utility scripts) that I  
> can write once then re-use wherever I know there'll be an issue.
>
> Likewise there are levels of abstraction that can be applied up to  
> where a script is unique to a context.
>
> Normally I do something then realize I've done it three tiems in  
> three scripts and think I should lift it out.
>
> I'm thinking oythers have been down this path already and might have  
> some pointers to easily generalizable snippets.
>
> Any thoughts ?
>
> Kind Regards
> Eric
> _______________________________________________
> FMPexperts mailing list
> [hidden email]
> http://lists.ironclad.net.au/listinfo.cgi/fmpexperts-ironclad.net.au
>

_______________________________________________
FMPexperts mailing list
[hidden email]
http://lists.ironclad.net.au/listinfo.cgi/fmpexperts-ironclad.net.au
Darren Terry-3

Re: Cross Platform Scripting

Reply Threaded More More options
Print post
Permalink
In reply to this post by Eric Wright-2

On Oct 27, 2009, at 2:52 AM, Eric Wright wrote:

> Any suggestions for the quickest and most efficient way to abstract  
> Get System Platform to handle the differences where needed.

Hi Eric:

I don't know about utility scripts that you can lift out, because most  
of the platform-sensitive script steps are extremely context  
dependent.  For instance, Import Records and Export Records (both of  
which take a platform-sensitive path to the target file).

The biggest areas where I've seen cross-platform sensitivity in FM are:

Import Records
Export Records
Export Field Contents
Open File
    (all of which take a platform-specific path that I usually  
construct in a variable)

Print Setup
Print
    (both of which actually store both the Mac and Windows printer  
settings, but can be difficult to fix/modify without platform-specific  
versions of each, in my experience)

Then there are the platform-specific script steps, like Perform  
Applescript.

For constructing a path, I generally do this:

Set Variable [ $path ;
    Case ( Abs ( Get ( SystemPlatform )) = 1 ; "filemac:" ;  
"filewin:" ) & Get ( DesktopPath ) & "thefilename.pdf" ]

or whatever.  The point is using Abs on Get ( SystemPlatform ) to  
check for 1 (Mac).

HTH



regards,
Darren

******************************
  Darren Terry                               [hidden email]
  Pacific Data Management, Inc.              http://www.pdm-inc.com/
  111 W. St. John St.                      Phone: (408) 283-5900 x303
  Suite 404                                  Fax:   (408) 283-5903
  San Jose, CA 95113
***** FileMaker 10 Certified Developer *****

_______________________________________________
FMPexperts mailing list
[hidden email]
http://lists.ironclad.net.au/listinfo.cgi/fmpexperts-ironclad.net.au
Malcolm Fitzgerald-4

Re: Cross Platform Scripting

Reply Threaded More More options
Print post
Permalink
In reply to this post by Eric Wright-2

On 27/10/2009, at 8:52 PM, Eric Wright wrote:

> Hi experts
>
> Posted this to Technet as Cross Platfomr Abstraction but got zero  
> responses.

That is bullshit!

I responded and I have your reply.

malcolm
_______________________________________________
FMPexperts mailing list
[hidden email]
http://lists.ironclad.net.au/listinfo.cgi/fmpexperts-ironclad.net.au
Bart Bartholomay

Re: Cross Platform Scripting

Reply Threaded More More options
Print post
Permalink
Malcolm:

I don't think this is particularly useful language for this forum.  
Perhaps you'd care to rethink your phrasing?

Bart

Bart Bartholomay
HAB Marketing
3725 8th Lane
Vero Beach, FL 32960
772.299.6352
Filemaker Business Alliance
http://HABMarketing.com




On Oct 27, 2009, at 3:52 PM, Malcolm Fitzgerald wrote:

>
> On 27/10/2009, at 8:52 PM, Eric Wright wrote:
>
>> Hi experts
>>
>> Posted this to Technet as Cross Platfomr Abstraction but got zero  
>> responses.
>
> That is bullshit!
>
> I responded and I have your reply.
>
> malcolm
> _______________________________________________
> FMPexperts mailing list
> [hidden email]
> http://lists.ironclad.net.au/listinfo.cgi/fmpexperts-ironclad.net.au

_______________________________________________
FMPexperts mailing list
[hidden email]
http://lists.ironclad.net.au/listinfo.cgi/fmpexperts-ironclad.net.au
Eric Wright-2

Re: Cross Platform Scripting

Reply Threaded More More options
Print post
Permalink
In reply to this post by Eric Wright-2
Hi Daniel

Thank you for the thoroughness.
Here was I thinking no sweat, couple of globals and a utility script  
and away we go.
I'd completely forgotten printing !

No substitute for testing, testing, testing.

Re global start up variable am I correct in thinking these variables  
aren't truly global in that they don't persist across files or has  
that changed ?
In which case is a utility table in the main menu file with global  
fields and a Cartesian relationship out of favour these days ?

Kind Regards
Eric

On 27/10/2009, at 10:31 PM, [hidden email]  
wrote:

> Not sure how much help this will be, but these are the things I
> noticed the last time I took a system to Windows from a Mac:
>
> 1. Printing. OMG. There is a world of hurt here, and
> Get(SystemPlatform) just won't cut it. I found the most success by
> using FM under Windows to create a second copy of each printing layout
> (NOT duplicating, RECREATING FROM SCRATCH) with the default printer in
> FM set to the printer and tray combination that would be required by
> the layout. On occasion, this meant quitting FM, clearing the registry
> key relating to printing, setting the default Windows printer to the
> new printer and tray combination, and then relaunching FM to create
> the new layout. AFTER you have done all this you can use
> Get(SystemPlatform) to vary your printing scripts.
>
> 2. More printing. In v9 you can store more than one print setup per
> script, so it is possible to change all of your current printing
> scripts to just branch based on the Get(SystemPlatform) value. In my
> opinion, you are better off using this opportunity to abstract the
> printing process so that you call one of a small number of scripts
> that do the actual printing from all of your existing print scripts.
> That is, your existing print scripts call one script that decides,
> based on the target layout and the Get(SystemPlatform) value, which
> script to call that executes the Print Setup and Print steps. It is
> also useful to have these scripts open a new window on the target
> layout just for the purposes of printing, and close it when finished
> so that the user (hopefully) never notices that another window was
> created.
>
> 3. More printing - if all else fails, allow the user to control the
> print process if they are on Windows. I found the Mac side of things
> continued to work like a charm, and while the Windows users complained
> they recognised that it was better to have the job go to the right
> printer than to save a few seconds and have it go to the printer they
> _last_ printed to.
>
> 4. Exporting - should be mostly OK; the best setup is to set a
> variable to the path of the export file using the "file:" prefix to
> specify a path. You can use "filemac:" or "filewin:" if you have to
> define an explicit path, but you can calculate that fiarly easily. You
> might even want to set that value into a global variable on system
> startup, so that you can use the value in all of your export scripts
> without having to declare it every time, and/or you can create a
> custom function to return the appropriate value. Other than that, all
> you need to remember is to give the file a suffix (eg ".txt") so that
> it will be properly recognised under Windows.
>
>
>
> Plan this process carefully, make heavy use of the DDR to identify
> your printing and export scripts, and test as much as possible.
>
>
> --
> Daniel Farnan

_______________________________________________
FMPexperts mailing list
[hidden email]
http://lists.ironclad.net.au/listinfo.cgi/fmpexperts-ironclad.net.au
Eric Wright-2

Re: Cross Platform Scripting

Reply Threaded More More options
Print post
Permalink
In reply to this post by Eric Wright-2
whoops. Forgot the appropriate Subject. Too busy thinking.


Hi Darren,

Daniel Farnan wrote about printing. I hadn't given it a thought.

Though I didn't mention it there I've been moving more and more to  
save to pdf then encouraging users to print from that.
We have any thing up six printers as end points at our office and my  
print scripts are going to need a good going over.

Thank you for the variable definition.
I would have gone off branching the script then defining two  
variables. duh.

I'd be interested in your thoughts on Utility tables in a multi file  
solution. I recall a long thread once on FM Techtalk on variables and  
globals which possibly you were a contributor to.

Kind Regards
Eric

PS Is there a convention here on to versus bottom posting ?

On 28/10/2009, at 7:03 AM, [hidden email]  
wrote:

> On Oct 27, 2009, at 2:52 AM, Eric Wright wrote:
>
>> Any suggestions for the quickest and most efficient way to abstract  
>> Get System Platform to handle the differences where needed.
>
> Hi Eric:
>
> I don't know about utility scripts that you can lift out, because  
> most of the platform-sensitive script steps are extremely context  
> dependent.  For instance, Import Records and Export Records (both of  
> which take a platform-sensitive path to the target file).
>
> The biggest areas where I've seen cross-platform sensitivity in FM  
> are:
>
> Import Records
> Export Records
> Export Field Contents
> Open File
>  (all of which take a platform-specific path that I usually  
> construct in a variable)
>
> Print Setup
> Print
>  (both of which actually store both the Mac and Windows printer  
> settings, but can be difficult to fix/modify without platform-
> specific versions of each, in my experience)
>
> Then there are the platform-specific script steps, like Perform  
> Applescript.
>
> For constructing a path, I generally do this:
>
> Set Variable [ $path ;
>  Case ( Abs ( Get ( SystemPlatform )) = 1 ; "filemac:" ;  
> "filewin:" ) & Get ( DesktopPath ) & "thefilename.pdf" ]
>
> or whatever.  The point is using Abs on Get ( SystemPlatform ) to  
> check for 1 (Mac).
>
> HTH
>
>
>
> regards,
> Darren
>
> ******************************
> Darren Terry                               [hidden email]

_______________________________________________
FMPexperts mailing list
[hidden email]
http://lists.ironclad.net.au/listinfo.cgi/fmpexperts-ironclad.net.au
Jonathan Fletcher

Re: Cross Platform Scripting

Reply Threaded More More options
Print post
Permalink
In reply to this post by Eric Wright-2
On Oct 31, 2009, at 12:36 AM, Eric Wright wrote:

> Re global start up variable am I correct in thinking these variables  
> aren't truly global in that they don't persist across files or has  
> that changed ?
> In which case is a utility table in the main menu file with global  
> fields and a Cartesian relationship out of favour these days ?


You're right: global variables are a great reason why you might want  
to keep your solution to one file. That said, a single-record table is  
another good place to store preferences, as are global fields which,  
BTW, don't require ANY relationship to access.

j.

--
Jonathan Fletcher
FileMaker 9 & 10 Certified Developer
****NEW Ph no: 502-509-7137****

Project Foreman
NewMedia Construction Co.
[hidden email]

Kentuckiana's First FMP User Group:
Coming November 19th
Check it out in the FileMaker Louisville Blog:
http://filemakerlouisville.posterous.com





_______________________________________________
FMPexperts mailing list
[hidden email]
http://lists.ironclad.net.au/listinfo.cgi/fmpexperts-ironclad.net.au
Eric Wright-2

Re: Cross Platform Scripting

Reply Threaded More More options
Print post
Permalink
In reply to this post by Eric Wright-2
Hey Malcolm

You're quite correct. My apologies.

Ironically being someone who enjoys the precision of programming (if  
that's not too grandiose for a filemaker person) I am a shocker at  
rounding experience up or down to the nearest communicable chunk, like  
"the fish was this |__________| big" or "nobody loves me ". Both of  
which are true to feelings and complete rubbish at the same time.  
(Well not the fish :)

To be precise my zero was reflecting that the post at Technet, last I  
checked, hadn't garnered abstractions of the type Darren and Daniel  
kindly proffered.

Anyhow I genuinely apologise and shall endeavour to be precise in  
future.

Kind Regards
Eric

On 28/10/2009, at 7:03 AM, [hidden email]  
wrote:

> From: Malcolm Fitzgerald <[hidden email]>
> Date: 28 October 2009 6:52:22 AM
> To: [hidden email]
> Subject: Re: Cross Platform Scripting
> Reply-To: [hidden email]
>
>
>
> On 27/10/2009, at 8:52 PM, Eric Wright wrote:
>
>> Hi experts
>>
>> Posted this to Technet as Cross Platfomr Abstraction but got zero  
>> responses.
>
> That is bullshit!
>
> I responded and I have your reply.
>
> malcolm
>

_______________________________________________
FMPexperts mailing list
[hidden email]
http://lists.ironclad.net.au/listinfo.cgi/fmpexperts-ironclad.net.au
bfr00

Re: Cross Platform Scripting

Reply Threaded More More options
Print post
Permalink
In reply to this post by Jonathan Fletcher

On Oct 30, 2009, at 9:49 PM, Jonathan Fletcher wrote:

> On Oct 31, 2009, at 12:36 AM, Eric Wright wrote:
>
>> Re global start up variable am I correct in thinking these  
>> variables aren't truly global in that they don't persist across  
>> files or has that changed ?
>> In which case is a utility table in the main menu file with global  
>> fields and a Cartesian relationship out of favour these days ?
>
>
> You're right: global variables are a great reason why you might want  
> to keep your solution to one file. That said, a single-record table  
> is another good place to store preferences, as are global fields  
> which, BTW, don't require ANY relationship to access.
>
> j.
>
> --
> Jonathan Fletcher

And they holds true across files as well. You don't need a  
relationship to see global fields  from another file.
You do need a table occurrence, though.

Bruce Robertson
_______________________________________________
FMPexperts mailing list
[hidden email]
http://lists.ironclad.net.au/listinfo.cgi/fmpexperts-ironclad.net.au
Jonathan Fletcher

Re: Cross Platform Scripting

Reply Threaded More More options
Print post
Permalink
On Oct 31, 2009, at 1:47 AM, Bruce Robertson wrote:

>
> On Oct 30, 2009, at 9:49 PM, Jonathan Fletcher wrote:
>
>> On Oct 31, 2009, at 12:36 AM, Eric Wright wrote:
>>
>>> Re global start up variable am I correct in thinking these  
>>> variables aren't truly global in that they don't persist across  
>>> files or has that changed ?
>>> In which case is a utility table in the main menu file with global  
>>> fields and a Cartesian relationship out of favour these days ?
>>
>>
>> You're right: global variables are a great reason why you might  
>> want to keep your solution to one file. That said, a single-record  
>> table is another good place to store preferences, as are global  
>> fields which, BTW, don't require ANY relationship to access.
>>
> And they holds true across files as well. You don't need a  
> relationship to see global fields  from another file.
> You do need a table occurrence, though.


One more caveat about global fields, that you probably already know,  
is that they are session specific. You can set them in an unhosted  
file and then they default to those values when you host them. You can  
change them at will during the session, but they will default back to  
the original value upon the next log-in. What many do is to set the  
globals at startup from a single-record preferences table.

This also leads to a way to have a unique preferences record for each  
user, that saves their globals upon shutdown and sets their parameters  
into global fields upon log-in.

j.

--
Jonathan Fletcher
FileMaker 9 & 10 Certified Developer
****NEW Ph no: 502-509-7137****

Project Foreman
NewMedia Construction Co.
[hidden email]

Kentuckiana's First FMP User Group:
Coming November 19th
Check it out in the FileMaker Louisville Blog:
http://filemakerlouisville.posterous.com





_______________________________________________
FMPexperts mailing list
[hidden email]
http://lists.ironclad.net.au/listinfo.cgi/fmpexperts-ironclad.net.au