# How To Run My Script Automatically When Maya Starts

**URL:** https://forum.highend3d.com/t/how-to-run-my-script-automatically-when-maya-starts/918
**Category:** Maya
**Tags:** mel
**Created:** [July 21, 2009, 5:53pm UTC](https://forum.highend3d.com/t/how-to-run-my-script-automatically-when-maya-starts/918 "2009-07-21T17:53:51Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![fuzin](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/f/858c86/32.png) [@fuzin](https://forum.highend3d.com/u/fuzin)
#### Post date: [July 21, 2009, 5:53pm UTC](https://forum.highend3d.com/t/how-to-run-my-script-automatically-when-maya-starts/918/1 "2009-07-21T17:53:51Z")

</div>

Hi guys can somebody tell me how to run any script automatically with maya startup..........also How to assign a hot key to my script with mel..

Thank you guys in advance.......

---

<div class="post-metadata">

### Author: ![travist](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/t/ea5d25/32.png) [@travist](https://forum.highend3d.com/u/travist)
#### Post date: [July 22, 2009, 11:52am UTC](https://forum.highend3d.com/t/how-to-run-my-script-automatically-when-maya-starts/918/2 "2009-07-22T11:52:42Z")

</div>

I don't know if there's a clean way to make a script run when Maya starts up but you might be interested in using a scriptNode. You could create a button that creates a scriptNode in your scene and have it run your script every time you open that scene.

As for creating a hotkey of your script go to Window \> Settings/Preferences \> Hotkey Editor. Go to the User Category, this is the appropriate place for user created hotkeys. Press the "New" button and give your new hotkey a name without spaces. Then you just paste your script into the command window and press "Accept".

Hope that helps ![]()

---

<div class="post-metadata">

### Author: ![fuzin](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/f/858c86/32.png) [@fuzin](https://forum.highend3d.com/u/fuzin)
#### Post date: [July 26, 2009, 6:46am UTC](https://forum.highend3d.com/t/how-to-run-my-script-automatically-when-maya-starts/918/3 "2009-07-26T06:46:49Z")

</div>

Hey Travist Thanks dear for the reply but I wanted to to assign hot key by MEL not by Hotkey editor....and I hv heard that there is a some startup script directory in maya and what ever is in there get excuted when MAYa starts.

---

<div class="post-metadata">

### Author: ![kurianos3d](https://forum.highend3d.com/user_avatar/forum.highend3d.com/kurianos3d/32/55947_2.png) [@kurianos3d](https://forum.highend3d.com/u/kurianos3d)
#### Post date: [July 28, 2009, 2:10pm UTC](https://forum.highend3d.com/t/how-to-run-my-script-automatically-when-maya-starts/918/4 "2009-07-28T14:10:18Z")

</div>

put ur code in C:/Documents and Settings/username/My Documents/maya/2008/scripts  
and create a usersetup.mel and call your scripts in usersetup.mel.  
what evr u put in usersetup.mel it will be executed while maya is starting

---

<div class="post-metadata">

### Author: ![joojaa](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/j/5daacb/32.png) [@joojaa](https://forum.highend3d.com/u/joojaa)
#### Post date: [July 31, 2009, 9:24am UTC](https://forum.highend3d.com/t/how-to-run-my-script-automatically-when-maya-starts/918/5 "2009-07-31T09:24:54Z")

</div>

QUOTE(Fuzin @ 07/26/09, 09:46 AM) [snapback]312410[/snapback]  
C:/Documents and Settings/username/My Documents/maya/2008/scripts

well the varies with operating sytsem but it does not really matter where you put it as ling as there's one (only one!) file named userSetup.mel in ANY of your defined script path directories.

To this end it can be a good idea to put:  
CODE  
{  
string $thisFile;  
$thisFile = `whatIs userSetup`;  
$thisFile = `match ":.*$" $thisFile`;  
print ("Set up user prefs from"+$thisFile+"\n");  
}

As it eases debugging in the event you have 2 files with different priorites as only one will be read! And thisway you will know which one.

Its also possible to fork out in factory scripts if you wish
