Author Topic: VP8, VP9, VP10, VP Physmod5, FP  (Read 14641 times)

Spyke

  • Newbie
  • *
  • Posts: 26
Re: VP8, VP9, VP10, VP Physmod5, FP
« Reply #17 on: March 02, 2016, 01:22:10 PM »
Code: [Select]
RunWait, %RunMytable%
works fine, VPlaunch close after close VP.

Spyke

  • Newbie
  • *
  • Posts: 26
Re: VP8, VP9, VP10, VP Physmod5, FP
« Reply #16 on: March 02, 2016, 12:33:06 PM »
Will give a try.

Quote
If VPlaunch.exe stay active in memory, it can't work in mGalaxy, because mGalaxy will wait for it to return.
Mh, but it works, I tried it many times with different tables and no problem.
After closing mGalaxy it stays active in taskmanager. I can restart mGalaxy and it works again.

Aeliss

  • Hero Member
  • *****
  • Posts: 915
Re: VP8, VP9, VP10, VP Physmod5, FP
« Reply #15 on: March 02, 2016, 10:33:37 AM »
If VPlaunch.exe stay active in memory, it can't work in mGalaxy, because mGalaxy will wait for it to return.

The code seem ok but you can try using

Code: [Select]
RunWait, %RunMytable%
instead of
Code: [Select]
Run, %RunMytable%

checkprocessagain:
Process, wait, %myexe%, 5.5
NewPID = %ErrorLevel% ; Save the value immediately since ErrorLevel is often changed.
if NewPID = 0
goto checkprocessagain

Process, WaitClose, %NewPID%

or
Code: [Select]
Run, %RunMytable%, , , NewPID
Process, WaitClose, %NewPID%

But I m not using AHK, so It s just suposition.
« Last Edit: March 02, 2016, 10:35:26 AM by Aeliss »

Spyke

  • Newbie
  • *
  • Posts: 26
Re: VP8, VP9, VP10, VP Physmod5, FP
« Reply #14 on: March 01, 2016, 04:26:06 PM »
Aeliss thank´s for helping me!

Only one small problem I figured out, VPlaunch.exe stays active in the background, I didn´t know why - but I´m happy, it works.
Maybe it can be solved, any idea?

Spyke

  • Newbie
  • *
  • Posts: 26
Re: VP8, VP9, VP10, VP Physmod5, FP
« Reply #13 on: March 01, 2016, 04:14:17 PM »
Hooray! Got it work  :)

It didn´t work with
Code: [Select]
RunMytable ="%myexe%" -play "%Table%”instead I have to use
Code: [Select]
RunMytable ="%myexe%" -play "%Table%
One little difference only delete " at the end.....

For those who want to use the script, here is the working scipt:
Code: [Select]
#SingleInstance force
SetTitleMatchMode 2
DetectHiddenWindows On
SetWorkingDir %A_ScriptDir%

vpt=vpt
vpx=vpx
playme=/play
editme=/Edit

Table = %1% ;Variable direct table
SplitPath, Table, Tname, Tdir, Text, Tname_no_ext, Tdrive
SplitPath, Tdir,, vpdir
If (Text=%vpt%) or (Text=%vpx%)
{
goto Tabledetected
}

Table = %2% ;Variable from PinballX or batch file personal use.
SplitPath, Table, Tname, Tdir, Text, Tname_no_ext, Tdrive
StringTrimLeft, Table, Table, 1
SplitPath, Tdir,, vpdir
StringTrimLeft, vpdir, vpdir, 1

If (Text=%vpt%) or (Text=%vpx%)
{
if playme=%1%
function=%playme%
else
function=%editme%
goto Tabledetected
}
exitapp

Tabledetected:
IfInString, Table, physmod5
{
myexe=C:\Program Files (x86)\Visual Pinball\vpinball-physmod5-accelmod.exe
}

IfInString, Table, vpx
{
myexe=C:\Program Files (x86)\Visual Pinball\vpinballx.exe
}

if myexe=
{
myexe=C:\Program Files (x86)\Visual Pinball\VPinball991.exe
}
If function=%editme%
RunMytable ="%myexe%" -Edit "%Table%
Else
RunMytable ="%myexe%" -play "%Table%

Run, %RunMytable%

checkprocessagain:
Process, wait, %myexe%, 5.5
NewPID = %ErrorLevel% ; Save the value immediately since ErrorLevel is often changed.
if NewPID = 0
goto checkprocessagain

Process, WaitClose, %NewPID%
exitapp
return
Compiled with AHK, the name must be VPlaunch.exe and must be placed in the Visual Pinball folder next to the VPinball exe files.
You have to change the following to your needs:
path and name for physmod5 exe
Code: [Select]
myexe=C:\Program Files (x86)\Visual Pinball\vpinball-physmod5-accelmod.exepath and name for vpinballx exe
Code: [Select]
myexe=C:\Program Files (x86)\Visual Pinball\vpinballx.exepath and name for standard Vpinball exe
Code: [Select]
myexe=C:\Program Files (x86)\Visual Pinball\VPinball991.exe
The table-names for vpinballx must include vpx and for Physmod5 must include physmod5. Tables for VPinballXXX must include nothing in table-name.
For mGalaxy system.xml use:
Code: [Select]
<System Type="Arcade">
    <Name>Pinball</Name>
    <AppPath>C:\Program Files (x86)\Visual Pinball\VPlaunch.exe</AppPath>
    <RomPath>C:\Program Files (x86)\Visual Pinball\Tables</RomPath>
    <SnapPath />
    <VidPath />
    <Emu selected="0">
      <Cmd id="0" name="My Pinball Script" value="&quot;%path\%file%ext&quot;" />
      <Cmd id="1" name="Future Pinball" value="/open &quot;%path\%file%ext&quot; /play /exit" />
    </Emu>
    <Extensions>.vpt,.fpt,.vpx</Extensions>
    <Active>True</Active>
    <Script>True</Script>
    <Database>False</Database>
  </System>

Aeliss

  • Hero Member
  • *****
  • Posts: 915
Re: VP8, VP9, VP10, VP Physmod5, FP
« Reply #12 on: March 01, 2016, 03:34:20 PM »
From the code VPlaunch.exe close itself when the app in myexe close.
So if you close VPinball991.exe VPlaunch will close.

But I can't understans why it don't work, the path seem good, the only problem I m seeing is a " at the end of the pat and not at the start.

After a look on some forum I have see the command line is
Code: [Select]
C:\P-ROC\vpinballx.exe -play "C:\P-ROC\games\EvilDead\EvilDead2015.vpx"
So make a try with
Code: [Select]
RunMytable ="%myexe%" -play "%Table%”
If it don't work, I can make you an autoit script, I can't test it (I have only 1 pinball application) but the code will  be easier to check.

Spyke

  • Newbie
  • *
  • Posts: 26
Re: VP8, VP9, VP10, VP Physmod5, FP
« Reply #11 on: March 01, 2016, 12:12:21 PM »
Played a little with it and I cant figure out how I create the mytable error.

the actual code is:
Code: [Select]
#SingleInstance force
SetTitleMatchMode 2
DetectHiddenWindows On
SetWorkingDir %A_ScriptDir%

vpt=vpt
vpx=vpx
playme=/play
editme=/Edit

Table = %1% ;Variable direct table
SplitPath, Table, Tname, Tdir, Text, Tname_no_ext, Tdrive
SplitPath, Tdir,, vpdir
If (Text=%vpt%) or (Text=%vpx%)
{
goto Tabledetected
}

Table = %2% ;Variable from PinballX or batch file personal use.
SplitPath, Table, Tname, Tdir, Text, Tname_no_ext, Tdrive
StringTrimLeft, Table, Table, 1
SplitPath, Tdir,, vpdir
StringTrimLeft, vpdir, vpdir, 1

If (Text=%vpt%) or (Text=%vpx%)
{
if playme=%1%
function=%playme%
else
function=%editme%
goto Tabledetected
}
exitapp

Tabledetected:
IfInString, Table, physmod5
{
myexe=C:\Program Files (x86)\Visual Pinball\vpinball-physmod5-accelmod.exe
}

IfInString, Table, vpx
{
myexe=C:\Program Files (x86)\Visual Pinball\vpinballx.exe
}

if myexe=
{
myexe=C:\Program Files (x86)\Visual Pinball\VPinball991.exe
}
If function=%editme%
RunMytable ="%myexe%" /Edit -"%Table%”
Else
RunMytable ="%myexe%" /play -"%Table%”

Run, %RunMytable%

checkprocessagain:
Process, wait, %myexe%, 5.5
NewPID = %ErrorLevel% ; Save the value immediately since ErrorLevel is often changed.
if NewPID = 0
goto checkprocessagain

Process, WaitClose, %NewPID%
exitapp
return

