mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
Joined: Feb 2003
Posts: 309
C
Fjord artisan
OP Offline
Fjord artisan
C
Joined: Feb 2003
Posts: 309
This is a post about the general bits which i'm not acutally sure if it IS feasable, but it sounds like it. Anyone who can do this, msg me or email me, please.

VBscript,Jscript,PERLscript,etc for mIRC exists.

Let me ramble a little, I'll get to my point later. First off, mIRC script is, and always will be, a bastard child with crippled fingers. It is a loosely typed, messy little scripting language - and I love it to bits. Type conversion? Conversion, smeh! If you are anything like me you created your first popup and thought "d00d, you are so l33t. See what else you can do".
So the obsession starts. Not just with mIRC, you might dabble in other things. Other scripting langauges. Programming langauges. Assembly even, if you get too hardcore. You then look back at mIRC, which you still use to chat, and decide to do something with it, really really flashy and cool.
Thats when it hits you. You can't use pointers or arrays, or a lot of other nifty things. So you script around them. You end up with a lot of unmodular spaghetti code. You feel sick. You throw it away and start over, trying new tricks. In the end you probably read the bit in the help file about DLLs.
Ooh. Ahh. Nifty. I don't havce a microshaft product, so I'll find another langauge to work in. No one has tutorials for DLLs written entirely in assembly, expressly for mIRC. In a haze of desparation you find MSDN and start reading about windoze.
Eventually you come across COM objects - I took the long way.

What are they? How can they be used? Where's the damn documentation?
You whip out the wokring model of visual basic 6 (yes, its free), you find certain registry entries and OOPS you've defrauded good ole bill out of a few ivory backscratchers, but on the plus side you can make (now) ActiveX DLLs, and you can step into the world of COM.
Not everyone can find teh working model
Not everyone likes visual basic - but they can't be stuffed learning C++

*cough*
mid rant breather break.... inhale... exhale
*/cough*

Windows Scripting Host, ver 5.6 documentation

Quote 1:
"WSH provides the ability to create COM components. "
-Introducing Windows Script Components, Windows Script Components

Quote 2:
"Generally, you write scripts in either Microsoft JScript or VBScript, the two script engines that ship with Microsoft Windows 98, 2000 and Millennium Editions. You can use other script engines, such as Perl, REXX, and Python, with Windows Script Host.
Note: For more information, see Microsoft Developer Network (MSDN) (http://msdn.microsoft.com/workshop/languages/clinic/vbsvjs.asp)."
-Available Script Engines, Hosting Environments and Script Engines
Quote 3:
"Windows Script engines can be developed for any language or run-time environment, including:
Microsoft Visual Basic Scripting Edition (VBScript)
Perl
Lisp"

Quote 4:
"me0w"
-CloCkWeRX

If you read those you might guess where I'm heading. Not only do I me0w, I'm crazy too. So crazy that I thought, hang on, if I can make a COM object in Jscript (Microsoft Flunky JavaScript), AND register it, and I can do the same with ANY language that has libraries written for WSH (Windoze Sleepy Host), I can do what ever I please and get away with it. FREE! *throws out exspensive C++ editors for a moment*

So it all comes down to this: You know HTML, you probably can pick up xHTML (eXtensible HTML). You can do that, you have the idea behind XML. XML + Jscript|VBscript|*script + WSH = COM Objects. COM Objects + mIRC = all good.

When you read the help file I pick up a feeling that everyone's fav client author didn't realise this existed so easily in the form of windoze scriptng host. Be excited.

In conclusion, I say this:
mIRCscript is limited
*script is not. Shut up and use it smile don't post "I think we should have PERLscript" for mIRC. You do. Already. I think. me0w.

What is need for this to all work:
-Better documented help file in regards to COM. Its bulky, and obscure, and not very much like the rest of mIRC's easy to understand examples.
-Developers to write tutorials for developing in *script.

Final Quote:
"mIRC allows you to call COM objects via scripts. You must have experience with COM objects in order to use this feature." You better believe it.

Joined: Dec 2002
Posts: 54
L
laz Offline
Babel fish
Offline
Babel fish
L
Joined: Dec 2002
Posts: 54
I didn't read your whole post, I was in a hurry and its kinda long smile

Anyway, if you want a IRC client that supports other languages, use Klient (www.klient.com). It supports everything ActiveX does (which is Perl, TCL, Python and others).

Joined: Dec 2002
Posts: 2,985
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 2,985
I agree. mIRC is mIRC. mIRC is unique. Lets not poison mIRC with those other languages or differing language structures.

Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
What you and laz seem to be misunderstanding is that he's saying that mIRC already supports other languages via COM objects, and that the people who want to use other languages can do so.

However, personally I don't like the insinuation that such languages are far superior to mIRC scripting because quite frankly they're not. mIRC scripting is a hell of a lot more focused and able as far as being an IRC scripting language. I can't help but feel that the things people create by using Perl, Python et al. will have little or nothing to do with IRC at all and could just as well be standalone applications.

Also I'm pretty sure CloCkWeRX made a reference to cracking Visual Basic in there somewhere, which of course I don't support.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Joined: Feb 2003
Posts: 309
C
Fjord artisan
OP Offline
Fjord artisan
C
Joined: Feb 2003
Posts: 309
cracking ? who what? pointing out that you can pay a helluva lotta money for the difference between someting with 1k of registry data is what i'm saying.

mIRCscript isn't very well organised at all; if you've ever sampled java, c++, or any real programming language you'll know the other end of the scale. Javascript, *script, etc have sacraficed a lot of features to become a scripting langauge, rather than a programming language, but at least you can work with arrays, objects, etc in them. For these reasons i purport that they are better _scripting_ languages

The complete lack of OOP type features in mIRC script is kinda sad, because we've ended up with butchery between low-level functions and high level functions (/quote & /me respectively), event driven & procedural code... Its a hodgepodge of functions which don't conform too well... AT least it is backwards compatable, in most part.

well i'll rant back later.

Joined: Dec 2002
Posts: 20
S
Ameglian cow
Offline
Ameglian cow
S
Joined: Dec 2002
Posts: 20
i totally agree with mIRC being just about the messiest language exisitng... but what can you say... it's mIRC! smile it's what got me in to this game smile And even tho it's messy, that makes it easy for small scale projects (and face it, irc scripts, as bloated as they can be, are still but small scaled projects - they're JUST a tool to help you CHATTING, not like they do anything dead useful or anything).

