SimplyMaya Forums

Welcome to the forum, feel free to ask questions here.

Home / forum / Lounges / Technical Issues / How to make Maya Menu Call extern program
Register FAQ Members List Calendar Mark Forums Read

New Thread
 
Thread Tools
Old 04-03-2006, 01:58 PM   #1
zhvirus
Registered User
 
Join Date: Mar 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to make Maya Menu Call extern program

i'v edited a mel script to add a menu to maya 6.5 on its startup.

what i want to know it that how can i Execute a external windows program
(for example, MS Word,or one written by myself) by clicking
the menu item.

can mel do this?
what about Maya API?

Who can help me?

thank you very much!
zhvirus is offline   Reply With Quote
Old 04-03-2006, 03:30 PM   #2
skywola
Registered User
 
skywola's Avatar
 
Join Date: Jan 2004
Location: Tempe, Arizona, USA
Posts: 224
Thanks: 0
Thanked 0 Times in 0 Posts
Default

system("start C:/WINNT/NOTEPAD.EXE" );

Directly from the Maya reference library . . . keywords . . ."system command" . . .
__________________
"The Sage as an Astronomer: If you still see the stars as something above you, you lack the eye of knowledge." Friedrich Nietzsche
skywola is offline   Reply With Quote
Old 06-03-2006, 03:14 PM   #3
zhvirus
Registered User
 
Join Date: Mar 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thank you !
but i still met some problem.....

it did work if i type

system("start c:\xxx\xxx.exe") in script editor

but when i put this command in my menu .mel script
like this:

global string $gMainWindow;
setParent $gMainWindow;

menu -label "Farrender";
menuItem -label "start Clent" -command "system("start c:\\xxx\\xxx.exe")";

it would even make the menu fail to create;

i thought i must be the string problem after "-command"

so i changed the last line to:

menuItem -label "start Client" -command "system(\"start c:\\xxx\\xxx.exe\")";


this time ,menu create successfully!
but when i click the menu item "start Client"
nothing happen!
no error information.....no effect...

i 'm puzzled

any kind man or woman who can help me?

Last edited by zhvirus : 06-03-2006 at 03:16 PM.
zhvirus is offline   Reply With Quote
Old 06-03-2006, 07:39 PM   #4
skywola
Registered User
 
skywola's Avatar
 
Join Date: Jan 2004
Location: Tempe, Arizona, USA
Posts: 224
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This is just a guess. because I do not have the code to try it out, but I would try this:


string $startExe = "system(\"start c:\\xxx\\xxx.exe\")";

menuItem -label "start Client" -command $startExe;


or if that does not work you might try:

string $startExe = "system(start c:\\xxx\\xxx.exe)";

menuItem -label "start Client" -command $startExe;


The backslash does not look right, it may have worked, but it looks more correct in the last example I listed. It may not even be needed.

Working with strings is a lot of fun . . . :headbang: Best bet when you get into trouble with ANY Maya commands is refer to the reference library or look online for example code.
__________________
"The Sage as an Astronomer: If you still see the stars as something above you, you lack the eye of knowledge." Friedrich Nietzsche
skywola is offline   Reply With Quote
Old 07-03-2006, 04:51 AM   #5
zhvirus
Registered User
 
Join Date: Mar 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

haha
i understand now

when we type directly in script editor

we type:
c:\\xxx\\xxx.exe

so in string we'd type like this

c:\\\\xxx\\\\xxx.exe

thank you for your help :attn:
zhvirus is offline   Reply With Quote
New Thread

« Previous Thread | Next Thread »

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Maya Hair/Polygon Error ingram_no.7 Members Lounge 13 10-12-2010 10:27 AM
Simply Maya Resources Online Miss_Nova Site News & Announcements 1 08-12-2010 08:36 PM
LayoutTools for Maya 2011 is here... ctbram Members Lounge 1 06-12-2010 10:32 PM
Open a Lightwave file in Maya 2011 radiant777 Maya Basics & Newbie Lounge 2 04-12-2010 02:45 AM

1 Month

$34

Month-to-month billing
$34/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
 
 

3 months

$87

Billing every 3 months
$29/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
Save $5 per month or $15 in total compared to monthly billing with this package.

12 months

$288

Billing every 12 months
$24/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
Save $10 per month or $120 in total compared to monthly billing with this package.

Your plan will automatically renew. You can cancel at any time via your PayPal account to avoid being charged again.

You can view the FAQ on our video plans here. You can contact us directly here. By clicking one of the buttons above, you agree to our Terms and Privacy Policy.