With this VP.exe starts, but the table didn´t start and gives the error shown in actual.jpg

After I exit mGalaxy and give ok to the error, the process VPlaunch.exe stays active and must be terminated by task manager.

Aeliss

  • Hero Member
  • *****
  • Posts: 915
Re: VP8, VP9, VP10, VP Physmod5, FP
« Reply #10 on: March 01, 2016, 10:35:49 AM »
There is a "/" to remove too with %vpdir%

But on your screenshot called "runmytable" the command is almost good, it just miss a " (or 3), all the path seems good.
If you have a space in your path you need obligatory 2 more " for path.
Can you make a c/c of your actual code pls.
« Last Edit: March 01, 2016, 10:40:38 AM by Aeliss »

Spyke

  • Newbie
  • *
  • Posts: 26
Re: VP8, VP9, VP10, VP Physmod5, FP
« Reply #9 on: February 29, 2016, 04:04:48 PM »
Like already told I´m a noob in scripting, but I think the problem is caused by file structure of Visual Pinball.
The tables located in a subfolder called "Tables", see attached picture.

Spyke

  • Newbie
  • *
  • Posts: 26
Re: VP8, VP9, VP10, VP Physmod5, FP
« Reply #8 on: February 29, 2016, 03:01:46 PM »
posted the wrong picture for runmytable, it looks the same like the others.

Spyke

  • Newbie
  • *
  • Posts: 26
