mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
Joined: Dec 2002
Posts: 343
D
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
D
Joined: Dec 2002
Posts: 343
isurl

This would be useful for Hotlinks for example. Please let me know if there is a way to do this already, a simple way, not a complex way. Like... if ($1 isurl) just like ($1 isalnum) works.

Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
And how does one define what a url is? There is no general way to do it. Every URL scheme defines its own format.

Joined: Feb 2003
Posts: 309
C
Fjord artisan
Offline
Fjord artisan
C
Joined: Feb 2003
Posts: 309
To sidetrack:
what about the ability to call custom identifiers/aliases as comparison operators?
IE:
if ($1 $monkey $2) {
;..code..
}

alias monkey {
if ($1 == tail) {
if ($2 == tail) { return $true }
else { return $false }
}
}

Perhaps the above example isn't that great; but hows about this:
;Eval true if both have monkies have at least one foot smile
;monkey1 has feet
;monkey2 has a foot
;so
alias monkey {
if ($1 == feet) {
if ($2 == foot) { return $true }
else { return $false }
}
}

Joined: Dec 2002
Posts: 3,138
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
You can already use $monkey($1,$2) in an if statement.

Joined: Feb 2003
Posts: 309
C
Fjord artisan
Offline
Fjord artisan
C
Joined: Feb 2003
Posts: 309
Yes Yes I know but this would be nice, particularly if your useing stuff with commas in them (which are hard[read as 'effort filled'] to pass to identifiers)

Moreso if um...
I had more reasons.
Damn I have forgotten them

Oh well.

Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
Not if you set them into %vars first and pass the %vars in the identifier.


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
Operators require some form of precedence. That means mIRC would need some way to dynamically assign precedence.

Joined: Dec 2002
Posts: 343
D
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
D
Joined: Dec 2002
Posts: 343
Type "/help URL Catcher" while in mIRC. mIRC can tell already. I just want something that tells whether the word X is an URL, or not. If it were, and were shown in a window, you could double click on it and open it. But with HOTLINKS, that becomes a problem kind of. Hence why I suggested this.

Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
Quote:
mIRC looks for URLs beginning with "http://", "ftp://", "gopher://", "www.", and "ftp.". mIRC also checks to make sure addresses are not added to a list if they already exist. Addresses longer than 256 characters are ignored.


