jkey + v-bang lite + winamp Thread last updated on 2005-11-23 13:58:06

Posted by member 234336 on 2005-11-21 16:17:36

ok guys I've read through tons of threads and all my module docs but I'm having a little issue that I could use some help with. I've set my laptop front panel buttons for volume up/down/mute, winamp prev/next/stop using v_bang lite and jkey.

The problem that I'm having is I can either pause or play using the play/pause button, hexvalue B3, I can't do both. Is there an IF command I need or something?

I'm using the Reluna theme and Paul used a pretty streamlined approach with everything so I'm not sure if the dynamp controls would do what I'm looking for. Thank you for your help.

/edit:
I've got the pause/play function down when Winamp is open. The play button won't open Winamp and start playing. I know there's a command that I need to check. If anyone wants to make my search easier great, but I think I'll be able to figure it out.
Peace.

Posted by member 212670 on 2005-11-21 16:38:56 link

Using mzscript (which the theme probably already has loaded), when you press your play/pause button, use this bang instead:

*Script bang !playpause
*Script gotoif ( "%{ampplaying}" = "1" ) pause
*Script exec !Amp_Play
*Script exec !varset ampplaying 1
*Script exit
*Script label pause
*Script exec !Amp_Pause
*Script exec !varset ampplaying 0
*Script ~bang

Note: If you play or pause using winamp itself, the script can lose sync, but a simple toggling of your play/pause button will resync it. So, just don't use winamp itself. :)

edit-

That should also open winamp and start playing it, if it's closed. I'm assuming reluna is using dynamp or geekamp? It's possible they've defined DynAmpPlayPauseNotOpen or PlayNotOpen, which would stop winamp from opening when play is pressed.

Posted by member 1 on 2005-11-21 22:51:49 link

Since jAmpToo can tell if winamp is playing or paused can't it be read in somewhere and have an IF execute based on that?

Posted by member 212670 on 2005-11-21 23:48:06 link

