BUG: Can't open two MDLs at same time

Use this forum to post Vensim related questions.
Post Reply
Travis
Senior Member
Posts: 181
Joined: Tue Jul 15, 2008 8:42 pm

BUG: Can't open two MDLs at same time

Post by Travis »

I have the setting to Close Active Model turned off. I used to be able to open multiple files. This doesn't seem to work any more. Not sure when it broke, but I think this was working several months ago.

macOS 15.2
Vensim 10.2.1

[attachment=0]Screenshot 2024-12-12 at 5.58.37 PM.png[/attachment]
Attachments
Screenshot 2024-12-12 at 5.58.37 PM.png
Screenshot 2024-12-12 at 5.58.37 PM.png (354.42 KiB) Viewed 5919 times
aliakhavan89
Senior Member
Posts: 193
Joined: Sun Oct 21, 2018 7:09 am
Vensim version: DSS

Re: BUG: Can't open two MDLs at same time

Post by aliakhavan89 »

Hi Travis, are you opening the new model using 'open' menu or double-clicking? Double-clicking has always been problematic but the 'open' menu works on my end

macOS 15.2
Vensim 10.2.2
Travis
Senior Member
Posts: 181
Joined: Tue Jul 15, 2008 8:42 pm

Re: BUG: Can't open two MDLs at same time

Post by Travis »

Double-clicking mostly. Maybe even cmd-O in the Finder.

So two different behaviors (meaning two different code paths) depending on how a file is opened? That is confusing for users (ie. Me!).
aliakhavan89
Senior Member
Posts: 193
Joined: Sun Oct 21, 2018 7:09 am
Vensim version: DSS

Re: BUG: Can't open two MDLs at same time

Post by aliakhavan89 »

As far as I know, yes. The only workaround for this bug is to have a Vensim session open already. We have an open discussion for it here:

viewtopic.php?t=8328&sid=bd7d2d6e04ba6b ... 0729dc4202
Administrator
Super Administrator
Posts: 4827
Joined: Wed Mar 05, 2003 3:10 am

Re: BUG: Can't open two MDLs at same time

Post by Administrator »

I'll look into this.

There are at least 4 different code paths to open a model on the Mac, possibly more.

1. File->Open.
2. Double click in Finder when Vensim is not open.
3. Double click in Finder when Vensim is open.
4. Drag a model onto the Vensim app.

Paths 2 and 3 are extremely difficult to debug as MacOS/Xcode does not provide a way to associate a debug executable with a file type.
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391

Units are important!
http://www.bbc.co.uk/news/magazine-27509559
Travis
Senior Member
Posts: 181
Joined: Tue Jul 15, 2008 8:42 pm

Re: BUG: Can't open two MDLs at same time

Post by Travis »

It seems like all the paths should call the same Vensim function, though, and that should handle all the windowing in Vensim the same. The four code paths seem to differ too early in the opening process.

I assume that each of the four paths should all do the following steps:

String model_path = SPECIFIC_WAY_TO_GET_MDL_BASED_ON_OPENING_METHOD()

VensimFunctionOpenMDL(model_path) {
Handle all the opening and windows and tab creation the same
}

But the code doesn't seem to be factored that way, since not all MDLs are handled the same way.
Administrator
Super Administrator
Posts: 4827
Joined: Wed Mar 05, 2003 3:10 am

Re: BUG: Can't open two MDLs at same time

Post by Administrator »

Of course the paths all call the same function to open a model. I'm sure you realise it's just not that simple. Passing the model via the command line is easy. Double clicking on a file, the entry point is just after the app initialises but before the main window is created. If you double click when then app and main windows are already created, there is a different path.

Everything is straightforward if the ability to debug is available. Sadly on the Mac, you don't have that luxury.

I haven't had the chance to even look at this yet. If Apple have changed something (again), that would explain it.
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391

Units are important!
http://www.bbc.co.uk/news/magazine-27509559
aliakhavan89
Senior Member
Posts: 193
Joined: Sun Oct 21, 2018 7:09 am
Vensim version: DSS

Re: BUG: Can't open two MDLs at same time

Post by aliakhavan89 »

I found a very useful workaround for this double-click issue:

1. Open Automator
2. Create a New Application
3. Add a Shell Script Action (Run Shell Script)
4. Add the following Shell Script:

Code: Select all

open -n /Applications/VensimDSSMC.app --args "$@"
5. Set Pass Input 'as argument'
Screenshot 2024-12-17 at 11.44.14 AM.png
Screenshot 2024-12-17 at 11.44.14 AM.png (883.65 KiB) Viewed 5757 times
6. Save the application as 'Vensim New Instance' (or any other name)
7. From a .mdl file: Right-click > Get Info
8. Under 'open with', select 'Vensim New Instance' and click 'Change All'

Now, double-click will open a .mdl file in a new instance without closing/replacing the previous one
Post Reply