|
Joined: Jul 2006
Posts: 4,193
Hoopy frood
|
OP
Hoopy frood
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: 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
|
|
|
|
Joined: Dec 2008
Posts: 1,515
Hoopy frood
|
Hoopy frood
Joined: Dec 2008
Posts: 1,515 |
- REMOVED -
Last edited by westor; 30/09/14 11:00 AM.
|
|
|
|
Joined: Dec 2008
Posts: 1,515
Hoopy frood
|
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.aspxEDIT: 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 .
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.
|
|
|
|
Joined: Sep 2005
Posts: 2,881
Hoopy frood
|
Hoopy frood
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.
|
|
|
|
Joined: Dec 2002
Posts: 5,502
Hoopy frood
|
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.
|
|
|
|
Joined: Dec 2008
Posts: 1,515
Hoopy frood
|
Hoopy frood
Joined: Dec 2008
Posts: 1,515 |
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 ?
|
|
|
|
Joined: Sep 2005
Posts: 2,881
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,881 |
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. 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 ? 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.
|
|
|
|
Joined: Dec 2008
Posts: 1,515
Hoopy frood
|
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?
|
|
|
|
Joined: Dec 2008
Posts: 1,515
Hoopy frood
|
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.
|
|
|
|
|