imma make an ecma client one day... some day...


you guys are so not L334
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
You say mIRC scripting is better? Well if better is defined:

slow, having awkward, unpredictable results, etc, etc

then I fully agree. Compare something written in mIRC scripting to something written in php, perl, python, tcl, etc (that does the same function) and you will see that mIRC script is FAR slower. Also the other languages don't have insane syntax. Like the dreaded [ ], or $+, or $chr or the "multiple space" bugs that mIRC is plagued with.

To me those things aren't good points of mIRC scripting, they are bad, I'd much rather have a scripting engine that parses fast and has a nice easy syntax that doesn't require you to do all sorts of insane stuff like mIRC requires.

Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
I meant better as in much simpler to learn and to write, more focused on the relevant subject, and the language's syntax changes very little over time.

As far as having unpredictable results goes all I can say is that every language does the unexpected, whether it's a bug or just behavioural. For instance I've spent several days trying to figure out a fix for why a PHP function won't work in the documented way, but will work in a similar (undocumented) way which makes it totally unuseable to me - maybe it's a bug, maybe not, the point is that no language is infallible.

Since we are (or at least I am) talking about 'better' as far as being an IRC scripting language then speed is of little importance. Can it do things a lot faster than I could manually? Hell yeah. It's fast enough then, at least as far as I'm concerned. It really doesn't matter how many hundred or thousand times faster Python or PHP is if all the script is doing is looping through a couple of dozen nicknames or channels and performing some simple command each iteration.

Simplicity is mIRC scripting's real strength though. It takes a few days of learning to be able to produce useful and meaningful results, the things which people point out as weaknesses (no OO, no data types etc.) are what allow that to happen. If you came to mIRC from a programming background then that simplicity may not help you, it may even make things worse, but the fact is that most people aren't coders - at least not when they first learn mIRC scripting.

Documentation is another plus-point in mIRC's favour. Other languages might have more content relating to them on the web, but it's widely distributed and much of it is deprecated or poorly written. mIRC scripting is one of the few languages where documentation is instantly available in one single file on your computer from the get-go. And obviously since anyone using mIRC will be on IRC, I think it's fair to say that mIRC scripting has the edge on IRC help channels aswell.

Of course for some jobs speed really is important, quoted strings, arrays, objects etc. are very useful, and as CloCkWeRX has pointed out all those things are accessible if and when they're required. My gripe is the apparent attitude that a few people have in regards to mIRC that mIRC scripting is just a hurdle to be jumped over in order to get to 'the good languages' via DLLs and COM objects. If Khaled went to the trouble of making a language don't you think it's worth a little bit of the user's time to see if that can do the required job more easily before looking to other languages?

