mIRC Homepage

read - parse regedit

Posted By: vinifera

read - parse regedit - 18/02/15 04:09 PM

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
Posted By: Wims

Re: read - parse regedit - 18/02/15 06:48 PM

I found this: http://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)
Posted By: vinifera

Re: read - parse regedit - 18/02/15 10:21 PM

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
Posted By: Wims

Re: read - parse regedit - 18/02/15 11:24 PM

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
Posted By: vinifera

Re: read - parse regedit - 19/02/15 12:10 AM

dunno what that means laugh
but it works .. so i'm happy laugh
© 2022 mIRC Discussion Forums