mIRC Home    About    Download    Register    News    Help

Print Thread
updating dialog text #76317 24/03/04 03:19 AM
Joined: Mar 2004
Posts: 26
U
uicn_renegade Offline OP
Ameglian cow
OP Offline
Ameglian cow
U
Joined: Mar 2004
Posts: 26
Currently working on a small dialog to display currently playing MP3's.

All works fine with one exception. I made a small popup that allows you to select file to play/stop, etc. You can also pre-select MP3s to play. To accomplish this I used /splay -q .

The dialog will update the currently playing song, except when the song begins playing from within the queue. In this case it tries to update the dialog, but only makes it blank.

I have it so that it will update when you select the song, which works fine. It just will not display the next song played from within the queue.

here is a snipet of code:

Code:

dialog lilmp3 {
  title "reneMPł"
  size -1 -1 800 40
  option pixels
  box "now playing :",100, 5 5 790 30
  text "", 200, 15 18 780 20
}

on *:DIALOG:lilmp3:init:*: { 
  did -i lilmp3 200 1 $left($nopath($insong.fname),-4)
}


on *:MP3END: { .timermp3ended 1 3 dispcur |  [color:red]  .timerupddia 1 5 did -i lilmp3 200 1 $left($nopath($insong.fname),-4) }[/color] 


I use the MP3END to trigger the timer to wait, then update the dialog with the current MP3 in play, it just wont display it for some reason! confused

Any help is appreciated.

Last edited by uicn_renegade; 24/03/04 03:23 AM.
Re: updating dialog text #76318 24/03/04 03:28 AM
Joined: Dec 2002
Posts: 1,922
O
Online Offline
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
You can change $left(..) to $!left(..) so that the entire expression is evaluated only 5 seconds later and not when the timer is executed.

Re: updating dialog text #76319 24/03/04 03:52 AM
Joined: Mar 2004
Posts: 26
U
uicn_renegade Offline OP
Ameglian cow
OP Offline
Ameglian cow
U
Joined: Mar 2004
Posts: 26
Online,

Thank you, that indeed did the trick.

I am curious now though. I previously had the same problem, but rather than a dialog it would just send a notice to the currently active window. I used the exact same principal to display it, in fact the code is still in, that is the dispcur alias from my snipet.

I was able to remedy it merely by adding the timer, then call the alias.

I never thought to try creating an alias for the dialog and calling it like the other, will try that now.

Dont understand why one would work, and the other wouldn't.

Here is the code, maybe you can enlighten me smile

Code:
on *:MP3END: {
  .timermp3ended 1 3 dispcur
  if ($dialog(lilmp3).active == $true) .timerupddia 1 3 did -i lilmp3 200 1 $!left($nopath($insong.fname),-4) 
}
alias dispcur {
  if ($insong == $true) {
    echo -am 14MPł 4» 14Now 14Listening To: 12•—{15 $left($nopath($insong.fname),-4) 12}—•
  }
}



My original error was I was using MP3END to post the next song, not realising that $insong.fname would be $null at that particular time, hence the need for the timer/alias.

As you can see I use the same identifiers to display, and the /notice one would work, while the dialog wouldnt (without $!left).

EDIT: reformatted to better fit the forum.

Last edited by Hammer; 24/03/04 11:37 AM.
Re: updating dialog text #76320 24/03/04 04:11 AM
Joined: Mar 2004
Posts: 26
U
uicn_renegade Offline OP
Ameglian cow
OP Offline
Ameglian cow
U
Joined: Mar 2004
Posts: 26
Also another quick question.

Is there an identifier to merely tell whether a particular dialog window is open?

What I am doing is updating the dialog from an event triggered from a popup. I however get an error message if the dialog is not open already.

Re: updating dialog text #76321 24/03/04 05:39 AM
Joined: Dec 2002
Posts: 1,922
O
Online Offline
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
/notice is an IRC command that works pretty much like /msg (except it doesn't open a query window on the other end), so it's better not to confuse it with the local /echo which is used to print text to the screen.

Quote:
Is there an identifier to merely tell whether a particular dialog window is open?

I recommend this alias that will activate an existing dialog instead of attempting to reopen it (paste into the remote and use /dlg lilmp3): alias dlg dialog $iif($dialog($1),-v,-m) $1 $1

Re: updating dialog text #76322 24/03/04 12:13 PM
Joined: Mar 2004
Posts: 26
U
uicn_renegade Offline OP
Ameglian cow
OP Offline
Ameglian cow
U
Joined: Mar 2004
Posts: 26
Online,

Thank you again, as that does indeed work, but is not quite the desired effect.

What I am trying to accomplish is this:

When playing a new song from the popup, or the next one in the queue and there is no dialog window open, to not do anything(and not get a /did error). But IF the dialog is already open, update it with the currently playing song. I do not want to open it, if it is not already open.

Last edited by uicn_renegade; 24/03/04 12:21 PM.
Re: updating dialog text #76323 24/03/04 12:35 PM
Joined: Dec 2002
Posts: 1,922
O
Online Offline
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
Code:
on *:MP3END: {  
  .timermp3ended 1 3 dispcur 
  .timerupddia 1 updatedlg
}
 
alias updatedlg {
  if $dialog(lilmp3) {
    did -i lilmp3 200 1 $left($nopath($insong.fname),-4)
  }
}

Re: updating dialog text #76324 24/03/04 10:13 PM
Joined: Mar 2004
Posts: 26
U
uicn_renegade Offline OP
Ameglian cow
OP Offline
Ameglian cow
U
Joined: Mar 2004
Posts: 26
Online,

Thanks yet again!

I was on the right track, and had I read a bit better, I probably wouldnt have had to ask. Your help is much appreciated.

Re: updating dialog text #76325 24/03/04 11:25 PM
Joined: Dec 2002
Posts: 1,922
O
Online Offline
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
Welcome laugh