Anyway, I'm not trying to get into a computer language pissing contest, I'm just saying that the the most important choice when coding is to pick the right language for the job, and when it comes to IRC mIRC scripting is often the right one.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Joined: Dec 2002
Posts: 54
L
laz Offline
Babel fish
Offline
Babel fish
L
Joined: Dec 2002
Posts: 54
Quote:

What you and laz seem to be misunderstanding is that he's saying that mIRC already supports other languages via COM objects, and that the people who want to use other languages can do so.


Quote:

I didn't read your whole post, I was in a hurry and its kinda long


Just thought I'd make that part clear smile
Anyway, I think mIRC has a good enough scripting engine. And seeing how its all made by mIRC's author (except for RegEx I think), its very good.

Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
Quote:
Simplicity is mIRC scripting's real strength though. It takes a few days of learning to be able to produce useful and meaningful results, the things which people point out as weaknesses (no OO, no data types etc.) are what allow that to happen. If you came to mIRC from a programming background then that simplicity may not help you, it may even make things worse, but the fact is that most people aren't coders - at least not when they first learn mIRC scripting.


What you call simplicity I call complexity. Please tell me how:

set %string_var %string_var $+ $chr(32) $+ some other text

is cleaner than:

$string_var .= " some other text"; (perl/php)
[append string_var " some other text"] (tcl)
string_var += " some other text" (python)
string_var << " some other text" (ruby)

How can you possibly tell me the mIRC syntax is clean and simple?

Quote:
Documentation is another plus-point in mIRC's favour. Other languages might have more content relating to them on the web, but it's widely distributed and much of it is deprecated or poorly written. mIRC scripting is one of the few languages where documentation is instantly available in one single file on your computer from the get-go.


For perl help:
The perldoc program included with Perl provides extensive documentation on all aspects of the language.

Single file php help: http://www.php.net/distributions/manual/php_manual_en.chm It documents ALL aspects of the php language, and unlike mIRC's helpfile, it tells you when a particular function was added to php so you know exactly what your target version must be.

Tcl help: http://prdownloads.sourceforge.net/tcl/tcl8.4.2-html.tar.gz

Python help: http://www.python.org/ftp/python/doc/2.2.2/html-2.2.2.zip

Ruby help: ftp://ftp.ruby-lang.org/pub/ruby/doc/ruby-man-1.4.6.tar.gz

I'm very familiar with the php helpfile and the tcl helpfile. I'm not really a python or ruby programmer so I can't comment on that too much. But the php and tcl helpfiles have answered any question I ever had. But in any case, there is something you neglected, books. Several php, perl, ruby, tcl, etc books have been published. There are no books on mIRC scripting. Books often help in ways online tutorials and documentation can't, but in the case of mIRC scripting this resource is unavailable; in the other languages, you have several dozens of books to choose from.

Joined: Apr 2003
Posts: 10
J
Pikka bird
Offline
Pikka bird
J
Joined: Apr 2003
Posts: 10
"set %string_var %string_var $+ $chr(32) $+ some other text"

that would really be:
set %string_var %string_var some other text

$chr(32) is space, so adding in $+ $chr(32) $+ is completely redundant. to be fair though, it is still shorter than the other scripts you cited.

Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
Well I hope you saw my point at least, mIRC has an odd syntax and often unpredictable results.

If you didn't like my first example, here is another.

%array. [ $+ [ %i ] ]

in php that'd be $array[$i];

Again, the mIRC syntax is easier?

To me, the mIRC syntax is hard to follow. I'm sure a new user would wonder why the $+ is necessary and why the evaluation brackets are needed. Where as in the php example, it's pretty clear (since it uses the same format as 99% of array supporting languages).