Well, the trick would be to capture some kind of "event" to fire a !bang if play or pause was pressed on winamp itself. None of the amp modules do that (someone correct me if I'm wrong).

If someone wanted to, it could actually be done with xlabel. First, you'd create a dummy label that only showed [winampStatus]. Then you'd set that label to fire a script bang with (labelname)OnTextChange. In the script, you'd first export the label's text with !LabelInfoExport, and set a variable with it. Then, using gotoif-s, you'd evalute the variable, and set the ampplaying var (as above) based on that. So, it would look something like this:

*Script bang !setampvar
*Script exec !LabelInfoExport (labelname) amptmp
*Script gotoif ( "%{amptmp}" = "Paused" ) paused
*Script gotoif ( "%{amptmp}" = "Playing" ) playing
*Script exit
*Script label paused
*Script exec !varset ampplaying 0
*Script exit
*Script label playing
*Script exec !varset ampplaying 1
*Script ~bang

Then, in theory (I haven't tested this :)), the original !playpause script would fire the right command, even if you controlled play/pause on winamp.

edit - And of course, you could add gotoif-s for all the [winampStatus] texts, not just play and pause.

Posted by member 234336 on 2005-11-22 06:35:39 link

xcal, he doesn't have a script module loaded, therefore I don't think any scriptings going on. He uses a pretty streamlined approach. I went ahead and loaded mzscript and copied the text above into the config file. He does have a winampstatus command that refers to the scrolling text box.

The changes that I've made so far have primarily been to the vk104 file and the config file using vbang. I thought that I might be able to use v-bang by basically adding

*Hotkey .none AMP_POWERON !AmpPowerOn

and adding the corresponding
AMP_POWERON , B3

in vk104

Problem I get with that is a bang error, I guess because it's looking for an either/or type configuration.

Here's what I've done. I'm sure it's frought with errors because it doesn't work so anyhelp is greatly appreciated.

*Label AmpInfo
*MainBarModuleHook !LabelLsBoxHook AmpInfo
AmpInfoAddToGroup Ampcontrols
AmpInfoAlwaysOnTop true
AmpInfoTransparencyMode true
AmpInfoX $AmpcontrolsbaseX$
AmpInfoY 3
AmpInfoHeight 22
AmpInfoWidth 215
AmpInfoImage "Amp-Info2.png"
AmpInfoLeftBorder 5
AmpInfoRightBorder 5
AmpInfoTopBorder 2
AmpInfoBottomBorder 3
AmpInfoText "[winampStatus]: [winampSong]"
AmpInfoToolTip "[if(winampPlaying)] You are listening to... \n\n Title: [winamptitle] \n Artist: [winampArtist] \n\n Remain: [winamptime] / [winamptotaltime]\n\n Bitrate: [winampbitrate]\n Samplerate: [Winampsamplerate]\n\n Volume [volume][endif]"
AmpInfoScroll left
AmpInfoScrollSpeed 2
AmpInfoOnLeftDoubleClick !amp_show
AmpInfoOnRightClick !Amp_MainMenuPopup

*Script bang !setampvar
*Script exec !LabelInfoExport "[winampstatus]" amptmp
*Script gotoif ( "%{winampPause}" = "Paused" ) paused
*Script gotoif ( "%{winampPlaying}" = "Playing" ) playing
*Script exit
*Script label paused
*Script exec !varset ampplaying 0
*Script exit
*Script label playing
*Script exec !varset ampplaying 1
*Script ~bang

Posted by member 212670 on 2005-11-22 14:13:04 link

!AmpPowerOn? What module uses that? Doesn't look familiar. Also, the !setampvar wasn't intended to be used in a script alone. It was a companion script (to be used with the !playpause script) to be fired by a dummy label.

Ok, this hand holding might make DeV cringe :), but here's a step by step for you. Do this to a fresh Reluna install (this has been tested, and is confirmed to work):

1. Add to the theme.rc:
*NetLoadModule mzscript-0.9.13
*mzScriptFile "$ConfigDir$script.rc"

*Label ampdummy
ampdummyX -1
ampdummyY 0
ampdummyWidth 1
ampdummyHeight 1
ampdummyText "[WinampStatus]"


2. In the theme's config folder, create a text file, and name it "script.rc"

3. In the newly created script.rc file, add in the following script (each *script starts a new line):
*Script bang !playpause
*Script exec !LabelInfoExport ampdummy amptmp
*Script exec !IfEval ( "%{amptmp}" = "Playing" ) '!varset ampplaying 1' else '!varset ampplaying 0'
*Script gotoif ( "%{ampplaying}" = "1" ) pause
*Script exec !Amp_Play
*Script exit
*Script label pause
*Script exec !Amp_Pause
*Script ~bang


4. Set your hotkey button to use !playpause. For example, the hotkey might look like:
*Hotkey .none AMP_POWERON !playpause


That's it. You're done. Class dismissed.

edited 4:45pm est. Changed the script in step 3. I was being too redundant. Moved the original step 4 to be part of step 1.

-----------------------------------------------------------

Note: For anyone else trying this, it will NOT work as-is with xlabel 3.4.8. The dummy label has to be large enough to hold the entire play/pause text, due to the "ellipsis (...)" change. But, this will work perfectly for Reluna, which uses an older version.

Posted by member 234336 on 2005-11-22 15:34:28 link

Posted by member 234336 on 2005-11-22 15:42:32 link

wtf, is devboi blocking me from posting a response or what?

Posted by member 212670 on 2005-11-22 15:45:50 link

Umm... Why would he do that? Looks like you're posting to me.

Dude... stop making unnecessary thread entries. That WILL (understandably) annoy DeV. ;) Just use edit.

Posted by member 234336 on 2005-11-22 15:49:18 link

I've just retyped and have tried to post multiple times with no luck

Posted by member 234336 on 2005-11-22 15:49:30 link

Lemme try this again

Posted by member 234336 on 2005-11-22 15:54:21 link

apparently I'm locked from posting

Posted by member 234336 on 2005-11-22 15:54:53 link

EDIT:

(from below)

I know that you guys don't sit around like some helpdesk waiting for stupid questions. I, for one, am thankful for this site and the fact that there are folks who know how to do this stuff that are willing to help.

Look, I'm sure you're frustrated at my inability to do this. I can understand if you want to toss in the towel because of the student. I do appreciate the time you've taken so far.

I'm not sure what the posting issues were, but I assure you I wasn't trying to be an ass and I'm not some snotty nosed 12 year old just showing up on the boards.

Thanks for the help.

Posted by member 234336 on 2005-11-22 15:58:01 link

Mercy...please

