mIRC Home    About    Download    Register    News    Help

Print Thread
#248251 29/09/14 09:23 PM
Joined: Jul 2006
Posts: 4,193
W
Wims Offline OP
Hoopy frood
OP Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,193
I was going to make a report but figured I would try here first, whenever I reboot mIRC (7.36), the following alias won't work:
Code:
alias internetip {
  var %n a $+ $ticks
  .comopen %n msxml2.xmlhttp
  if ($com(%n,Open,1,bstr,GET,bstr,http://ipinfo.io/ip)) {
    if (!$comerr) {
      if ($com(%n,Send,1)) {
        if (!$comerr) {
          if ($com(%n,responseText,2)) {
            if (!$comerr) {
              var %r $remove($com(%n).result,$cr,$lf)
            }
            else echo -a error 5
          }
          else echo -a $!com on responseText is 0 -- $comerr
        }
        else echo -a error 4
      }
      else echo -a $!com on send is 0 -- $comerr
    }
    else echo -a error 3
  }
  else echo -a $!com on open is 0 -- $comerr
  if ($com(%n)) .comclose %n
  return %r
}
Try //echo -a $internetip after rebooting mIRC, which should return an error, but any call after that will work correctly. Any idea what could be the problem?


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Wims #248253 30/09/14 10:09 AM
Joined: Dec 2008
Posts: 1,515
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
- REMOVED -

Last edited by westor; 30/09/14 11:00 AM.

Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
westor #248254 30/09/14 11:00 AM
Joined: Dec 2008
Posts: 1,515
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
I tried to find a way but i parse this error.

try use $com(%n).error and $com(%n).errortext

return 9 DISP_E_EXCEPTION

i found some results for this error http://msdn.microsoft.com/en-us/library/bb166327.aspx

EDIT: I try the code with bool,false options include (i saw this from an previous code) try to use this code maybe this will help find your problem laugh.

Code:
alias internetip {
  var %n a $+ $ticks
  .comopen %n msxml2.xmlhttp
  if ($com(%n,Open,1,bstr,GET,bstr,http://ipinfo.io/ip,bool,false)) {
    if (!$comerr) {
      if ($com(%n,Send,1)) {
        if (!$comerr) {
          if ($com(%n,ResponseText,2)) {
            if (!$comerr) { var %r $remove($com(%n).result,$cr,$lf,$crlf) }
            else echo -a error 5
          }
          else echo -a $!com on responseText is 0 -- $comerr -> $com(%n).error -> $com(%n).errortext -> $com(%n).argerr -> $com(%n).progid
        }
        else echo -a error 4
      }
      else echo -a $!com on send is 0 -- $comerr -> $com(%n).error -> $com(%n).errortext -> $com(%n).argerr -> $com(%n).progid
    }
    else echo -a error 3
  }
  else echo -a $!com on open is 0 -- $comerr -> $com(%n).error -> $com(%n).errortext -> $com(%n).argerr -> $com(%n).progid
  if ($com(%n)) .comclose %n
  return %r
}

- Thanks!

Last edited by westor; 30/09/14 11:12 AM.

Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
westor #248256 30/09/14 05:03 PM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
That fixed it for me.

Not sure why it would work on subsequent calls but not the first one though.

hixxy #248259 30/09/14 06:29 PM
Joined: Dec 2002
Posts: 5,502
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,502
The bool false makes the request synchronous as opposed to asynchronous (which is the default), so it may be that, on the first call, the system needs time to set up the object, loads DLLs, and so on, so it defaults to asynchronous callback handling, whereas subsequent calls are faster, so it returns the result immediately.

Khaled #248261 30/09/14 06:39 PM
Joined: Dec 2008
Posts: 1,515
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
Originally Posted By: Khaled
The bool false makes the request synchronous as opposed to asynchronous (which is the default), so it may be that, on the first call, the system needs time to set up the object, loads DLLs, and so on, so it defaults to asynchronous callback handling, whereas subsequent calls are faster, so it returns the result immediately.


So what is the better and faster way to grap the info? i saw that with bool false the lookup way sometimes freeze mIRC can you please post an faster way ? smile


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
westor #248262 30/09/14 06:49 PM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Originally Posted By: Khaled
The bool false makes the request synchronous as opposed to asynchronous (which is the default), so it may be that, on the first call, the system needs time to set up the object, loads DLLs, and so on, so it defaults to asynchronous callback handling, whereas subsequent calls are faster, so it returns the result immediately.


Thanks, makes sense.

Originally Posted By: westor
So what is the better and faster way to grap the info? i saw that with bool false the lookup way sometimes freeze mIRC can you please post an faster way ? smile


Because it's synchronous that means that mIRC will wait for your system to connect to the internet and get the result before continuing with the rest of the script. Asynchronous would allow the rest of the script to continue and would then run an event when the socket obtains the data (if mIRC supported COM events).

To make it faster you'd need to get a faster system and/or internet connection.

hixxy #248264 30/09/14 06:58 PM
Joined: Dec 2008
Posts: 1,515
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
Ah ok so there is not any other faster way to grap the info? it depend on the machine and on the internet connection?

What exactly are the requirements that must have an machine to be faster?

And the minimum internet speed that need for?


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
westor #248278 01/10/14 09:55 AM
Joined: Dec 2008
Posts: 1,515
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
Also there is an bug on this code, if the web details changed then does not get the new web details and giving the old.


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-

Link Copied to Clipboard