Then of course there are the 'bugs'. The multiple space bug, to which there is no way to get around. In every other language I've ever seen, there is nothing even close to this problem. $calc() problems. Plug a number containing 'e' into a $calc() and it doesn't work. But note that $calc() is quite able to return numbers containing 'e', it just can't process them. Makes it very hard to deal with certain functions, factorials come to mind. If you specify a number that is too large you get an invalid result because mIRC can't handle the large number. Then there is $serverip returning an ip that is reversed, $ord not handling decimals correctly, do you say the "one tenst" because $ord(.1) = .1st, $rand not working correctly with negative numbers, $rand not handling numbers with decimals correctly, try $rand(1.1,3.9) about 20 times or so, note how 4 is returned. $isupper(*) and $islower(*) both return $true, last I checked, * is neither upper or lowercase. Then $disk, I run $disk(d:) (d is my cdrom) it returns $false, but $disk(d:).type returns cdrom, so it doesn't exist yet it is a cdrom? Then $base, the helpfile says $base(1.5,10,16) returns 1.8, well for me it returns 1. Then of course there are always the undocumented features, where is $pi mentioned in the docs? And for that matter, why does mIRC return a value for pi that is too large for it to even understand? $pi returns 3.14159265358979323846, but if you $calc($pi) you get 3.141593. Now I assume anyone using pi doesn't want to print it to a channel, so that means it will probably be used in a math formula. So what is the point of returning more digits than mIRC can handle? Just to make using $pi slower since mIRC has to trim it? Or is that perhaps the reason it is undocumented?

My point is just, you people seem to just want to say "mIRC scripting is better than everything else. The documentation for other languages is bad, they are too complex, etc, etc" But when it comes right down to it, mIRC scripting suffers from all of the problems you describe and more.

And just as a note, I'm not trying to bad mouth mIRC or Khaled in any way, I just simply feel that mIRC scripting is not very well written. Without implying any offense, the major scripting languages are coded by many coders all with the goal of creating a great scripting language. mIRC is coded by one man whose primary goal is to create a great IRC client. It seems logical that when you have numerous people working exclusively on a scripting language you will get better results than from one man who does it as a side project.

Lastly, yes, if mIRC scripting is your first language you won't have problems learning it. But if you are switching from another language, you'll go crazy, I know I did.

Joined: Dec 2002
Posts: 2,985
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 2,985
However, personally I don't like the insinuation that such languages are far superior to mIRC scripting because quite frankly they're not. mIRC scripting is a hell of a lot more focused...

Exactly the point I raised. I just did it more eloquently but perhaps more open-endedly.

I never mentioned whether or not COM objects were already supported, I merely made reference to mIRC itself via it's scripting editor getting the possibility of supporting other languages. I can see why some people want it but I think it would spoil an already good thing, mIRC's uniqueness in the respect that it has it's own scripting language which most of it's users enjoy playing with.

My personal view, unrelated to any comments is this: No language is superior to any other. It is a case of whatever works in a given situation and even the humble mIRC script has it's rightful place in the wide world of c0de.

Joined: Dec 2002
Posts: 2,985
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 2,985
Compare something written in mIRC scripting to something written in php, perl, python, tcl, etc (that does the same function) and you will see that mIRC script is FAR slower.

Who gives a monkeys?

mIRC scripting is a language designed to support one application - mIRC. It's not like people are trying to convert mIRC into an operating system or whatever. Why is it that you must over-rate everything on the issue of speed. mIRC scripting works fast enough (bloody fast) for what it was designed for. C++ or Java or VB.NET or Perl or whatever else there is is not going to do the job any better in any practical sense. Whilst it might be possible to have a whack over a benchmark that contradicts this, your eyes won't see it any different.

Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
Well thats because you don't use mIRC scripting to do things I've done. Ever used $findfile? Well I used it to list mp3s into a listbox. It freezes mIRC for about 10 seconds while it does this process. In perl, the entire operation took less than a second. And saying people don't want it to be an OS... are you new here? As a matter of fact, I've seen a few people say mIRC should be an OS! And just look at what people use mIRC scripting for. A guy recently asked for help making an mIRC httpd. Another guy making an mIRC ircd, another with an ftpd. mIRC scripting may have been designed just for mIRC and just for IRC based scripting, but it has evolved far passed that.

Joined: Dec 2002
Posts: 2,985
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 2,985
I've seen a few people say mIRC should be an OS! And just look at what people use mIRC scripting for. A guy recently asked for help making an mIRC httpd. Another guy making an mIRC ircd, another with an ftpd.

So have I, I've been a member of this forum for a while, but you don't seriously suggest that mIRC should be required to perform those tasks do you? I often knock those who say mIRC is just for text-based IRC but trying to run it as a web or IRC server is completely removing it from it's intended role rather than using it for IRC with some enhancements which it could well quite handle with it's current scripting support.

As for $findfile, well I reckon your statement on that must mean you have more MP3 files than you could ever possibly get to hear because my listbox comes up almost straight away. I've never had any complaints from the people that use my script re: the speed of $findfile either. I can only assume that you either use a 486 or have tens of thousands of files.

