MetaCase Homepage
Forum Home Forum Home > > MetaEdit+
  New Posts New Posts RSS Feed - Command "execute"
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Command "execute"

 Post Reply Post Reply
Author
Message
nelly View Drop Down
Member
Member
Avatar

Joined: 10.Apr.2008
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote nelly Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
stevek View Drop Down
MetaCase
MetaCase
Avatar

Joined: 11.Mar.2008
Points: 643
Post Options Post Options   Thanks (0) Thanks(0)   Quote stevek Quote  Post ReplyReply Direct Link To This Post 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
  
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.05
Copyright ©2001-2022 Web Wiz Ltd.

This page was generated in 0.016 seconds.