mIRC Home    About    Download    Register    News    Help

Print Thread
#110348 06/02/05 02:47 PM
Joined: Aug 2004
Posts: 237
L
Fjord artisan
OP Offline
Fjord artisan
L
Joined: Aug 2004
Posts: 237
--------------------------------------------------------------------------------------------
alias getwebinfo return $dde($1,WWW_GetWindowInfo,1)
alias geturl return $gettok($getwebinfo($1),1,34)
alias gettitle return $gettok($getwebinfo($1),3,34)
alias web {
if ( $isprocess(firefox.exe,1) == $true ) { say 5<web> [3 $gettitle(firefox) 5] [14 $geturl(firefox) 5] $correct($1-) }
if ( $isprocess(iexplore.exe,1) == $true ) { say 5<web> [3 $gettitle(iexplore) 5] [14 $geturl(iexplore) 5] $correct($1-) }
;else say 5<web> [3 Not browsing 5] [14 No URL 5] $correct($1-)
}
--------------------------------------------------------------------------------------------
This script works fine, but the commented else should be scripted, and I can't do it.
It should be displayed when iexplore.exe nor firefox.exe is running.
Is it possible to rewrite the alias 'web' so that I don't need to specify a third if instead of the else?

#110349 06/02/05 03:21 PM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Why do you think there is something wrong with the else?

Btw there's no use checking for $isprocess, just check if the dde returns a url or not, that is much faster than doing a WMI query (I assume isprocess is a COM snippet querying WMI, I've made such aliases myself in the past. wink) Ok it could be that the browser is running, but if there's no url loaded, then there's really no point in showing anything, so we can classify that under the category "not running".

I would change /say to /msg # because if the currently active window isn't a channel/pm window, the script will generate an error. Just in case you decide at one point to call this alias from an event.

Greets


Gone.
#110350 06/02/05 03:51 PM
Joined: Aug 2004
Posts: 237
L
Fjord artisan
OP Offline
Fjord artisan
L
Joined: Aug 2004
Posts: 237
yes indeed, the $isprocess comes from you smile (at least someone on this forum, i suppose it was you)
The else doesn't work like it should.

alias web {
if ( $isprocess(firefox.exe,1) == $true ) { msg $chan 5<web> [3 $gettitle(firefox) 5] [14 $geturl(firefox) 5] $correct($1-) }
if ( $isprocess(iexplore.exe,1) == $true ) { msg $chan 5<web> [3 $gettitle(iexplore) 5] [14 $geturl(iexplore) 5] $correct($1-) }
;else msg $chan 5<web> [3 Not browsing 5] [14 No URL 5] $correct($1-)
}

It only sais there is no web open if IE isn't opened, it should only say if no ie and no firefox is opened.
now when firefox is opened and ie closed it says the firefox url and the else msg, it should just say the firefox url then
hope i made things clear ( prolly not smile )

#110351 06/02/05 04:01 PM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
What the hell was I thinking, lol.

In my tests i was using if checks that compared a value for < (smaller than) which didn't trip, but using if comparisons for == does trip the else.

I don't think you get that isprocess from me, I posted that on the mircscripts.org forums, I think it was tidy who posted it on these forums, not that it matters anyway.

Code:
alias web {
  var %f_url = $geturl(firefox), %ie_url = $geturl(iexplore)
  if %f_url { msg # 5&lt;web&gt; [3 $gettitle(firefox) 5] [14 $v1 5] $correct($1-) }
  if %ie_url { msg # 5&lt;web&gt; [3 $gettitle(iexplore) 5] [14 $v1 5] $correct($1-) }
  if !%ie_url &amp;&amp; !%f_url { msg # 5&lt;web&gt; [3 Not browsing 5] [14 No URL 5] $correct($1-) }
}

Greets


Gone.
#110352 06/02/05 04:07 PM
Joined: Aug 2004
Posts: 237
L
Fjord artisan
OP Offline
Fjord artisan
L
Joined: Aug 2004
Posts: 237
after correcting the typo %if_title it works perfect, thanks a lot laugh
EDIT: ok you corrected it anyway smile

Last edited by LethPhaos; 06/02/05 04:08 PM.
#110353 06/02/05 04:10 PM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Hehe yeah I noticed the typo myself...I know it's a poor excuse but I have had one of those addicted nights again where I couldn't stop scripting. Result: I've been up for 24 hours now (again), and my concentration is fading laugh

It's 17:11 and I havent even slept yet! grin


Gone.
#110354 06/02/05 05:23 PM
Joined: Aug 2004
Posts: 237
L
Fjord artisan
OP Offline
Fjord artisan
L
Joined: Aug 2004
Posts: 237
"goe bezeg jom" wink


Link Copied to Clipboard