I still think that the original suggestion is like putting a 5 litre V8 engine in a Daihatsu Charade. While the power to weight ratio would be useful, it's just not necessary.

Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
I'm using a 1.4Ghz Athlon Thunderbird with about 500 files. The files are contained in a directory structure of:
D:\music\mp3\<artist>\<album>\filename

And I told it to findfile *.* on D:\music\mp3 It loads very slowly. Especially since it doesn't just display the name, it reads the ID3 information (not using mIRC's built in ID3 functions) and outputs that to the list as well. The list is an MDX header based listview. It takes anywhere from 10-15 seconds to load.

Joined: Mar 2003
Posts: 20
E
Ameglian cow
Offline
Ameglian cow
E
Joined: Mar 2003
Posts: 20
i think, CloCkWeRX don't meant mirc script is bad for everything
just bad for complex project

every script engine have it's own job
mirc script is simple to do simple job
but not simple to do complex job
mirc script is a confused language cos it just exten from a very very simple script language, (even not be caledl a language)

it have little logical on the language itself.
how can us write a logical script(program) by it?

and i totally agree with codemastr

but i wonder if Khaled will support for other language
while he worked hard to make such simple mirc scripting language and own such wonderful and complex library(those $** functions in /help)
perhaps only 1% chances he will decide to do so

maybe codemastr can write a dll to load another scripting language for mirc
and use a script to pass events to dll

Last edited by enenen; 27/04/03 05:04 AM.
Joined: Dec 2002
Posts: 2,985
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 2,985
The list is an MDX header based listview. It takes anywhere from 10-15 seconds to load.

I think that is likely to be your lag problem.

I use:
Code:
if ($devent == init) {
  var %sdik $findfile(%ws.sounds,*.*,0,did -a sp 2 $1-)
}


... and %ws.sounds = D:\Music\

It loads about 370 files in about a 10th of a second.

I use a 1300MHz AMD Thunderbird with 512MB Ram and XP Home/2000 Pro on my two desktops and the laptop is an 1800MHz AMD Athlon Mobile with 256MB Ramand XP Home. All machines produce the same performance loading the files.

Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
omg. .
Thank you Watchdog.. I though about that, but it never clicked. I just loaded my playlist fo over 500 songs in a second. Very nice. grin


-KingTomato
Joined: Dec 2002
Posts: 2,985
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 2,985
No probs hehe.

Joined: Feb 2003
Posts: 309
C
Fjord artisan
OP Offline
Fjord artisan
C
Joined: Feb 2003
Posts: 309
*ahem*

Well I seem to have started an verging on flamishness post.

Here's the abbreviated point of my original post, which many of you ignored and argued amongst yourselfs about.

COM object support in mIRC allows you to overcome some of the flaws in mIRC as a scripting language. Suppose you want to use and manipulate arrays, if you knwo the Jscript, VBscript or any script which can be supported by WSH and the XML to create your COM object, whammo! Instant code which is leaping high above mIRC script in some areas.

You don't need to run out and buy Visual Basic 6/.NET to do it. It can be done free, and with a microsoft product. I know. Wow. Did you say free and microsoft *IN THE SAME SENTENCE*

Another thing. AS far as I know it no one has written an AI bot for mIRC. It is possible to use LISP with WSH, and therefor create COM objects. All of a sudden you have an AI language working with mIRC and you don't have to mess around with sockets and A.L.I.C.E bot.

Debugging: WSH debugs scripts alot better than mIRC (which only checks for brackets and control structures being OK). You can find a syntax highlighting editor for javascript, xml, and mixed code etc. All of a sudden you can use somehting like editplus to code in mIRC. (Editplus is a programming orientated notepad clone... go frisk the net for it and try it... customisable sytnax highlighting, language models... too much to list)

COM objects are nice because they are objects. You can create countless _instances_ of the same object, and I know you can call COM objects from COM objects. So can you imagine creating a multithreaded COM object which does 5-10 things at once while mIRC thinks its only doing one thing...

And finally:
The point of my post was to get someone who knows WSH/Jscript/XML to see if they could actually create a mIRC implementable COM object. I've got too much stuff to do on the side. Its possibly in theory; I'm calling for people to prove me right or wrong.
The COM section needs an overhaul or at least some links to relevant MSDN articles. The mIRC community has failed to produce much in the way of tutorials, I've had to hunt all over efnet and trbz is never in. There are coders and mIRCers who can do it, they just hide.



