![]() |
Command "execute" |
Post Reply
|
| Author | |
nelly
Member
Joined: 10.Apr.2008 Points: 2 |
Post Options
Thanks(0)
Quote Reply
Topic: Command "execute"Posted: 10.Apr.2008 at 13:09 |
|
I'd like to know about examples where I can see the use of the "execute" command from a report in MetaEdit+? Specifically, I need to execute a java program with some data given by the report and need the syntax for that. Cheers,
Nelly
|
|
![]() |
|
stevek
MetaCase
Joined: 11.Mar.2008 Points: 643 |
Post Options
Thanks(0)
Quote Reply
Posted: 10.Apr.2008 at 13:46 |
|
The syntax of the MERL command is in the MetaEdit+ Workbench manual Section 5.3.5 External I/O commands, under the heading External execute. Basically it is just
external ... execute
The ... part can be any MERL commands, and their output builds up a command line to run. The syntax of the command line is whatever is appropriate on your operating system. On Windows, it's run as if you entered it in the Start | Run... box, but in the MetaEdit+ working directory. This let's you just "run" a .html file, a .rtf file, a URL etc., and Windows will open the appropriate application.
For example, for a generator to produce an HTML file named after the current graph, and then open it in a browser, you would have something like this:
filename
id '.html'
write '<html> ... </html>'
close
external
'"' id '.html"'
execute
Everything output between "filename" and "write" goes to build up the name of the file to write, in this case the identifying property of the graph (its name) plus .html, e.g. 'My Graph.html'. Everything between "write" and "close" is output to that file (i.e. the HTML content, here just a minimal example). Similarly, everything between "external" and "execute" builds up the command line to execute, in this case just the name of the file again, but surrounded by double quotes to appease Windows.
A fuller example can be seen in the "Family Tree" evaluation tutorial Section 4.3. To see more examples, just open the Generator Editor in the demo repository and do an Advanced Find (Ctrl+Shift+F) for execute in All Graph Types. For an example of executing the Java compiler and opening an HTML file to run a Java applet, see the batch file created by Watch's Autobuild in the '_create make for Windows' generator, and run by it in the '_compile and execute for Windows' generator. To run a Java program, you'll need to check the syntax from your Java installation, but it's probably something like 'java myClasses.jar' or 'javaw myClass'.
What we actually execute is the same as if in a command prompt you changed to the working directory and entered:
cmd /x /c start "" XXXXXX
where XXXXXX is the output of the ... commands above. If the command you want to run is complex or more than one line, write it to a batch file and then run the batch file:
filename 'foo.bat' write
...
close
external 'foo.bat' execute
|
|
![]() |
|
Post Reply
|
|
| Tweet |
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |