FAQFAQ   SearchSearch   UsergroupsUsergroups   RegisterRegister   ProfileProfile    Log inLog in   RSS Feed

Code snippet to exit winamp

 
Post new topic   Reply to topic    Salling Software Forums Forum Index -> Scripting Salling Clicker for Windows
View previous topic :: View next topic  
Author Message
benco
Newbie


Joined: 08 Jan 2009
Posts: 2

PostPosted: Thu Jan 08, 2009 12:34 pm    Post subject: Code snippet to exit winamp Reply with quote

ActiveWinamp does not seem to have a Quit method so I used taskkill.

1- in the Winamp<xxx>.js script add a menu option like :
[code:1]
case 8:
_quitWinamp();
break;
[/code:1]

2- still in the script, create the _quitWinamp() and quitWA_OK functions :
[code:1]
function _quitWinamp()
{

var widget = CreateQuestionDialog( "quitWA_");
widget.textualContent = "Quit WinAmp ?"
theTerminal.Push(widget);
}

function quitWA_OK(w)
{
var command = App.eqPresetPath + "\\killwinamp.bat";

var shell = new ActiveXObject("Shell.Application");
shell.ShellExecute(command);
}
[/code:1]

3- create the the killwinamp.bat script. (To keep things simple, I put it in the EQPRESET_PATH directory)
[code:1]
taskkill /IM winamp.exe
[/code:1]

Hope this helps !!

B.
Back to top
View user's profile Send private message
feuerfuchs
Junior Member


Joined: 26 Nov 2005
Posts: 37

PostPosted: Fri Jan 09, 2009 6:59 pm    Post subject: Reply with quote

Hi benco!

thanks for your help...,
but can you explain the first part of your solution?

[i][b]case 8:
_quitWinamp();
break;[/b][/i]

have i to insert this code?

part from orininal:
[i][b]var moreMenuItems = new Array();
moreMenuItems[0] = "Show Playlist";
moreMenuItems[1] = "Browse by Artist";
moreMenuItems[2] = "Search for Artist";
moreMenuItems[3] = "Browse by Album";
moreMenuItems[4] = "Set Shuffle";
moreMenuItems[5] = "Set Repeat";
moreMenuItems[6] = "Rate Track";
moreMenuItems[7] = "Set Artwork Layout";

var moreMenuItemUUIDs = new Array();

moreMenuItemUUIDs[0] = "8669a490-82db-11da-a72b-0800200c9a66"; // Show Playlist
moreMenuItemUUIDs[1] = "4F1CEEA4-A9C1-4832-88A4-B56FFD713B29"; // Browse by Artist
moreMenuItemUUIDs[2] = "e60c0d60-82d7-11da-a72b-0800200c9a66"; // Search Artist
moreMenuItemUUIDs[3] = "4F1CEEA4-A9C1-4832-88A4-B56FFD713B31"; // Browse by Album
moreMenuItemUUIDs[4] = "7B763724-72C0-4845-BD91-5C60045EB7BA"; // Set Shuffle
moreMenuItemUUIDs[5] = "ACA4EFC9-CB70-4e27-A00E-2CB9E84FDB71"; // Set Repeat
moreMenuItemUUIDs[6] = "F894B1DF-B469-4e21-86BA-56B8E7D44C7A"; // Rate Track
moreMenuItemUUIDs[7] = ""; //Set Artwork Layout[/b]
[/i]

2.)
What is the EQPRESET_PATH?
Back to top
View user's profile Send private message
benco
Newbie


Joined: 08 Jan 2009
Posts: 2

PostPosted: Sat Jan 10, 2009 1:43 pm    Post subject: Reply with quote

Hello feuerfuchs.
I think we don't use the same Winamp script. I used phil's ([url]http://www.salling.com/forums/viewtopic.php?t=6382[/url])
In this script, the topmenu is created at line 66 :
[quote]var topMenu = new Array("Browse",
"Search",
"Playlists",
"Options",
"Rate",
"Equalizer");
[/quote]
You have to add a "Quit" option :
[quote]var topMenu = new Array("Browse",
"Search",
"Playlists",
"Options",
"Rate",
"Equalizer",
[b]"Quit"[/b]);
[/quote]
After that, go to the topMenu_ValueUpdated function (line 445) The original is like :

[quote] ...
...
case 6:
_gotoEqualizer();
break;
[/quote]
Add the case option just after that, like this :
[quote] ...
...
case 6:
_gotoEqualizer();
break;
[b]case 7:
_quitWinamp();
break;[/b]
[/quote]

Then add the 2 functions ([b]_quitWinamp()[/b] and [b]quitWA_OK()[/b]) anywhere in the script.

The EQPRESET_PATH is defined line 24 of the original script.
[quote]// This should be the directory containing the file eqPresets.txt
// I'm using settingsPath which is defined by Salling as
// 'Documents and Seetings/$USER/Application Data/Salling Software AB/Salling Clicker/Script Settings/$UUID/'
// Doesn't have to go here - set it to whatever you want and put your eqPresets.txt file there
var EQPRESET_PATH = settingsPath;
[/quote]
On my computer, the Winamp script is installed in My Documents/My Clicker Scripts/WinampV2.0Mod so I set the var to :
[quote][b]EQPRESET_PATH="C:/Documents and Settings/<myusername>/My Documents/My Clicker Scripts/WinampV2.0Mod[/b]"[/quote]

Just copy the killwinamp.bat script in this directory.

B.
Back to top
View user's profile Send private message
feuerfuchs
Junior Member


Joined: 26 Nov 2005
Posts: 37

PostPosted: Mon Jan 12, 2009 9:57 pm    Post subject: Reply with quote

works fine!

big thanks to [b]benco[/b]
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Salling Software Forums Forum Index -> Scripting Salling Clicker for Windows All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group