mIRC Home    About    Download    Register    News    Help

Print Thread
#157426 25/08/06 05:37 AM
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
OP Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
Code:
alias Popup {
  var %n1 $gettok($1-,1,59), %n2 $gettok($1-,2,59), %n3 $gettok($1-,3,59)
  var %a = Popup $+ $ticks
  .comopen %a WScript.Shell
  if ($com(%a)) .comclose %a $com(%a,Popup,3,string,%n1,i4,5,string,%n2,i4,%n3)
}


Example: /popup Do you feel alright?;Answer This Question:;36

I've turned to this to get around $input halting all other events. But the SecondsToWait argument seems not to work. (It's set to 5 seconds now for testing purposes.) Any guesses?

Arguments:
strText,[nSecondsToWait],[strTitle],[nType]

Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
$input doesnt stop events tho.

Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
I vaguely remember FiberOPtics running into problems using the Popup method with mIRC, but he got around it by using the ScriptControl (MSScriptControl.ScriptControl) to execute some vbscript.

Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
OP Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
DaveC:
Code:
alias test {
  echo -a Does $ $+ input stop everything?
  noop $input(Let's find out.,o)
  echo -a Why yes it does.
}


hixxy:
It worked correctly in a .wsf file so I guess I'll just write/run one of those, although I don't think it'll appear as coming from mIRC. I'd still like to just run it from mIRC if I can. Thx there though wink

Last edited by Loki12583; 25/08/06 06:20 AM.
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
OP Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
After some exploring and testing (learning too!) I came up with three different methods to create a popup, two of which do not function fully (The SecondsToWait argument is ignored).

This creates a windows script file to run the VBscript outside of mIRC. This functions correctly, although from outside of mIRC and therefore (in my opinion) is a tad bit unsightly to be seen coming from an mIRC script.
Usage: /Popup "This is a popup box!", 10, "Title", 65

Code:
alias Popup {
  var %a $+(Popup,$ticks,$r(1111,9999),.wsf)
  write %a $&
    <job id="js"><script language="VBscript"> $crlf $&
    set WshShell = CreateObject("WScript.Shell") $crlf $&
    Result = WshShell.Popup( $+ $1- $+ ) $crlf $&
    </script></job>
  .comopen %a WScript.Shell
  if ($comerr) { echo Error opening WScript.Shell object. | .remove %a | return }
  if !$comerr { .comclose %a $com(%a,Run,3,bstr,%a,uint,0,bool,true) }
  .remove %a
}


This uses MSScriptControl.ScriptControl to run the VBscript. This does not function correctly from within mIRC.
Usage: /Popup "This is a popup box!", 10, "Title", 65

Code:
alias Popup {
  var %a $+(Popup,$ticks,$r(1111,9999))
  .comopen %a MSScriptControl.ScriptControl
  if ($comerr) { echo Error opening ScriptControl object. | return }
  noop $com(%a,language,4,bstr*,vbscript)
  %t = $&
    set objshell = createobject("wscript.shell") $crlf $&
    result = objshell.popup( $+ $1- $+ )
  if ($com(%a)) .comclose %a $com(%a,executestatement,1,bstr*,%t)
}


This uses the Wscript.Shell popup method directly. This also does not function correctly from within mIRC.
Usage: /Popup This is a popup box!; 10; Title; 65

Code:
alias Popup {
  var %a $+(Popup,$ticks,$r(1111,9999))
  .comopen %a WScript.Shell
  if ($comerr) { echo Error opening WScript.Shell object. | return }
  var %v1 $gettok($1-,1,59), %v2 $gettok($1-,2,59), %v3 $gettok($1-,3,59), %v4 $gettok($1-,4,59)
  if ($com(%a)) .comclose %a $com(%a,Popup,3,string,%v1,ui2,%v2,string,%v3,ui4,%v4)
}


Does this qualify as something to post in the Bugs forum?
And does anybody have any suggestions/comments for my style of scripting? grin

Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
I think it's already been brought up so try searching before posting a bug.

Quote:
And does anybody have any suggestions/comments for my style of scripting? grin


Use = in /var! People say it doesn't matter, but it does in certain conditions; //var %a 1, %b 2, %c $rand(%a,%b) | echo -a %c

Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Quote:
Code:
alias test {
  echo -a Does $ $+ input stop everything?
  noop $input(Let's find out.,o)
  echo -a Why yes it does.
}

Why what a nice simple bit of code that showed nothing. Now I could just use your code and go into a active channel and run it, watch the little popup appear, then watch all the text in channel keep coming, which would show im right, but i thought id write something more direct.

Code:
alias test {
  .timerMYSIGNAL 0 1 .signal MYSIGNAL
  echo -a Does $ $+ input stop everything?
  noop $input(Let's find out.,o)
  echo -a Why yes it does. ...... errrrrrrr maybe not after all!
  .timerMYSIGNAL off
}
on *:SIGNAL:MYSIGNAL:{ echo -at OMG An event still going! }


/test
Does $input stop everything? *** $Input window poped up at this moment. ***
[11:07:18.579] OMG An event still going!
[11:07:19.579] OMG An event still going!
[11:07:20.579] OMG An event still going!
[11:07:21.579] OMG An event still going!
[11:07:22.579] OMG An event still going!
[11:07:23.579] OMG An event still going!
[11:07:24.579] OMG An event still going!
[11:07:25.579] OMG An event still going!
[11:07:26.579] OMG An event still going! *** I clicked the $input window OK button now. ***
Why yes it does. ...... errrrrrrr maybe not after all!

Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Quote:
Does this qualify as something to post in the Bugs forum?
And does anybody have any suggestions/comments for my style of scripting? grin

This bug has been reported here

I've once made these Timed Popups which have become pretty much obsolete with newer versions of mIRC.

Some explanation + examples why you should use the = sign when assigning variables with /var can be found here


Gone.
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
OP Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
Wow, that's a pretty nice technicallity you got there DaveC. Too bad it's useless. And the script still stops at the $input.

Now why don't you write me something useful that will connect to servers and channels on mIRC startup and do all the other things my scripts don't do when there's an input box up? Cause mIRC doesn't do those things if there's an input box still waiting.

Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Quote:
Wow, that's a pretty nice technicallity you got there DaveC. Too bad it's useless. And the script still stops at the $input.

Now why don't you write me something useful that will connect to servers and channels on mIRC startup and do all the other things my scripts don't do when there's an input box up? Cause mIRC doesn't do those things if there's an input box still waiting.


LOL all i can say to that is What garbage scripts have you got running that cant work while a input box is up. my mirc well do anything i tell it to while there is one up no problems.

Oh and PS, dont be making out you were still right when you werent I at least can admit when im wrong (i have been on here several times)
you said "I've turned to this to get around $input halting all other events" and you said "Does $input stop everything?" "Why yes it does."
And well that is just blatantly wrong, so now you change it to being "And the script still stops at the $input" I mean come on.

If you got a message u wont to display, trip it on a signal (not imediate mode) just like that then it wont hold up anything (admitedly it wont display tell the signal calling script completes, but thats to be expected in a single threaded processing system like mirc scripts)

Joined: Feb 2003
Posts: 2,812
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
Thread necro'd to simply add that the original script does work, with nSecondTimeout, by simply using $comcall() instead of $com(). You can optionally specify a callback alias in $comcall() to be triggered when a button is clicked or the nSecondsTimeout elapses, or you can leave this parameter blank. You can also use an advanced command such as 'echo $!com($1).result' instead of just an alias.

/comopen WshShell WScript.Shell
//echo -a $comcall(WshShell, echo -a $!com($1).result, Popup,3, bstr,Hello World!, int,10, bstr,Popup Window, int,$calc(6+32+4096))
/comclose WshShell


Resource: https://docs.microsoft.com/en-us/previou...%28v%3dvs.84%29
Resource: https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-messagebox

Extra credit: If you use the flag value 2097152 (MB_SERVICE_NOTIFICATION), the popup window will appear for any user desktop that's logged in, or when no user is logged in, or when the computer is locked (Win+L) or in the (Ctrl+Alt+Del) screen. mIRC does not need to be Admin to do this. It's very special. wink Enjoy. (12 years late)


Well. At least I won lunch.
Good philosophy, see good in bad, I like!

Link Copied to Clipboard