Re: VP8, VP9, VP10, VP Physmod5, FP
« Reply #7 on: February 29, 2016, 02:45:11 PM »
I tried it, but didn´t get it work  >:(

Deleted %vpdir% from both RunMyTable
and get Error shown in picture without

Added quotation marks to RunMyTable
and get error shown in picture runmytable

Added quotation marks to myexe
and get error shown in picture myexe

Tried it with all versions of tables (name without anything, name within vpx, name within physmod5) and the right version of VP starts, but ends with errors. So the problem must be by starting the table itself.

I´m a little helpless.....

Aeliss

  • Hero Member
  • *****
  • Posts: 915
Re: VP8, VP9, VP10, VP Physmod5, FP
« Reply #6 on: February 29, 2016, 11:58:28 AM »
%vpdir% is the directory so as you use the complete path just use
Code: [Select]
RunMytable =%myexe% /Edit -“%Table%”
and I m not sure (I m using autoit, not autohkey) but I think it's better to use
Code: [Select]
RunMytable ="%myexe%" /Edit -“%Table%”or
Code: [Select]
myexe="C:\Program Files (x86)\Visual Pinball\VPinball991.exe"
« Last Edit: February 29, 2016, 12:00:19 PM by Aeliss »

Spyke

  • Newbie
  • *
  • Posts: 26
Re: VP8, VP9, VP10, VP Physmod5, FP
« Reply #5 on: February 28, 2016, 05:11:31 PM »
Hi Aeliss,

thank you for your answer.
I did what you told me, but didn´t get it work. I´m a noob to scripting, so be patient with me.

I changed System.xml to following:
Code: [Select]
<System Type="Arcade">
    <Name>Pinball</Name>
    <AppPath>C:\Program Files (x86)\Visual Pinball\VPlaunch.exe</AppPath>
    <RomPath>C:\Program Files (x86)\Visual Pinball\Tables</RomPath>
    <SnapPath />
    <VidPath />
    <Emu selected="0">
      <Cmd id="0" name="My Pinball Script" value="&quot;%path\%file%ext&quot;" />
      <Cmd id="1" name="Future Pinball" value="/open &quot;%path\%file%ext&quot; /play /exit" />
    </Emu>
    <Extensions>.vpt,.fpt,.vpx</Extensions>
    <Active>True</Active>
    <Script>True</Script>
    <Database>False</Database>
  </System>

And my script looks like this:
Code: [Select]
#SingleInstance force
SetTitleMatchMode 2
DetectHiddenWindows On
SetWorkingDir %A_ScriptDir%

vpt=vpt
vpx=vpx
playme=/play
editme=/Edit

Table = %1% ;Variable direct table
SplitPath, Table, Tname, Tdir, Text, Tname_no_ext, Tdrive
SplitPath, Tdir,, vpdir
If (Text=%vpt%) or (Text=%vpx%)
{
goto Tabledetected
}

Table = %2% ;Variable from PinballX or batch file personal use.
SplitPath, Table, Tname, Tdir, Text, Tname_no_ext, Tdrive
StringTrimLeft, Table, Table, 1
SplitPath, Tdir,, vpdir
StringTrimLeft, vpdir, vpdir, 1

If (Text=%vpt%) or (Text=%vpx%)
{
if playme=%1%
function=%playme%
else
function=%editme%
goto Tabledetected
}
exitapp

Tabledetected:
IfInString, Table, physmod5
{
myexe=vpinball-physmod5-accelmod.exe
}

IfInString, Table, vpx
{
myexe=vpinballx.exe
}

if myexe=
{
myexe=VPinball991.exe
}
If function=%editme%
RunMytable =%vpdir%\%myexe% /Edit -“%Table%”
Else
RunMytable =%vpdir%\%myexe% /play -“%Table%”

Run, %RunMytable%

checkprocessagain:
Process, wait, %myexe%, 5.5
NewPID = %ErrorLevel% ; Save the value immediately since ErrorLevel is often changed.
if NewPID = 0
goto checkprocessagain

Process, WaitClose, %NewPID%
exitapp
return

with this I receive the error shown in picture error1

If I change the script an add the complete pinball executable path
Code: [Select]
myexe=C:\Program Files (x86)\Visual Pinball\VPinball991.exe
I receive the error shown in picture error2.
Any ideas what I did wrong?
« Last Edit: February 28, 2016, 05:13:42 PM by Spyke »

Aeliss

  • Hero Member
  • *****
  • Posts: 915
Re: VP8, VP9, VP10, VP Physmod5, FP
« Reply #4 on: February 28, 2016, 08:14:56 AM »
Yep, no problem, and your script will work because
Quote
2 - if it doesn't close after you select the table, else mGalaxy will return in same time you load the table (mGalaxy wait for the application finish to come back).

In fact your script (exe file) stay active and wait for you close the pinball application, so during this time mGalaxy will be freezed too.

But to use it in mGalaxy it's usefull to edit the data/system.xml file in mGalaxy.
Quote
  <System Type="Arcade">
    <Name>Pinball</Name>
    <AppPath />
    <RomPath />
    <SnapPath />
    <VidPath />
    <Emu selected="0">
      <Cmd id="0" name="Visual Pinball [Script]" value="-play -&quot;%path\%file%ext&quot;" />
      <Cmd id="1" name="Future Pinball" value="/open &quot;%path\%file%ext&quot; /play /exit" />
    </Emu>
    <Extensions>.vpt,.fpt</Extensions>
    <Active>False</Active>
    <Script>True</Script>
    <Database>False</Database>
  </System>

If you select your script file as executable it will receive as command line "script.exe -play table.xxx" or "script.exe /open table.xxx /play /exit" too much useless command so you can edit (or add) theses line as
Code: [Select]
<Cmd id="0" name="My Pinball Script" value="&quot;%path\%file%ext&quot;" />
With that your script will work only with %1% param.

and you need to put the complete pinball executable path in your script if you don't want to have problem with it.

Quote
(I think it´s because of missing Pinballx files).
Exactly, you can't try it just with using it alone, you need to use command line, in cmd.exe
Code: [Select]
"d:/yourscript.exe" "d:/yourtable.xxx"

« Last Edit: February 28, 2016, 08:22:44 AM by Aeliss »

Spyke

  • Newbie
  • *
  • Posts: 26
Re: VP8, VP9, VP10, VP Physmod5, FP
« Reply #3 on: February 28, 2016, 05:09:08 AM »
Sorry for the late reply.
Tried different things, butI didn´t get it work untill now......

Let me explain what I want to do.
At the moment there are 3 different versions of Visual Pinball out there, VP9, VP10 and Physmod5. The tables only work with right version of VP.
The same for Future Pinball, there are varios version of Physmods out there.
It will be possible to manage them by adding new emulators to mGalaxy, but then I didn´t get a complete gamelist and have to switch between the different emulators. My idea is to have one gamelist in mGalaxy and start the table with the right version of VP and FP.

I found a nice AHK script for PinballX http://pinballvirtual.es/vplauncher-varias-versiones-de-visual-pinball-en-pinballx/ it´s only for VP, but maybe it can be changed to work with FP too.
I tried it and added vpx and Physmod5 to table name and start them outside of mGalaxy (by klicking the table itself) it starts up with the right version of VP, but therminates then because of missing files (I think it´s because of missing Pinballx files).
Is it possible to change the script to work with mGalaxy?
« Last Edit: February 28, 2016, 07:51:45 AM by Spyke »