Shoutbox

how can i get information from registry values to use in a script? - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: how can i get information from registry values to use in a script? (/showthread.php?tid=65324)

how can i get information from registry values to use in a script? by skyserpent on 08-24-2006 at 03:09 PM

does anyone know how i could get information from registry values to use in a script?


RE: another request by markee on 08-24-2006 at 03:19 PM

Have a look at this page for information on reading/writing/deleting registry values.


RE: another request by skyserpent on 08-24-2006 at 03:20 PM

thanks, i hope i can figure out what to do/i hope it'll work


in this code:

var WSH = new ActiveXObject('WScript.Shell');
nPies = WSH.RegRead(MsgPlus.ScriptRegPath + "numberofpies");

where do i put the registry path?

and yes, i am new to this lol
RE: another request by markee on 08-24-2006 at 03:36 PM

quote:
Originally posted by skyserpent
in this code:

var WSH = new ActiveXObject('WScript.Shell');
nPies = WSH.RegRead(MsgPlus.ScriptRegPath + "numberofpies");

where do i put the registry path?

and yes, i am new to this lol
MsgPlus.ScriptRegPath + "numberofpies" is the registry path (including the registry name) and nPies is the variable that you are asining the value of the registry to.
RE: another request by skyserpent on 08-24-2006 at 03:49 PM

im still not quite sure what you mean... could you please show me how i would read the registry path: HKEY_CURRENT_USER\Software\Microsoft\Keyboard\Native Media Players\WMP and the reg name: AppName

thanks


RE: another request by markee on 08-24-2006 at 03:54 PM

code:
var WSH = new ActiveXObject('WScript.Shell');
var App_Name = WSH.RegRead("HKEY_CURRENT_USER\\Software\\Microsoft\\Keyboard\\Native Media Players\\WMP\\AppName");
Debug.Trace(App_Name);
This will also return the AppName into the script debugging window for you too.  Make sure you always use \\ and not just \ because this is the way JScript has to have it.
RE: another request by Matti on 08-24-2006 at 03:55 PM

It's not recommend to use full paths since they can differ on other systems. However, this is how you should do it that way:

code:
var WSH = new ActiveXObject('WScript.Shell');
wmpAppName = WSH.RegRead("HKEY_CURRENT_USER\Software\Microsoft\Keyboard\Native Media Players\WMP\AppName");

RE: another request by skyserpent on 08-24-2006 at 03:57 PM

so what should i use intead of using full paths?


RE: RE: another request by markee on 08-24-2006 at 04:04 PM

quote:
Originally posted by Mattike
It's not recommend to use full paths since they can differ on other systems. However, this is how you should do it that way:
code:
var WSH = new ActiveXObject('WScript.Shell');
wmpAppName = WSH.RegRead("HKEY_CURRENT_USER\Software\Microsoft\Keyboard\Native Media Players\WMP\AppName");

Each of the \ shuld be \\ in JScript when looking through folders.  Also for something like this it is very difficult to make a variable path (see my post).  Actually I don't think this registry path can be any different anyway or else you would run into troubles elsewhere (I could be horribly wrong though).
RE: another request by skyserpent on 08-24-2006 at 04:12 PM

ok, well thanks for this... just a few more questions...

is there a way of getting the script to check if WMP is running then if it is change my PSM to something and if it isnt running change my PSM to something else?


RE: another request by markee on 08-24-2006 at 04:22 PM

Have a look at [Release] AppMon+ (Now With Xfire Support - Beta).  This does what I think you are after and a lot more (might not be your code but it does a great job).