How to invoke OEpro wizard from within C# program?

12/12/2004 04:50 pm
I`m a novice C# programmer, enjoying learning the language while creating some personalised utilities.

One task I want to do within a C# program is to construct a string representing a url which I want to download using OEpro (with url macros etc.), then get the program to invoke OEpro, send the string to the New Project Wizard, and get the relevant web pages downloaded.

Can I do this? And to save me reinventing the wheel, do you have any existing simple generic code for starting up OEpro (or invoking an already runnng instance) and passing a url to the wizard? If so, I`d be really grateful for anything that would point me in the right direction here. Thanks!
12/12/2004 07:04 pm
Yes you can do this. Check out the Command Line Parameters section in the OE help file for information on how to create a project and start it downloading and exit when the download has finished. This can all be achieved with a single line.

Check out for programming info. Here is a link on how to run another program (eg. OE) from your program.

12/13/2004 09:12 am
Brilliant! Thanks, yes, I know how to start up another program from witin C#, but I`d overlooked command line parameters. Was expecting to have to use something much more complicated to get inside.

However, are there any known problems with having more than one instance of OEpro running at the same time? I might want to use this method to invoke it again, while an instance is already running.
12/13/2004 11:16 am
I haven`t tried it myself, but I would guess that if OE Pro was already running, and you called the command line to create and download another project, then OE would just add the project to the running instance and begin downloading as normal.

So there shouldn`t be any problems. Only problem is that there doesn`t appear to be any way of determining when the download have finished. Maybe Oleg could add another parameter /ExitOnDownloadFinish which will cause OE to exit when all projects have finished downloading, instead of just exiting immediately like /Exit does.

The best way to learn programming is to try things out and see what happens.

Good Luck!
Oleg Chernavin
12/14/2004 07:01 am
You can use the following parameter to create a new Project and download it:

OE.exe "/new=url=,run=true,level=3"

You may use the parameter "/close" to exit Offline Explorer a few seconds after the download is complete. This is useful if you want to download a few Projects automatically and then quit Offline Explorer to save memory and other resources. /CloseNoCountdown will force Offline Explorer to quit silently, without displaying the close countdown dialog.

Please look in the Help file for more information.

Best regards,
Oleg Chernavin
MP Staff
12/21/2004 06:38 pm
Thanks everyone! This turned out to be very straightforward and worked exceptionally well.
At the start of the code I needed:
using System.Diagnostics;
Then the necessary line of code in C# is simply;
Process.Start("OE.exe", "\"/new=url=" + textBox2.Text + ",run=true,level=3\"");
where textBox2 contains the url to be loaded using the OEpro engine.

If OE is already running, a new instance is not created; the above just adds the new project into the already-running instance. Perfect, just what I wanted to do!
Many thanks once again and have a great Christmas!
Oleg Chernavin
12/22/2004 03:56 am
I am glad that it worked for you! Merry Christmas!