Why doesn't the following code work for me. Debug says unterminated string constant
code:function OnEvent_Initialize(MessengerStart)
{
new ActiveXObject("WScript.Shell").Run("\"C:\\Program Files\Windows Media Player\wmplayer.exe"");
}
}
code:function OnEvent_Initialize(MessengerStart) {
new ActiveXObject('WScript.Shell').run('\\C:\\Program Files\\Windows Media Player\\wmplayer.exe');
}
This post was edited on 01-17-2007 at 08:31 PM by matty.
code:.Run("\"C:\\Program Files\\Windows Media Player\\wmplayer.exe\"");
PS: try not to run an application on initialize if possible. The function initialize must return as quickly as possible and should do as little as possible. Instead use SignInReady or use a timer.
This post was edited on 04-10-2007 at 05:31 PM by CookieRevised.
code:.Run("\"C:\\Program Files\\Windows Media Player\\wmplayer.exe\"");
PS: try not to run an application on initialize if possible. The function initialize must be return as quickly as possible and should do as little as possible
Thanks cookie i've changed it to OnEvent_Signin, but is there anyway to make it play automatically as well?
With the Run function you start up an application. Most applications can take parameters and depending on what parameters you enter it does different stuff.
This is no different for WMP. What you do with the Run function is the same as what you do when you manually start a sound or playlist in Windows Explorer. In that case Windows will also start up WMP with a parameter, being the playlist for example.
What you also can do is starting up the playlist itself instead of starting up the WMP application. Windows will then automatically start that file with the associated application, which is in this case WMP. This is your best method for something like this because then you don't need to worry about the correct parameters (which can be quite different than just adding the filename to the command line) and Windows will handle all the rest for you.
So instead of Run("c:\wmplayer.exe") you do Run("c:\myplaylist.wpl"). The script should of course handle the randomness itself and needs a list (or directory) to choose the list from.
This post was edited on 01-19-2007 at 01:33 PM by CookieRevised.
quote:Originally posted by CookieRevised
With the Run function you start up an application. Most applications can take parameters and depending on what parameters you enter it does different stuff.
This is no different for WMP. What you do with the Run function is the same as what you do when you manually start a sound or playlist in Windows Explorer. In that case Windows will also start up WMP with a parameter, being the playlist for example.
What you also can do is starting up the playlist itself instead of starting up the WMP application. Windows will then automatically start that file with the associated application, which is in this case WMP. This is your best method for something like this because then you don't need to worry about the correct parameters (which can be quite different than just adding the filename to the command line) and Windows will handle all the rest for you.
So instead of Run("c:\wmplayer.exe") you do Run("c:\myplaylist.wpl"). The script should of course handle the randomness itself and needs a list (or directory) to choose the list from.
Thanks cookie, very useful as usual
Why doesn't this code work then?
code:function OnEvent_Signin(){
new ActiveXObject('WScript.Shell').Run("\"C:\\Documents and Settings\\James Ross\\My Documents\\My Music\My Playlists\\Untitled Playlist.wpl\\"");
}