Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 3539 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hi,

 

I must apologise first up if this is not quite the correct area to post this...

 

I have written a script that extracts the information I need, and then writes the results to a PDF on a layout of choice. Works well. Problem is that I want to have it run automatically from the server at, say, 8am of a morning. The only line in the script that prevents it from running server-side (which is not a meat cut by the way  :) ) is the Save as PDF command.

 

Alternative options included running PHP, extracting it, into container field via a template etc, and by the end of the article I had a headache, so sought another option. One option was to have FmPro loaded onto the server (or another box anyway) acting as a non-attended copy of the solution running.  I have started this setup.

The next trick is to have the script run at a certain time. The OnTimer command doesn't seem to support clock times (as opposed to intervals), so I thought I might do the following... unless somebody else knows of a better option which I am more than open to.

...Setting up an OnTimer that at every 55 seconds (to allow for clock drift etc) checks the time and if (for example) the clock read 8:00am then a script would be launched.

It's a very manual task setting this up - can't think how to have a more graceful solution, but think it may work.

 

All feedback welcome. Thank you. :)

  • Like 2
Posted

Are you actually using container fields for storing PDFs? If so how many? And are you deploying on LAN only, or WAN also?

 

Personally I export the key data to postgreSQL every 5 mins and all the details once a day or once a week,

I do all the automation using crontab / imagemagik / nodeJS / SVG / HTML5

 

Using the import-XML-as-a-plug-in approach described here: http://wethecomputerabusersamongst.blogspot.com/2013/10/execute-php-script-from-filemaker-with.html

Not sure if the learning curve required is within your budget... it could give you less headache in the long run.

Posted

The next trick is to have the script run at a certain time. The OnTimer command doesn't seem to support clock times (as opposed to intervals)

 

I believe it would be much better to use OS-level scheduling for this. For example, on the Mac OS X you can use iCal to schedule the opening of a file as a recurring event, and have this file do stuff as part of its opening script.

 

 

---

BTW, I almost got a headache reading this:

 

Alternative options included running PHP, extracting it, into container field via a template etc, and by the end of the article I had a headache

 

You mention an article - but you don't provide a link. You say "extracting it, [what is "it"?] into container field [why?] via a template [what is "a template"? In which language?] etc. [ah]". I mean, really. I am convinced there are viable options to do this server side, if you so choose. Perhaps you should post another question about that.

Posted

Hi guys,

 

Thanks for the replies.

Far from criticising Filemaker, I am surprised that Save as PDF is not available at server-side, nor can automated scripting at predetermined times be done. Moving on...

 

The PDFs cannot be pre-made and stored and sent later - if that's what you meant. They have to be generated at that time, and emailed straight away. If that's not what you meant, then it's going to be a pain in the backside setting up an OS level equivalent. 

 

Just wondering... is it possible to start Filemaker executable (its a Windows box by the way) via an OS level timer, the solution checks the time, runs the script required at that time, or parse a value through to it when starting it (?), then have the script quit Filemaker again?

Any thoughts?

Posted
Just wondering... is it possible to start Filemaker executable (its a Windows box by the way) via an OS level timer, the solution checks the time, runs the script required at that time, or parse a value through to it when starting it (?), then have the script quit Filemaker again?

 

You can use OS scheduling to initiate any process - I believe I already said so. I am not sure about the details you mention here:

 

What is a "Filemaker executable"? Is it a runtime? If so, how will this help you when your data is in a served solution, which a runtime is not allowed to access?

Posted

Hi guys,

 

Thanks for the replies.

Far from criticising Filemaker, I am surprised that Save as PDF is not available at server-side, nor can automated scripting at predetermined times be done. Moving on...

 

 

Just wondering... is it possible to start Filemaker executable (its a Windows box by the way) via an OS level timer, the solution checks the time, runs the script required at that time, or parse a value through to it when starting it (?), then have the script quit Filemaker again?

Any thoughts?

I'm not sure what exactly the problem is with creating PDFs on the server (from Filemaker's point of view) but I imagine it would have to do with user processes. Long time ago, I had developers whinge and complain about the fact that Word wasn't supported on a server environment by Microsoft. It probably still isn't. This has everything todo with the fact that Word is an app that's developed for user interaction. There's heaps of dialogs that could popup and any of those would stall an automated process on the server. On the server those processes wouldn't be visible other than in task manager, and therefore you can't see the dialog presented and clear whatever it is. Which essentially means you can only forcefully kill the process. If this happens via automated, scheduled scripts, hundreds of times an hour or day, you could crash your server in no time.

 

I have similar problems when creating scheduled scripts on my FMS, especially when they need to interact with other applications (my employer is a photography company and we make use of, amongst others, ImageMagick for automating some creation processes). The amount of logging required to keep a handle on things is just not funny. Every little thing needs to be logged, just in case I need it for troubleshooting.

 

