mIRC Home    About    Download    Register    News    Help

Print Thread
#251420 18/02/15 04:09 PM
Joined: Jun 2009
Posts: 96
V
Babel fish
OP Offline
Babel fish
V
Joined: Jun 2009
Posts: 96
mind you... I havent touched mirc scripting in like ... 5 years :P
so don't shoot me down :P

can someone give me simple demonstration
how can mirc (6x version if possible) read certain
data from windows registry, and returned value echo in window

for example to read windows SKU, under
HKLM\SOFTWARE\Microsoft\Windows NT\Current Version: ProductName

Joined: Jul 2006
Posts: 4,180
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,180
I found this: https://forums.mirc.com/ubbthreads.php/ubb/showflat/Number/26829 which works, but I can't get it to return a value:

Code:
alias regread {
  var %a $ticks
  .comopen %a WScript.Shell
  if ($comerr) return ERROR
  var %c $com(%a,RegRead,3,bstr,$1)
  if (!%c) || ($comerr) {
    .comclose %a
    return ERROR
  }
  var %b = $com(%a).result
  .comclose %a
  return OK %b
}


Code:
//echo -a $regread(HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductName)
Simply returns OK here, whereas I can see the correct value using the registry editor (/run regedit)


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Jun 2009
Posts: 96
V
Babel fish
OP Offline
Babel fish
V
Joined: Jun 2009
Posts: 96
yeah, i get "ok" too but no return value frown

BUT
i found one that works here:
http://www.mircscripts.org/forums.php?cid=3&id=142005

Last edited by vinifera; 18/02/15 10:40 PM. Reason: x
Joined: Jul 2006
Posts: 4,180
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,180
Right, the problem is that:
Originally Posted By: FiberOptics
The problem with WSH's regread method is that it returns the result from a REG_BINARY key in a VBarray rather than a string, so we can't access it in mIRC.
The trick is to use a COM object to execute some VB


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Jun 2009
Posts: 96
V
Babel fish
OP Offline
Babel fish
V
Joined: Jun 2009
Posts: 96
dunno what that means laugh
but it works .. so i'm happy laugh


Link Copied to Clipboard