Command line arguments to venple.exe?

Use this forum to post Vensim related questions.
Post Reply
Bill Harris
Junior Member
Posts: 7
Joined: Tue Mar 30, 2004 5:09 pm

Command line arguments to venple.exe?

Post by Bill Harris »

When I taught a course using Vensim last year, I created slides using LaTeX beamer, and I used something like

Code: Select all

 \href{run:model.mdl}{See the model}
to embed references to model names in the final PDF. Then I could click on the reference (typically a bit of text, but perhaps a picture) and launch a model, relying on Windows' file associations to find the program to run the model.

This year, I've moved to Linux, and I'm running Vensim under Wine. I don't know how to do what I did last year, though: I haven't found a way to do file associations in Wine, yet, so I thought I'd simply try something like

Code: Select all

 \href{run:wine venple.exe model.mdl}{See the model}
, but it doesn't appear that venple takes command line arguments such as the name of a file.

Is there a way to do what I'm trying to do -- craft a command I can run that will start Vensim and open a particular model? If it does take command line arguments, does it accept options (and what are they)? Running wine venple.exe --help (perhaps with a FQFN and with -h or -?) didn't seem to get me any information.
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post by bob@vensim.com »

Callin Vensim PLE with the model name as an argument will open it. In your example you will need to include the full path and that path can't contain spaces or must be enclosed in double quotes. Experiment a bit from the command line and you can probably get it to work.
Bill Harris
Junior Member
Posts: 7
Joined: Tue Mar 30, 2004 5:09 pm

Post by Bill Harris »

Bob, thanks. I'm getting closer. I created a small script based on http://ubuntuforums.org/archive/index.php/t-565571.html, and that let me create a Gnome Launcher that works. So I can drag a .mdl file onto the launcher and have Vensim open it. I can also right-click on a .mdl file and select Open With (my script name) and have it work. That indeed all worked because, as you say, you can indeed pass a file name as an argument to Vensim.

As best I understand it, even under Wine, I can't associate a .mdl file directly with venple.exe, as I can in Windows, and that's what I'm missing. In order to have a link in a PDF link to a file name so I can click on the link and get the model to run in Windows and in Linux (and, presumably, in OS X), I need that to happen.

The way to do that in Linux appears to be via the .mailcap file. I made a .mailcap entry that looks like

Code: Select all

text/vensim;	  	     	         wine /home/bill/.wine/drive_c/Program\ Files/Vensim/Venple.exe %s;		nametemplate=%s.mdl
[=code]

but that apparently doesn't work (with or without quotation marks around the full name of venple.exe or the full name plus the %s).  When I double-click on the file in Nautilus, it asks me if I want to open or run it.  Opening it works; I see the file in gedit, as expected.  Running it seems to do nothing.

I'll continue to research it.  While I've worked with .mailcap before, I've never worked with it at the intersection of Wine and Linux nor with the nametemplate facility, and I do know that quoting can make a difference.  If you've got any ideas, I'll accept them gladly.
Bill Harris
Junior Member
Posts: 7
Joined: Tue Mar 30, 2004 5:09 pm

Post by Bill Harris »

Or perhaps the secret is in http://linux.about.com/library/cmd/blcm ... s-mime.htm

I'll look more Monday.
Bill Harris
Junior Member
Posts: 7
Joined: Tue Mar 30, 2004 5:09 pm

Post by Bill Harris »

Here are some tips that finally worked for me. See http://www.freedesktop.org/wiki/Specifi ... gMIMETutor for a tutorial.

First, I used assogiate (http://www.kdau.com/projects/assogiate/) to make the process easier under Gnome. There are other alternatives; assogiate was available in Synaptic.

Second, I added a user type text/x-vensim with filename pattern *.mdl.

Third, I ran

Code: Select all

$ update-mime-database ~/.local/share/mime/
.

Fourth, I opened Nautilus and navigated to a .mdl file in my Linux filesystem, right-clicked on it, and selected properties. It came up as a Vensim model file (the description I had entered), and the MIME type was text/x-vensim.

Fifth, I selected the Open With tab and added the script I had created previously to start Vensim in Wine.

Sixth, I tested it by double-clicking the file in Nautilus and selecting Display, and it worked. When I selected Run, nothing happened. Actually, I think I would have been happier had it opened in gedit when I selected Open and in Vensim when I selected Run, but this is still progress. Since anything that ends in .mdl is now recognized as text/x-vensim, this works on other models, too.

Now for the final test: opening it from a PDF file.

I opened my slides (contained in the same directory) in xpdf from the command line (makes it easier to see what happens). Hovering my mouse over the link causes xpdf to show the file name. I click on it, and I see

Code: Select all

sh: myfilename.mdl: not found
in the terminal window. When I close xpdf, I see

Code: Select all

XtUngrabButton(drawArea,3,0)
Warning: Attempt to remove nonexistent passive grab

in the terminal window.

Bummer.

I try the same thing with evince. When I hover my mouse over the link, I get a popup that says

Code: Select all

Launch myfilename.mdl
. I click on the link, and nothing happens.

More bummer.

I go back to assogiate and change the MIME category to Multipurpose files, which makes the MIME type application/x-vensim.

Running update-mime-database ~/.local/share/mime doesn't seem to work. :-( Ah, I forgot to delete the text/x-vensim type. I fixed that, ran update-mime-database again, associated application/x-vensim with my script in Nautilus, and now double-clicking on a .mdl file in Nautilus opens it in Vensim. I can always right-click on it in Nautilus and select Open With Text Editor if I want to see the model text.

There's still a problem, though: clicking on the link in the PDF file still fails. If both xpdf and evince work the same way, then perhaps the problem is that *nixen expect to have to run a program, so they invoke

Code: Select all

sh myfilename.mdl
, and sh doesn't have a clue what to do with a file of type application/x-vensim.

Does anyone have a clue from this point on?

Lessons to date:

- It's possible to get (at least most of) the effect of file name extensions in Linux, if you need to. (The normal *nix approach involves magic numbers and reading the file contents to figure out file types, but file name extensions do work.)

- Using available tools (e.g., assogiate) can make life easier, for they do know where configuration files belong. In particular, *nixen are really nice in keeping a user's stuff in ~/.

- Reading things like the Gnome manual and the FreeDesktop documentation can help.

Thanks for any advice people may have. I'm a lot closer; I'm just not sure if what's separating me from success is a brick wall or a row of dandelions.

-
Bill Harris
Junior Member
Posts: 7
Joined: Tue Mar 30, 2004 5:09 pm

Post by Bill Harris »

Update: I'm still working on the problem, but it appears that all works fine when I use OO.o Impress; it's just something about beamer or the way I'm using beamer that creates the problem. I'll let you know if I learn more.
Post Reply