I can't edit, I can't post anything longer than a sentence

k, well that worked, finally

I know how angry he can get at those that haven't used the search function or haven't read the readmes. I can assure you that's not the case here. I've gone through everything I can think of, exhaustively. I do not have programming or scripting background. That's okay, I'm happy with LS, I was just trying to figure this out. I'm just stuck, but it's not due to lack of effort or trying to figure it out on my own.

I've followed the directions above, to a "T", but I'm getting "Hotkey failed to register: error processing definition" errors. That may be because in my jkey file I have
AMP_POWERON , B3
AMP_PAUSE , B3

I'm also getting a module load error for mzscript-0.8.16. I downloaded the new version 0.9.13 and unzipped to my modules folder.

Posted by member 212670 on 2005-11-22 16:09:20 link

There's no more help I can give you. If you have a clean Litestep setup, and a fresh install of Reluna, the steps I posted above work perfectly. I can tell you that the AMP_PAUSE , B3 is unnecessary.

Good luck.

Posted by member 234336 on 2005-11-22 16:11:13 link

when you say fresh install do you mean just a change themes refresh?

Posted by member 212670 on 2005-11-22 16:12:59 link

No, I mean delete the Reluna folder, reinstall the theme, and just follow my steps.

Posted by member 234336 on 2005-11-22 16:30:39 link

Thank you xcal. I'll give it a shot.

Posted by member 234336 on 2005-11-22 19:41:49 link

xcal,
Thought I'd update you after all your effort today. Reinstalled Reluna after making all the changes. The play/pause button on the front panel of my laptop will now open Winamp and start playing. When playing, if pressed again, it will start back at the beginning of the song, not pausing. Earlier I had it set to pause, but I would have to manually open Winamp and start the play so it looks like it's one or the other.

The dynamp readme doesn't look like it has a command to toggle play/pause which is what I was trying to use as a guide for what command to put in the vk104 file. Anyway, thanks a ton for your help today. I apologize for getting frustrated. Peace.

Posted by member 212670 on 2005-11-22 20:57:58 link

Don't know what to tell you, but it works perfectly for me. The only place where I can see you might have a problem is that this is all one line (the site is breaking it in to two lines):

*Script exec !IfEval ( "%{amptmp}" = "Playing" ) '!varset ampplaying 1' else '!varset ampplaying 0'

Maybe load order matters too... I had all my items in Step 1 immediately after the ThemeAuthor line at the top.

Posted by member 1 on 2005-11-22 21:44:20 link

sounds more like that evar to start winamp with play isn't set than a load order issue.

Posted by member 212670 on 2005-11-22 22:43:59 link

Ya, I agree. I know it isn't the script, though. I'm using it on my own play/pause button on my keyboard and it works flawlessly. :D I have a feeling it's something jabulani_jonny misconfigured or is misunderstanding.

Posted by member 234336 on 2005-11-23 07:49:21 link

I'll be the first to tell you that. ;) I do have that all on one line xcal. I'll try rearranging the order today. DBoi I've got winamp starting just fine, just won't pause when playing; if I understand you correctly. Is there something that I can post that would help you guys help me pinpoint the problem? Thank you for your help!

Posted by member 234336 on 2005-11-23 08:06:31 link

Got it......
it was the syntax for v-bang. I changed jkey back to
AMP_PLAY , B3

Then moved everything up to below the signature in Themevars. That didn't work. So went looking at the commands changed it to

*Hotkey .none AMP_PLAY !Amp_playpause

Bingo!! I was missing the "Amp_" in that line. Works great. I greatly appreciate the help guys and sorry to be sucha PITA. I'd buy you both a Guiness, or Bud if you prefer.

Posted by member 234336 on 2005-11-23 08:08:00 link

xcal if you have any patience left can you explain the dummy label, why I needed it and what it's doing?

Posted by member 1 on 2005-11-23 11:59:33 link

Well I don't drink so have one on yourself for me. :)

As for the dummy label. We are using the dummy label to tell us what the current state of winamp is. If the dummy label says that it is currently playing we are telling it to pause and if it says that it is paused we are telling it to play. By doing this it doesn't matter how you pause it, we always know we need to play from there.

Posted by member 212670 on 2005-11-23 13:58:06 link

I actually don't drink either. ;)

Glad you worked it out.