Joined: Feb 2003
Posts: 309
C
Fjord artisan
OP Offline
Fjord artisan
C
Joined: Feb 2003
Posts: 309
Quote:
My gripe is the apparent attitude that a few people have in regards to mIRC that mIRC scripting is just a hurdle to be jumped over in order to get to 'the good languages' via DLLs and COM objects. If Khaled went to the trouble of making a language don't you think it's worth a little bit of the user's time to see if that can do the required job more easily before looking to other languages?


Perhaps.

Now; try to get a team of scripters synchronising your efforts and creating a managable, functional, clean script. We have no standards because mIRC isn't picky. It gets messy. COM objects and DLLs create a method of writing object orientated, modular code: it has a front end, and middle bit and the bit you can't see.
Its a lot neater and if you have documentation its a much neater and *better planned* outcome.

Aliases are meant to be reusable recyclable code. But they can't do anything in the way of multithreading. A DLL utilises memory far better than an interpreted script. A COM object (or Active X DLL, not the same) does the same. You have a neat package of functions and hopefully the documentation to go with.

mIRC is not a hurdle to get to the "good langauges". Would I use a COM object or DLL to write sickeningly pink colored popups? No. Would I use it to work with sockets? No. mIRC already has all of this.
BUT.
What if I want to sort lists by a "human" method. (1,2,11, not 1,11,2)
Or use fuzzy logic type "sounds like" type sorting criteria?
(Go look @ PHP documentation)A COM object/DLL allows this freedom. If your an animal more at home with javascript than mIRCscript, I'm pointing out here and now that hey, you CAN work with javascript in mIRC. COM objects alll the way.

Did any of you go and read the windows scripting host documentation?
Did any of you get curious to see if it could be done?
We all started bitching.
STOP IT! Children, please!

Nothing is usurping anything. There's a reason I suspect Khaled included DLL and COM support. He's fundamentally lazy (as all good coders should be) and has decided to let US as the mIRC community to carry on development of all of the pointless suggestions many of us come up with. I know I've thought of a few damn good n useless ones.
stop ranting about "i don't like your coding attitude too". Its what makes people fight holy wars over piddling little bits of land. Each to their own. Stop dragging each other down. I quite agree with starbucks_mafia on that one.

*pant, pant*

'nuff ranting. I'm off to do something useful with my life

Joined: Dec 2002
Posts: 2,985
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 2,985
Did any of you go and read the windows scripting host documentation?
Did any of you get curious to see if it could be done?
We all started bitching.
STOP IT! Children, please!


I don't see any flames, just people offering their opinion, I even got thanked for mine. grin

At the same time no-one is disputing that mIRC scripting has a few shortfalls. It all comes down to the necessity to include support for other things. The thread has already unearthed some interesting findings too, raw mIRC coding craps all over MDX for a start. I'm not flaming MDX here, it serves a purpose (makes dialogues look pretty and in some cases more functional), that is the point though, you support more languages, protocols, or whatever and the standard that is alleged to not exist becomes even less of a standard.

The other thing is the 'market' for what you want included. There is not a large number of people who would utilise the WSH or script in Perl if mIRC came to support it. How many people add DLL's to mIRC? How many people use MDX or even MTS? Hundreds, thousands but certainly not the millions who use mIRC.

I'd like to see resources put into things that most people will find a use for, and bugfixes.

Joined: Feb 2003
Posts: 309
C
Fjord artisan
OP Offline
Fjord artisan
C
Joined: Feb 2003
Posts: 309
again, you didn't read it did you watchdog

WSH already supports the creation COM object. mIRC implementable COM objects.

You make it in <whatever>Script and create a COM object and implement it in mIRC.

What I am asking is for someone who MAY know which end of a stick to poke at a COM object to create one in <whatever>script. I could do it myself but I am slack, and I dread creating and messing around with struff for ages.
Screw it. Sometime in the future I'll post something here.

Joined: Dec 2002
Posts: 2,985
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 2,985
Screw it. Sometime in the future I'll post something here.

lol - It does pay to finish what you start.

Joined: Feb 2003
Posts: 309
C
Fjord artisan
OP Offline
Fjord artisan
C
Joined: Feb 2003
Posts: 309
COM objects for Cheepskates
So you want to make com objects, but don't want to fork out cash for visual basic/other ide's?
Here's the simple, free and _EASY_ way to do it.

Requirements:
Javascript, Jscript, VBscript, Perlscript, REXXscript or any other script supported by windows scripting host.

