Digital humans the art of the digital double
Ever wanted to know how digital doubles are created in the movie industry? This course will give you an insight into how it's done.
# 1 20-01-2007 , 04:41 PM
Registered User
Join Date: Jan 2006
Posts: 65

Trying to get my pinball-MELscript to work

Hi, I'm tryng to get pinball to run with Maya by using this MELO-script:

system ("start F:\Programfiler\Windows NT\Pinball\PINBALL.EXE");

It doesn't give me any errors, but it's not giving me anything else either. Does anyone know what I'm doing wrong?

# 2 20-01-2007 , 05:05 PM
enhzflep's Avatar
Subscriber
Join Date: Oct 2006
Location: Melbourne
Posts: 313
I think your problem most likely lies with the windows command start.

Given that you're trying to open an executable file, the start is kinda redundant. You can think of the start command as being the one that windows uses to open the appropriate program for the file type when you double click on any file.

For example, if I pull up a command prompt and manually type in "start F:\cd_key.txt" notepad opens up with cd_key.txt opened up. If I issue this command via the maya system() command, like you, nothing happens and no error is thrown.

Interestingly enough. I can run an executable file with each of these:

system ("f:\install");
system ("start f:\install");
system ("start f:\install.exe");
[ the back-slash \ may also be substited with a forwards slash / ]

The syntax you're using is fine. It's something else that's up.

In the end, it may be the interaction between maya and windows that prevents this from working for you. It may just be this particular file that they don't like.

When it does work, the application is a new task with it's own memory - the memory usage for maya remains unchanged, unlike earlier versions of the command shell used.

Leading me to lean towards it being more a windows issue than one with maya itself.

S.


Last edited by enhzflep; 20-01-2007 at 05:08 PM.
# 3 20-01-2007 , 05:07 PM
enhzflep's Avatar
Subscriber
Join Date: Oct 2006
Location: Melbourne
Posts: 313
Double-post..

# 4 20-01-2007 , 05:27 PM
Registered User
Join Date: Jan 2006
Posts: 65
Hmm, ok. So there is no way I can get pinball to run in Maya with a shelf button?

# 5 20-01-2007 , 05:48 PM
enhzflep's Avatar
Subscriber
Join Date: Oct 2006
Location: Melbourne
Posts: 313
Maybe there is, maybe there is...

I've just tried a different trick, and that worked for me.

I just made a batch file that's got that command in it and then ran the batch file from inside maya.

Try this:

1) Create a new text document
2) Enter the following line

F:\Programfiler\Windows NT\Pinball\PINBALL

3) Save As "C:\RunPinball.bat"
4) try to execute this in maya

system("C:\\RunPinball.bat")
__OR___
system("C:/RunPinball")


That fixed the prob I had with the text file not opening.
Yes, I do realise there's a difference between the direction and number of slashes. This is correct.

EDIT: as is the lack of a file extension in the second instance.

Simon

# 6 20-01-2007 , 06:38 PM
Registered User
Join Date: Jan 2006
Posts: 65
Thanks alot for your help. Unfortunately:

system("C:\\RunPinball.bat");
// Result:
C:\>F:\Programfiler\Windows NT\Pinball\PINBALL
F:\Programfiler\Windows gjenkjennes ikke som en intern eller ekstern kommando,
kj›rbart program eller satsvis fil.
//
system("C:/RunPinball");
// Result:
C:\>F:\Programfiler\Windows NT\Pinball\PINBALL
F:\Programfiler\Windows gjenkjennes ikke som en intern eller ekstern kommando,
kj›rbart program eller satsvis fil.
//

"F:\Programfiler\Windows is not recognized as a blah blah blah command, executable program or file."

Even if the pinball thing would just be for fun, it could be kind of helpful to have a Photoshop-launching shelf button or something... Doesn't seem like my system is able to handle it though...

# 7 20-01-2007 , 11:30 PM
enhzflep's Avatar
Subscriber
Join Date: Oct 2006
Location: Melbourne
Posts: 313
Okay, so the batch file is being executed. The error you're getting appears to come from windows as it is executing the batch.

If it's saying that the file is not recognised as a command, this indicates to me that there's a problem somewhere else.

I not you write that Windows says:
"F:\Programfiler\Windows is not recognized......"

Notice how the path was cut off after the space in "Windows NT" - I think this is your problem. Is this an older version of windows? Perhaps the implementation of batch files used in your release doesn't like spaces in file names/paths.

You could always try it with a basic program put into a directory with a simpler name, e.g F:\Test..

But anyway, once you've used a file once that's associated with Photoshop, like a psd, you do get a button to automatically start photoshop - granted it's not a shelf button, but it's not that far away being in the attribute editor under the file name of the image file. I just use the View or Edit buttons and there I go - photoshop from maya.


EDIT:: It is more than likely the space that's causing you problems. I've just tried something else and it's worked fine.

Here's a dump of the script editor window.

system("C:/Program Files/GIMP-2.0/bin/gimp-2.2.exe");
// Result: 'C:/Program' is not recognized as an internal or external command,
operable program or batch file.
//
system("C:\\Progra~1\\GIMP-2.0\\bin\\gimp-2.2.exe");
// Result:
(gimp-2.2.exe:3460): LibGimpBase-WARNING **: gimp-2.2.exe: wire_read(): error

The Gimp then opened as it should, the gimp: wire_read():error is just something it chucked up because it was started in the wrong directory.

It looks like the solution to your problem is to USE SHORT FILENAMES. So that just means not going over 8 characters for any file or directory name, if the name's too long then use "~1" for the last 2 chars of the name or ~2 or ~3 etc if you've got a number of directory/filenames that are the same for the first 6 characters.

Okay, my last effort on the matter.
Try this

system ("F:\\Progra~1\\Window~1\\Pinball\\PINBALL.EXE" );

OR if you're lazy like me user added image

system ("F:/progra~1/window~1/pinball/pinball");

Oh, I should probably point out, that Maya stops responding until I close the program it started.....
Probly just better off with a short-cut on the desktop, anyway.

S.

# 8 21-01-2007 , 11:06 AM
Registered User
Join Date: Jan 2006
Posts: 65
Aaah, of course! The spaces. How come I didn't think of that... :blush:

It still doesn't seem to work though. No errors, but also no response from pinball.exe.

Thanks for your help though. At least I got solitaire and minesweeper to work.

A short-cut on the desktop is less fancy, but I guess that will do... For now. user added image

# 9 21-01-2007 , 11:24 AM
kbrown's Avatar
Moderator
Join Date: Sep 2002
Location: London, UK
Posts: 3,198
I'm not gonna try this but from experience the problem is most likely the back-slash character. In many programming languages it's a special so called escape character. It is used for things like line break, tabs and so on... So propably if you switch your \ to \\ it works...


Kari
- My Website
- My IMDB

Do a lot, Fail a lot and Learn a lot!
Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads