markbb Posted September 14, 2007 Share Posted September 14, 2007 (edited) Hi, I am looking into adding a "getArch()" function so I get retrieve the CPU architecture (x86 or AMD64).Where is the best place to add the code for this?I was thinking in API.JS, just after "getOSver()".Something like:function getArch(){ position="api.js"; whatfunc="getArch()"; var arch=""; try { arch = WshShell.ExpandEnvironmentStrings("%PROCESSOR_ARCHITECTURE%"); } catch (ex) {; } if (arch=="x86") return "x86"; if (arch=="AMD64") return "AMD64"; return "Not found";}What does everyone think, would this work.I am alos looking at doing the same thing for retrieving the Hardware manufacturer, from the BIOS. Edited September 14, 2007 by markbb Link to comment Share on other sites More sharing options...
Kelsenellenelvian Posted September 14, 2007 Share Posted September 14, 2007 Sweet! Looks nice... Link to comment Share on other sites More sharing options...
markbb Posted September 14, 2007 Author Share Posted September 14, 2007 Thanks for the vote of approval. I'll add it in today and let everyone know if it works OK. Link to comment Share on other sites More sharing options...
markbb Posted September 14, 2007 Author Share Posted September 14, 2007 Hummm, first try hasn't worked as planned.On x86, worked exaclty as required, only displayed 32bit apps. (using condition of getArch()=="x86")On AMD64 system only displayed 32bit apps. (using condition of getArch()=="AMD64").I'll check again later. Any thoughts anyone on WPI riunning on AMD64 windows? Link to comment Share on other sites More sharing options...
sp00f Posted September 15, 2007 Share Posted September 15, 2007 I dont know what you want to do, but im using it in x64 and x86 , works fine in both. Link to comment Share on other sites More sharing options...
markbb Posted September 17, 2007 Author Share Posted September 17, 2007 OK, so I have tested it a little more.When I run WPI with the additional code in API.js and with the "Condition" added to the config.js for the architecture. I get the following results.:- With "condition" of getArch()=="x86" for 32 bit apps and getArch()=="AMD64" for 64 bit apps.- On x86 machine it will display only 32 bits apps- On AMD64 machine it will display only 32 bits apps and NOT the 64 bit apps. as the changes should do.I have run the extra code standalone and it does return x86 for x86 Architecture system and AMD64 for AMD64 Architecture.So I am a little lost as to why it will not work in WPI.Is there a way of displaying on the main WPI screen what the contents of getArch() is when I launch WPI? Link to comment Share on other sites More sharing options...
zorphnog Posted September 17, 2007 Share Posted September 17, 2007 You can throw in an alert line that will display the value. Something like: alert("Architecture value = "+getArch()). Put it in WPI.hta somewhere after the api.js file is loaded. Link to comment Share on other sites More sharing options...
markbb Posted September 17, 2007 Author Share Posted September 17, 2007 Thanks ZORPHNOG for the alert command.Well I am completely confused by the problem now. As on a AMD64 version of Windows 2003 Server I get the response x86 using the alert command in WPI.HTAI have changed the code to:function getArch(){ position="api.js"; whatfunc="getArch()"; return WshShell.ExpandEnvironmentStrings("%PROCESSOR_ARCHITECTURE%");}So that it only returns the environment variable, but it still thinks it is x86!!!Is there a problem run WshShell.ExpandEnvironmentStrings("%PROCESSOR_ARCHITECTURE%") in WPI? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now