alias isurl {
if ($regex($1-,/^((http://)|(ftp://)|(gopher://)|(www\.)|(ftp\.))/i) && $len($1-) < 257) return $true
return $false
}

$isurl(www.test.com) - $true
$isurl(http://www.test.com) - $true
$isurl(test) - $false
$isurl(blah blah blah) - $false

I really don't see why something like that has to be done internally when the script to do it yourself is 2 lines long.

Joined: Dec 2002
Posts: 343
D
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
D
Joined: Dec 2002
Posts: 343
There's stuff in mIRC, that has been added, that could have the same thing said about it. It's still a suggestion. I think it would be worth it to have it built in.

Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
Well then please don't waste our time by saying something like:
Quote:
Please let me know if there is a way to do this already, a simple way, not a complex way.


When you really have no intention of actually using a solution when someone provides it.

Joined: Dec 2002
Posts: 343
D
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
D
Joined: Dec 2002
Posts: 343
You misunderstood what I said. When I asked if there was a simple way to do it already, I meant an identifier or operator. If I missed it in the help. When I said not a complex way, I consider what you said to be overly complex.

Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
1 line is overly complex?

Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
what does the /i in regex do?


new username: tidy_trax
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
it makes it case insensitive. So even though I have only http:// in the regex, HtTP:// would match it because the /i tells it to ignore case.

Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
ok thanks smile


new username: tidy_trax
Joined: Dec 2002
Posts: 343
D
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
D
Joined: Dec 2002
Posts: 343
In my opinion it is complex when I personally think it should be built in.

Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
Well that has to be the dumbest thing I've ever heard.

"I think mIRC should have a $gt because $gettok is long, I could just do alias gt, but thats too complex"


Joined: Dec 2002
Posts: 343
D
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
D
Joined: Dec 2002
Posts: 343
You probably still misunderstand what I'm saying. However, whether you understand or not, this will be my last post on this cause I don't care to argue anymore.

For one thing, I mentioned it as an operator originally. Cause it would be most valuable in ON HOTLINK. Currently I'm using if ($left($1,-2) isalnum) to do this, despite it being flawed in this method.

Second, I'd want it built in. I believe it would be useful in many occasions instead of people having to rely on scripting a custom identifier. Below are some examples. I may make some mistakes in the below, but you get the idea.

ON *:TEXT:*:#:{
if ($me !isop $chan) { halt }
var %a
while (%a < $gettok($1-,0,32)) {
inc %a
if ($gettok($1-,%a,32) isurl) { kick $chan $nick Advertising | halt }
}
}

ON ^*:HOTLINK:*:*:if ($1 isurl) { return } | else { halt }
ON *:HOTLINK:*:*:run c:\Program Files\Internet Explorer\iexplore.exe http://dictionary.reference.com/search?q= $+ $1

What happens when an URL is filled with colors and codes? Would what you said still work?

Joined: Feb 2003
Posts: 810
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Feb 2003
Posts: 810
Quote:

Well that has to be the dumbest thing I've ever heard.

"I think mIRC should have a $gt because $gettok is long, I could just do alias gt, but thats too complex"


I frequently read this board and can't even count how many thousands of times I've read you calling someone/something dumb or stupid. You say you come here to discuss as the description of the board says, but I'm yet to discover what is the value of this post of yours as a discussion here. Regardless of what your point is, no one here needs or wants to know what you think it's dumb, so I guess you can't say things like this here.

In this specific thread, the guy wants the identifier built-in, he thinks your solution is complex, so what? It's his view, not yours; you don't have the right to throw to him your personal view as a better one and diminish his one. It's simple.
I couldn't care less if you take the whole day to argue about it's general value as an utility - although it seemed there wasn't anything left to be discussed - as I can filter what I read; but I'm not the only one who has to do that almost everytime your nick appears and, sometimes, it's just excessively disgusting to read someone flaming the way you do (and I can see in other threads that I'm not the only one).

That said, please stop being rude here and there when you can't seem to convince a person. It's ridiculous, disgusting, it decreases both your credibility and the level of this board - this one being what a lot of people here are concerned with. People could lose the interest of posting suggestions if they expect someone to come, disagree and call them dumb for a reason they don't know yet.

This is my unique post about this here, as I don't want to disturb the thread anymore. Next ones could be private, if you reply and if I bother to reply back.
Of course, I'm scaling all these feelings and needs in its own proportion, which is the proportion of something coming from an Internet webboard. No need to think about me worrying too much about this issue, I'm perfectly fine.

Thanks

Last edited by cold; 23/08/03 08:30 PM.

* cold edits his posts 24/7
Joined: Dec 2002
Posts: 196
T
Vogon poet
Offline
Vogon poet
T
Joined: Dec 2002
Posts: 196
You have to understand that some people do not understand regular expressions, and not everybody goes to this webboard.


trenzterra
AustNet #trenzterra and #w
Head Scripter @ http://trenzterra.uni.cc
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
Well regex was just to make the script shorter, regex was NOT needed. All that is needed is $left.
alias isurl {
if (($left($1-,7) == http:// || $left($1-,6) == ftp:// || $left($1-,9) == gopher:// || $left($1-,4) == www. || $left($1-,4) == ftp.) && $len($1-) < 257) return $true
return $false
}

I just used $regex to make it cleaner. Using $left is very basic and if you can't figure that out, imo you don't have a need for an isurl because you're not that good at scripting yet. Also I don't see what going to the forum has to do with it, I found out how mIRC defines a url by looking in the helpfile. It determines it by what the text begins with and how long the text is. To check what the text begins with, I want the left part of the text, therefore I use $left. To get the length I use $len. I don't see why you'd need to come to the forum to figure that out, /help should be enough.

Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
Quote:
I frequently read this board and can't even count how many thousands of times I've read you calling someone/something dumb or stupid. You say you come here to discuss as the description of the board says, but I'm yet to discover what is the value of this post of yours as a discussion here. Regardless of what your point is, no one here needs or wants to know what you think it's dumb, so I guess you can't say things like this here.

My post was not valuable? He asked for a way to tell if something was a URL, I gave him a script to do it. How is that not valuable? Seems valuable to me. As I said, if he didn't actually want someone to provide a script, he never should have asked for it. If he would have just said "mIRC needs an isurl" I would have left it at my first post, there is no uniform way to define a URL. However, he also said he wanted a script that does it and he provided the definition of the URL he wanted used, I therefore provided the script. He then complained about the script. All I meant was, if he didn't want a script, why did he ask for one? After that he then corrected himself saying he meant was there already an isurl builtin, and if you notice, at that point I said nothing further. I don't see how any of that is invaluable.

Quote:
In this specific thread, the guy wants the identifier built-in, he thinks your solution is complex, so what?

First off, he DID NOT ask for a built in identifier (originally), he asked if there was a way to do it already, I've now provided him with two seperate ways of doing it in a 2 line script.

Quote:
It's his view, not yours; you don't have the right to throw to him your personal view as a better one and diminish his one. It's simple.

Yes it is his view, and thats fine. However, I don't see why mIRC should be made slower by having to process an additional operator simply because he doesn't want to copy/paste a 1 line script. As I said, if that is ok, well then I want a $gt because I hate typing out $gettok each time. Typing $gt will make it take me half the time to type it. However if I made a post "mIRC needs $gt because $gettok is too long" you and I both know I'd get nothing but laughs.

Quote:
excessively disgusting to read someone flaming the way you do (and I can see in other threads that I'm not the only one).

You yell at me for flaming him... what are you doing right now, useful dialog? Did you forget that this formum has a private message feature and that you could send your complaint directly to me? I doubt it; you chose to post this in public, for all to see. How exactly does that give you the right to tell me what to do? You're doing the same exact thing.

Quote:
That said, please stop being rude here and there when you can't seem to convince a person. It's ridiculous, disgusting, it decreases both your credibility and the level of this board - this one being what a lot of people here are concerned with. People could lose the interest of posting suggestions if they expect someone to come, disagree and call them dumb for a reason they don't know yet.

I did not call him dumb, so please don't imply that I did. I said saying a ONE LINE SCRIPT is complex is dumb. He wants an alias made that is an alias for that single $regex line. I mean if this is added, then we need tons of other things. isemail, ischannelname, is...... All of those can be scripted very easily. Fine, you can say $regex is complex, but as I've demonstrated, and you should know, this same thing can be done using only $left, which is far from complex.

Furthermore, I'm tired of people saying I "attack" people and then attacking me as a result. If you don't like me, when you see "By: codemastr" you can just skip right over it to the next post. If you don't want to read what I have to say, then don't read it, don't complain to me because you don't like what I say. Except for maybe 1-2 incidents, the person I supposidely insulted has never complained to me about what I've said, it has always been people, like yourself, who had nothing to do with the original debate who decided to jump into it. If the original poster did not like what I had to say, how come he/she didn't complain to me? But, if you or anyone else feels like writing a post like this again, what I suggest you do is, to paraphrase the standard Unix BOFH phrase, just delete it instead, because that's all I'm going to do anyway.

Joined: Dec 2002
Posts: 196
T
Vogon poet
Offline
Vogon poet
T
Joined: Dec 2002
Posts: 196
Well, I understand a little of $regex, and of course $left.

And what I meant was that if $regex was the only way, not everybody would understand it, and for $isurl to work, that person would have to see your example, which isn't too practical. However, I support $isurl being added.


trenzterra
AustNet #trenzterra and #w
Head Scripter @ http://trenzterra.uni.cc
Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
Quote:
However if I made a post "mIRC needs $gt because $gettok is too long" you and I both know I'd get nothing but laughs.

/me now begins to wonder why $r was added into mirc when $rand existed :tongue:


new username: tidy_trax
Joined: Dec 2002
Posts: 343
D
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
D
Joined: Dec 2002
Posts: 343
mIRC can already tell if something is a URL or not. When I move my mouse over something, if it's an URL, I can double click it and it will go to the site. I'm suggesting that Khaled makes an isurl (or as some suggested it, $isurl) to see if the given word is an URL recognized by mIRC.

Joined: Dec 2002
Posts: 343
D
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
D
Joined: Dec 2002
Posts: 343
I bet I have an idea why. "$rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(a,z) $+ $rand(a,z)" is lengthy compared to "$r(a,z) $+ $r(a,z) $+ $r(a,z) $+ $r(a,z) $+ $r(a,z) $+ $r(a,z) $+ $r(a,z) $+ $r(a,z) $+ $r(a,z) $+ $r(a,z) $+ $r(a,z) $+ $r(a,z) $+ $r(a,z) $+ $r(a,z) $+ $r(a,z) $+ $r(a,z)"

One solution would be to modify $rand so this could be done. $remove($rand(a,z,a,z,a,z,a,z,a,z,a,z,a,z,a,z,a,z,a,z,a,z,a,z,a,z,a,z,a,z,a,z,a,z,a,z,a,z,a,z,a,z,a,z,a,z,a,z,a,z,a,z,a,z,a,z,a,z,a,z,a,z,a,z,a,z),$chr(32)). Where $rand(a,z,1,9) would return "D 4" for example.

Joined: Dec 2002
Posts: 196
T
Vogon poet
Offline
Vogon poet
T
Joined: Dec 2002
Posts: 196
Wrong thread?


trenzterra
AustNet #trenzterra and #w
Head Scripter @ http://trenzterra.uni.cc
Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
thats the exact reason why he said it would get laughs


new username: tidy_trax
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
If I remember, and I might be wrong, $r existed before $rand and $r just still exists for backwards compatibility.

Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
either way, if $rand existed why add $r, if $r existed why add $rand crazy


new username: tidy_trax
Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
If $r() existed first (which versions.txt suggests it did) then it makes sense to change it to $rand() because $r() is a completely ambiguous name. I hate when people still use $r() in scripts simply for the sake of 3 characters. It makes reading the script a lot harder, particularly for people new to scripting who wouldn't even know what $r() is.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
i suppose...., but 1 trip to the help file(/help $r) would of solved that problem :tongue:.


new username: tidy_trax
Joined: Feb 2003
Posts: 2,812
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
I personally like this idea, and meant to post sooner.

isurl would check if the string is identified as being an url, using the same formula that mIRC uses to determine hotlinks and url catching. Whether it catches ALL TYPES of urls is irrelevant, and best discussed in a seperate thread titled "Why doesn't mIRC recognize nntp:// urls?"

In response to codemastr's question: "And how does one define what a url is? There is no general way to do it. Every URL scheme defines its own format." As I stated above, it will use the same scheme that mIRC uses to detect these formats currently, however limited/ incomplete/ inaccurate it may be.

I propose the following formats:

if ( string isurl ) // checks if string can be identified as an url by any known schemes.
if ( string isurl protocol ) // checks if string can be identified as an url of said protocol.

Examples:
if ( http://google.com/ isurl ) { true }
if ( www.google.com/ isurl ) { true }
if ( ftp.google.com isurl ) { true }

if ( www.mirc.com isurl http ) { true }
if ( ftp.mirc.com isurl ftp ) { true }
if ( ftp://ftp.mirc.com isurl http ) { false }
if ( ftp.mirc.com:80 isurl http ) { true }

You get the idea.

- Raccoon


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
Joined: Feb 2003
Posts: 810
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Feb 2003
Posts: 810
I seccond the suggestion, or even an identifier $isurl would be fine too.. however it could be, it would be a fine small addition.


* cold edits his posts 24/7
Joined: Dec 2002
Posts: 343
D
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
D
Joined: Dec 2002
Posts: 343
$isurl($1-).prop

.prop would be http ftp gopher and any other types of URLs. Also -http would see if it's anything other than http.

$isurl(http://www.mirc.com).-http would return false

$isurl(http://www.mirc.com).-ftp would return true.

$isurl(http://www.mirc.com,-ftp) would NOT work. Cause some may have comas in the possible URL causing error.

$isurl(http://www.mirc.com) would return $true

$isurl(http://wwmirc).-ftp would return true since it's anything but a FTP working URL

Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
To find if something wasn't a certain protocol why couldn't people just use $isurl(blah) && !isurl(blah,notthisprotocol)? And making it a property just so that you could have commas directly in the parameters wouldn't make sense because no other identifier allows commas, there's no point changing that for a single identifier.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Joined: Dec 2002
Posts: 343
D
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
D
Joined: Dec 2002
Posts: 343
Cause $isurl(http://dictionary.reference.com/search?q=test,test) would break the identifier so to speak.

http://dictionary.reference.com/search?q=test,test

Joined: Feb 2003
Posts: 2,812
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
Obviously you would pass %2C instead of a comma. This IS the uri standard. It is the fault of Internet Explorer and other browsers for relaxing this restriction and allowing their plain use.

Take for example your own post and how UBBThreads failed to underline it completely.

http://dictionary.reference.com/search?q=test%2ctest


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
$file(c:\blah,blah.txt) 'breaks' that identifier too. There's little point breaking consistency and removing the possibility of extra parameters in the future just to save assigning a value with a comma to a variable before using it.

I'm pretty sure I had this exact same conversation with you just a few weeks ago.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Page 1 of 2 1 2

Link Copied to Clipboard