mIRC Home    About    Download    Register    News    Help

Print Thread
#143969 04/03/06 04:38 AM
Joined: Oct 2003
Posts: 20
A
asdfjkl Offline OP
Ameglian cow
OP Offline
Ameglian cow
A
Joined: Oct 2003
Posts: 20
As well as my previous post, maybe a different scripting language could be used. I'm not saying to abandon the old one. Just make mIRC support different languages like VB and perl.

#143970 04/03/06 07:04 AM
Joined: Jun 2003
Posts: 5,024
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Jun 2003
Posts: 5,024
I don't see the difference between this suggestion, and your other one?

Regards,


Mentality/Chris
#143971 04/03/06 07:27 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
I doubt MS is gonna hand over the vb runtime enviroment, on a whim.

#143972 04/03/06 08:22 AM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Code:
; /wscripting.addcode <code> - adds the specified code to the object so it can later be used with $wscripting.eval or /wscripting.run.
alias wscripting.addcode {
  if (!$com(%obj)) return
  noop $com(%obj,AddCode,3,bstr,$$1-)
}

; /wscripting.allowui $true/$false - enables/disables the ability to display user interfaces using the scripting object.
alias wscripting.allowui {
  if (!$com(%obj)) || (!$istok($true $false,$$1,32)) return
  noop $com(%obj,AllowUI,4,bool,$1)
}

; /wscripting.begin - opens the scripting object. This must be called before anything else.
alias wscripting.begin {
  if ($com(%obj)) return
  set %obj scriptingobj $+ $ticks
  .comopen %obj MSScriptControl.ScriptControl
}

; /wscripting.end - close the scripting object.
alias wscripting.end {
  if (!$com(%obj)) return
  .comclose %obj
  unset %obj
}

; $wscripting.eval(<function/variable/etc>) - evaluates the function/variable/etc you pass to it.
alias wscripting.eval {
  if (!$com(%obj)) return
  noop $com(%obj,Eval,3,bstr,$$1)
  return $com(%obj).result
}

; /wscripting.executestatement <code> - executes some code.
alias wscripting.executestatement {
  if (!$com(%obj)) return
  noop $com(%obj,ExecuteStatement,1,bstr,$$1-)
}

; /wscripting.language <language> - sets the scripting language. You should call this straight after /scripting.begin.
alias wscripting.language {
  if (!$com(%obj)) return
  noop $com(%obj,Language,4,bstr,$$1)
}

; /wscripting.run <sub/procedure> - runs a procedure within the code you've added.
alias wscripting.run {
  if (!$com(%obj)) return
  noop $com(%obj,Run,3,bstr,$$1)
}

/*
* Examples
*/

; $gettime - returns the value of the Now() function in VB.
alias gettime {
  wscripting.end
  wscripting.begin
  wscripting.language VBScript
  var %result = $wscripting.eval(Now)
  wscripting.end
  return %result
}

; /msgbox <text> - displays a message box containing <text>
alias msgbox {
  wscripting.end
  wscripting.begin
  wscripting.language VBScript

  wscripting.addcode $&
    Sub Main() $crlf $&
    msgbox $qt($1-) $crlf $&
    End Sub

  wscripting.run Main
  wscripting.end
}

; /msgbox2 <text> - same as above, just showing some of the other aliases.
alias msgbox2 {
  wscripting.end
  wscripting.begin
  wscripting.language VBScript
  wscripting.executestatement msgbox $qt($1-)
  wscripting.end
}


You can now use any scripting language that the windows scripting host supports (vbscript, jscript, perl, lisp, many others). Enjoy!

Now leave mIRC alone :tongue:

#143973 04/03/06 06:02 PM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Unfortunately there are still many inconveniences related to using the scriptcontrol in mIRC. As it stands, it serves a purpose, but it is handicapped. Some issues are related with the threading model of the script control being different from mIRC's model. K told me it would require too much work, so using $comcall with the scriptcontrol will never be possible. That alone for me is a huge handicap.

There's also a memory leak when using the scriptcontrol. Additionally, on larger code, you run into the problem of the string too long limit, which means you are forced to split your code up in different functions, whereas you wouldn't need to worry about it with a .vbs file.

One last thing that is unfortunate (though out of Khaled's hands) is that the WSH isn't available in the scriptcontrol, so no wscript.sleep and the likes.

Oh well, it's still better than nothing!

To the original requester: you know you can create a scripting file like .vbs .js .wsf etc. right? That already gives you access to other scripting engines. The biggest problem with this approach is that when you want to release code like that to the public, that many people have Norton etc. running which often disable windows scripting, or atleast show a warning, which is something I really detest. Another drawback is getting the results relayed back to mIRC, usually this needs to go through a file which means disc access, although fortunately I have some sneaky other way to get this done without using a file smile

So yes, I would prefer to see support for other scripting languages like VBScript.

Code:
alias test {
  using VBScript {
    msgbox "Hello World"
  }
  using JScript {
    var shell = new ActiveXObject("Wscript.Shell");
    shell.popup("Hello World");
  }
}

This is simplistic code of course for illustration purposes.

Haha anyway, the above code will more than likely never happen, but it was fun imagining what it could look like.


Gone.

Link Copied to Clipboard