As for triggering FM from the OS, sure, no probs. Every Windows has a task scheduler that can execute FM. You can create shortcuts that load FM with a particular DB, and automatically start a script when opened. You'll have to lock down the user that logs in without a password (you can't autoenter a password afaik), so that only that machine can log in with that user. The box also needs security to make sure noone can RDP to it or walk up to it.

 

I use a tiny FM DB on each workstation which is invoked using a shortcut to it. That shortcut I can place on the start menu and on the taskbar (quick and easy access for staff, and while MS says you can't script creating a taskbar pinning, it is possible). The tiny local DB connects to my server hosted DB, which means staff don't have to choose which DB they need to open.

Reason I do it this way is so I can actually pin the shortcut to the taskbar. Other ways have all failed.

Posted

Hi guys,

 nor can automated scripting at predetermined times be done. Moving on...

 

FMS has its own scheduler to run scripts at any time you want.

Posted

A multi-response to you - thank you...

 

Comment:

When I say Filemaker executable, I mean the Filemaker Pro application itself - not a runtime.  I mean C:Program Files....fmpro.exe   and parsing something to it like (I've made this up)  /script:"Create PDF"  where this script has a Quit FMP at the end of it.  I understand that ServerSide scheduling can do this, but it comes back to the Save As PDF command not supported at that level, so came back to my original problem.

 

OlgerDiekstra:

I agree with you as to being curious why the server can't do PDFs as all possible options can be parsed and therefore no user interaction required... however... it is what it is.

Yes, to dedicated user with no password too.

 

 

Wim:

Yes, but FMS can't run the Save as PDF command so it would have to be run under FMP.

 

I think what I will do here is use Windows scheduling to launch an FMP solution with a solution, have a script check the user name (eg. "fmp_bot") then run a script dedicated to what needs to be done at that time, then quit.

 

I have taken on everything you have suggested and thank you as always.

 

Cheers,

Greg

Posted

Comment:

When I say Filemaker executable, I mean the Filemaker Pro application itself - not a runtime.  I mean C:Program Files....fmpro.exe   and parsing something to it like (I've made this up)  /script:"Create PDF"  where this script has a Quit FMP at the end of it.

 

I have a feeling this is going in a circle. Why don't you simply try my original suggestion: schedule the opening of a Filemaker file (which will in turn start the Filemaker application, if it's not already running), and set that file to run a script OnFirstWindowOpen.

 

There are a few details that you need to work out, esp. with regard to security (since you need the file to log in to your served solution). It would be best to use a dedicated user, with a dedicated privilege set - and make that privilege set very limited.

 

 

I think what I will do here is use Windows scheduling to launch an FMP solution with a solution, have a script check the user name (eg. "fmp_bot") then run a script dedicated to what needs to be done at that time, then quit.

 

I don't really follow what you mean here, but having a script check the user name (or anything, for that matter) is not good security policy.

Posted

To improve security, you could check for mac address, computername, ip address etc of the computer running the pdf script when it connects to the main database. While FM doesn't have any commands (that I know of) to do this, it's very easy using the free Base Elements plugin. The ExecuteSystemCommand is what your looking for then (https://github.com/nickorr/BaseElements-Plugin/wiki/Functions#BE_ExecuteSystemCommand).

You use the command in a variable, the variable will return the output of the command. Ie, if you tell it to run "dir" the variable will hold the results similar to when you type dir in a dos box.

Using "ipconfig/all" you can then search for the right mac address, ip address, computername, etc. You could also check for the existence of a dos variable in the same way.

Posted

To improve security, you could check for mac address, computername, ip address etc of the computer running the pdf script when it connects to the main database. While FM doesn't have any commands (that I know of) to do this,

 

If "this" means getting some data that are uniquely bound to the client's hardware, then of course Filemaker can do that natively:

 

• Get(SystemNICAddress)

• Get(SystemIPAddress)

 

and since version 12:

• Get(PersistentID)

 

I am not entirely sure that's necessary, though.

 

 

While I am at it:

 

 You'll have to lock down the user that logs in without a password (you can't autoenter a password afaik)

 

Why sure you can:

http://www.filemaker.com/help/13/fmp/en/html/create_db.8.6.html#1065743

Posted

 I mean C:Program Files....fmpro.exe   and parsing something to it like (I've made this up)  /script:"Create PDF"  

 

 

FMP has an ActiveX interface on Windows and an Applescript interface on the Mac that allow you to do this without having to rely on launching a FMP file first that has an OnFirstWindowOpen script trigger.  You may find that using ActiveX / AppleScript gives you more error reporting options if you need them.

  • 3 weeks later...
Posted

Hi Wim.

 

Sorry about the delay in reply - I've been away.

 

Thank you!  I will explore these options.  :-)

 

Cheers,

Greg

This topic is 3539 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.