Introduction
(previois posts)
That covers the background of this whole thing fairly well. So, here we are.

Part One: Working With My First Com Object
I read the help file entry and sat confused. I looked at the example and didn't get far either.
Here's my better commented version.
excel {
;Excel.Application is what the Excel com object is filed under the the WINDOWS REGISTRY. It has a clsid, which is a bunch of numbers in brackets, like:
;{00000-00000-00000-0000}
;That doesn't concern us yet.
;Action:
;Opens a new com object, and label it "excel" of type Excel.Application.
comopen excel Excel.Application

if ($comerr) {
;if it doesn't open, give up and yell at the user
echo comopen failed
halt
}

;Original: check if excel window is visible
;Extended: check if excel window is visible. Do this by
;accessing the public method VISIBLE in object EXCEL (opened earlier) with
;1 = DISPATCH_METHOD
;2 = DISPATCH_PROPERTYGET
;1 + 2 = 3, which explains that bit.
;That tells it to GET a return value from a METHOD
;Think of it like a custom $identifier - alias monkey { return fleas }
;$monkey returns the word "fleas", BUT its an alias rather than a varible.
;mIRC doesn't have return types, but other langauges do. More on that later.

if ($com(excel,Visible,3) == 0) {
echo $com failed
goto finish
}

echo Visible: $com(excel).result

;Original: make excel window visible
;Extended: make excel window visible. Do this by
;accessing the public method VISIBLE in object EXCEL (opened earlier) with
;1 = DISPATCH_METHOD
;4 = DISPATCH_PROPERTYPUT
;That tells it to PUT(pass) a value to a METHOD
;Again a custom $identifier - alias monkey { set %secret_var $1- }
;$monkey(fleas) sets a varible which the user can't see (PRIVATE some might say)
;this returns 0 for "we screwed up", or something else for "its all good"

if ($com(excel,Visible,5,i4,1) == 0) {
echo $com failed
goto finish
}

; check visibility again
;look above
if ($com(excel,Visible,3) == 0) {
echo $com failed
goto finish
}

echo Visible: $com(excel).result

:finish
;get rid of the stupid thing, we are sick of it.
comclose excel
}

mIRC isn't a real programming language. Its a scripting language. Its had bits cut out of it left right and center, for ease of use.
The differences between mIRC and a real programming language:
mIRC:
mIRC uses "aliases", which are "simulated functions".
mIRC uses varibles which automatically convert data.
mIRC isn't object oriented.
+more
Java:
Java uses real functions
Java uses primitive types for its varibles. For instance, if you have a varible named "x" of the type "int" (Integer), you can't put the String "Bob" into it and expect it to work. The reason for this is it is trying to use the least amount of memory possible - an Int takes up less memory than a string (how long is a piece of string, we don't know so we just take up a lot of space to start off with and hope!)
Java is Object Oriented.

What is the Object Orientated nonsense?
Well, think back to making a dialog.
What mIRC script does is create a basic dialog object and that in turn adds other objects (buttons, text boxes, etc). You can create your dialog by /dialog -m <table> <name>
What does that mean?
You can create 2 copies of one dialog table with different names
They are the same beast, just different INSTANCES of them. Sadly mIRC doesn't do this often with aliases and other language features, but in most cases it doesn't need to.

Whats the use of it all?
Lets look at this:
$com(excel,Visible,3)

Somewhere in Excel.Application's code is soemthing like this
private int Visible;
public int get_Visible() {
return Visible;
}
public int set_Visible(int Value) {
Visible = Value;
makeAppVisible;
return 1;
}
What that all is is as follows:
Line 1: a Varible named "Visible". It stores an int or Integer (whole number). It is PRIVATE, so only functions in the same program can "see" it. mIRC can't meddle with it, as that would be dangerous.
Line 2: a Method named get_Visible. It returns the value of Visible, which can't been seen by anything else externally. It is PUBLIC which means that everyone can see & use it. It takes no arguments (parameters, $1- etc).
Line 5: A method name set_Visible. It sets the value of Visible to Value (they are both integers so there is no need to convert from one type to another). It returns 1 if its successful. If its not successful, it won't return anything (NULL). It also does all of the code to show the app

This whole process is known as "Encapsulation", and is a key programming technique in many successful languages today.
So, here we are.
Reality:
Excel object
-Property Visible
-Method get_Visible
-Method set_Visible
What mIRC see's:
Excel
-Method Visible

