Author |
Topic  |
|
khfreiberg
Germany
1 Posts |
Posted - 06/20/2003 : 07:40:28 AM
|
What I have, are origin.c subroutines, which are linked to several file extensions via dofile.ogs. I use it to start an automated generation of a set of PDF's by drag&drop the name of a file or filelist. What I finally want, is to start origin by a script (.wsf or visual build) with one or more filenames as parameter and close it after execution. It may be simple, but I couldn't find any informations how to do it.
Any ideas? Is there a way to autostart a function and to read commandline parameters?
It would be nice, if I could save the compiled code and include it to my origin. That would speed up the call.
Best Regards and thanks for help. karl-heinz.freiberg@biotronik.de
|
|
Mike Buess
USA
3037 Posts |
Posted - 06/20/2003 : 09:22:11 AM
|
I would try to set it up using Windows associations and DDE calls to your Origin C subroutines. That would require your subroutines to be available when Origin starts up and one way to arrange that is to add your Origin C file to the System folder in your CodeBuilder workspace. To set up the associations in WinXP (should be similar in other OS's)...
>Open Windows Explorer, select Tools->Folder Options->File Types and find your extension. (If it's not listed you can add it with the New button.) >Click the Advanced button and then New to define an action. >Give the Action an easily recognizable name, like MakePDF. >For Application to perform action browse to find Origin70.exe >Check Use DDE and enter the following parameters DDE Message: MySubRoutine "%1" // use your actual subroutine name. "%1" passes the file name/path as an argument. Add any other arguments you need to the command line. Application: Origin DDE Application Not Running: (leave blank) Topic: ORG
Now your action will appear on the Windows Explorer context menu for that file type. Origin will launch if it's not already open and the LabTalk commands
doc -s; exit;
will close Origin when your routines are done.
See the first topic at labtalk.nmrtools.com for more information about creating associations in Windows.
Hope that helps.
Mike Buess Origin WebRing Member |
 |
|
Mike Buess
USA
3037 Posts |
Posted - 06/20/2003 : 2:48:37 PM
|
After reading your post more carefully it looks like I misinterpreted what you want to do. However, if the applications from which you want to start Origin can handle DDE then the general approach still might work. If not, you might get some ideas from the "Running scripts at startup" topic at http://labtalk.nmrtools.com . I've started Origin from a command box after using a batch file to create the CNF script file referred to in that discussion. A similar approach might work for you.
Mike Buess Origin WebRing Member
Edited by - Mike Buess on 06/20/2003 5:13:32 PM
Edited by - Mike Buess on 06/20/2003 5:14:32 PM |
 |
|
greg
USA
1379 Posts |
Posted - 07/15/2003 : 12:27:15 PM
|
While you can not parse the command line arguments when Origin starts, there are specific behaviors of command line arguments that you may be able to use. The -t option instructs Origin to use a certain file as the default template.
You could first create a text file with a specific name and location that contains the list of files to process. Then you could launch Origin using a command line option that specifies a custom worksheet template. (One that has ASCII options which would read in your text file nicely.) A script associated with an object on the template could be set to run on create and that script could import and process that file list. When you are done, you can run this code:
doc -s; // Clear the 'dirty' flag so Origin won't complain def timerproc { exit; // Shutdown Origin } timer 5;
to shutdown Origin.
|
 |
|
|
Topic  |
|