The application might not be able to receive the data that you are sending to it. I haven't tried that with Perl, but when using it in windows, this is the equivalent of executing a windows command line and some commands will receive additional parameters (your message) and some won't.
I've tried, successfully, to open the Perl application. But then when I send a second message, this time either "Field value" or "Text", I get an immediate complaint: "<unknown> could not be found and is required to complete this operation.
BTW this is running under Windows 7 and I've noticed some change in the default folder under which some programs operate from previous Windows versions.
Amazing that a version as old as FMP 6 even works on a Windows 7 system...
Well, I tried the same thing on an XP system and it behaved the same way.
Here's my simple test script:
Send Message [ Event Specification: Program: <unknown>, Event Class: aevt, Event ID: odoc, Filename: "test.pl", Bring application to
Send Message [ Event Specification: Program: <unknown>, Event Class: aevt, Event ID: odoc, Event Text: Foo ]
The first "Send Message" successfully opens the Perl script and it starts executing in its window.
The second "Send Message" would send the program the text message "Foo", ideally through Standard Input.
But the second "Send Message" command dies aborning, giving the message: "<test.pl>" could not be found and is required to complete this operation.
Is this the way it's supposed to be used?
Can you provide an example that does (or should) work, other than a trivial "open" or "print" document - that is, an example that opens an app and then sends it a text or field value?
You do recall that I told you I've never used this with Perl.
Send message no longer exists by that name in FileMaker.
It's been replaced by Send Event.
The one example I have on hand executes a command line:
Send Event [ open document/application; "cmd.exe /C MKDIR " & Quote ( $desktopUse & $dirName & "\\" ) ]
I suspect that you are getting the error message that you are because you may need to enter a file path instead of just the file name.
I stumbled on a solution to half my problem: Don't open the application with a preliminary step; simply use one Send Message command with a text string directed at the Command interpreter, specifically "(full path)script.pl arguments".
Now that the Perl script is running, the second half of my problem is to get FM to wait until my script has generated some data to return. In the past I've cleared the clipboard, then waited for something to appear in it. But this time I'd like to avoid sullying the clipboard. Do you know any other way a separate process (my Perl script) can get the attention of the FM script?
I did you an injustice when I wrote "I stumbled..." Your suggestions informed my search, and I appreciate your help. Thank you.
That's a good question. What I've done is program in a 1 second pause in my FileMaker script when such was needed, but I am kicking off very simple batch files of just 1 to 3 command lines, so this may not be a practical way to coordinate the system.
If Perl were to create a small text file in your documents folder, it might be possible for your script to use Get (DocumentsPathListing) to check for the existance of that file.
In my previous post, I forgot that you are using FileMaker 6. I suspect that what I just described does not work in that older version.
What you can do is preserve most typical forms of copied data in a global field by pasting your data into a pair of fields at the start of your script and then you can copy the data back and the end of your script.
Paste into both a container field and a text field. Simple data will appear in the text field and graphic data will paste into the container field.
At the end, copy form the text field if it is not empty and copy from the container field if it is.