get_ & set_Visible are combined into a "Visible" method for teh ease of use mIRCers. DISPATCH_METHOD + DISPATCH_PROPERTYGET simply calls the get_Visible method, DISPATCH_METHOD + DISPATCH_PROPERTYPUT does the same with set_Visible

I think we have covered enough theory about implementing for you to get a rough grasp of things to come.

Part 2: Creating my first COM object.
Run off to msdn.microsoft.com, downloads, windows script, and get Script Component Wizard.
It will make things easier, like assiging a CLSID.
Run it.
Follow the prompts and make a new com object, called "Monkey"
Scripting Langauge of your choice...
Scriptlet, not DHTML
Add property "Version", value "1.0.0", get only
Add property "Temp", value "Bob string!",put, get
Add method inputPrompt, arguments text
"Finish"

You should end up with something like this:
<scriptlet>

<Registration
Description="monkey"
ProgID="monkey.Scriptlet"
Version="1.00"
ClassID="{65378720-7da6-11d7-ab3c-525400edd75c}"
>
</Registration>

<implements id=Automation type=Automation>
<property name=version>
<get/>
</property>
<property name=temp>
<get/>
<put/>
</property>
</implements>

<script language=JScript>

var version = "1.0.0";
var temp = "Bob String";

function get_version()
{
return version;
}

function get_temp()
{
return temp;
}

function put_temp(newValue)
{
temp = newValue;
}
</script>
</scriptlet>

PHWOAR! Find whewre its been generated to (path\monkey.sct). right click and "register" it with windows, if it has problems it will tell you.
Problems appear in the form of "[line,col] Problem text". I'll let you debug it.
Once its registered, the rest is easy.
Go into mIRC and use the excel example alias as a guide.

;monkey.Scriptlet
alias monkey {
;open a new monkey.Scriptlet
comopen monkey monkey.Scriptlet
;if it won't open, yell out and stop doign stuff
if ($comerr) { echo comopen failed | halt }
;annoy it for stuff
var %test = $com(monkey,version,3)
echo -a version: $com(monkey).result

var %test = $com(monkey,temp,3)
echo -a temp1: $com(monkey).result

;change the value of temp to fish
if ($com(monkey,temp,4,string,fish) == 0) {
echo -a Didn't work
halt
}

var %test = $com(monkey,temp,3)
echo -a temp2: $com(monkey).result
comclose monkey
}


As you can see, $com.result holds the returned data.
Muddle through that, my fingers are tired and I want pie.

Part 4: Where's my part 3?
Well if your sharp enough you'll have noticed that its missing someting, not just a part 3. All I've shown you is how to get and set properties in your COM object, not how to call methods. Or have I? I've shown you how to get/set properties through their METHODS, so you can make your own method calls to custom methods (functions). Here's a tip, tho, don't try to return anything funky! Stick to your basic types, and you'll be fine.

Part 5:Real world applications
What can you do in Jscript you can't do in mIRC:
Better maths object (ie proper Psuedorandom numbers!)
An arguments object - better than using $1- for stuff that needs switches
Better Boolean object (for when $iif just doesn't cut it)
Enumerator - enables you to use a collection with an index (array styles)
Arrays! (not 2d tho, sigh)
Easier activeX com object implementation (well, maybe...)
Better error handling
Functions as objects! This is good enough to include an example methinks:

Example 1
function add(x, y)
{
return(x + y); //Perform addition and return results.
}
Example 2
var add = new Function("x", "y", "return(x+y)");

In either case, you call the function with a line of code similar to the following:

add(2, 3);

A Global object
A slightly better regexp object (yes, OBJECT is better in this case sometimes)
More organised string handling (its an OBJECT! gasp!)
VBarrays even



Of course its up to you to decide whats the _best_ option for the task, the script, and your ability. You should script for the end user rather than for what looks good for you.
If this is confusing, yes, look for a second edition (much cleaner, and neater. I'll probably even post it on my website.) Email me @ gekko_dev@hotmail.com if you have questions or queries.

Joined: Dec 2002
Posts: 1,237
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Dec 2002
Posts: 1,237
*pauses to grab a beer and a bite to eat before continuing to read further*

Joined: Feb 2003
Posts: 309
C
Fjord artisan
OP Offline
Fjord artisan
C
Joined: Feb 2003
Posts: 309
well, i'm fed up here its shifting its rantyness to mIRCscripts.org 's POST YOUR TUTORIAL forum.

Page 1 of 2 1 2

Link Copied to Clipboard