MSFN Forum: objShell.Run issues... - MSFN Forum

Jump to content


  • 3 Pages +
  • 1
  • 2
  • 3
  • You cannot start a new topic
  • You cannot reply to this topic

objShell.Run issues... I keep getting 'Path not found" errors?!?!?! Rate Topic: -----

#41 User is offline   Geej 

  • Senior Member
  • PipPipPipPip
  • Group: Members
  • Posts: 634
  • Joined: 01-January 08
  • OS:XP Pro x86
  • Country: Country Flag

Posted 07 March 2013 - 01:30 AM

Sorry if my code is wrong.
I was just trying to relate the cmd logic directly into vbscript when I look harder at the cmd code.

Seems like Obj.AddressWidth method is much easier in vbscript. (in Post #20)

vbscript is not something I look or consider scripting as my first choice of language, also there are always so much to learn...

Cheers


#42 User is offline   bphlpt 

  • MSFN Expert
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 1,075
  • Joined: 12-May 07

Posted 07 March 2013 - 03:23 AM

I guess this will show how both GSM and I can get the same result with different methods:

Spoiler

Same arrangement as last time. My revised "second rated code" :):

<!DOCTYPE html>
<html>
<head>
<script language="javascript">
function myFunction()
{
var Act = new ActiveXObject("WScript.Shell");
var proc_archP = Act.ExpandEnvironmentStrings("%PROCESSOR_ARCHITECTURE%");
var proc_arch6432P = Act.ExpandEnvironmentStrings("%PROCESSOR_ARCHITEW6432%");
var SEnv = Act.Environment("System");
var proc_archS = SEnv("PROCESSOR_ARCHITECTURE");
var proc_arch6432S = SEnv("PROCESSOR_ARCHITEW6432");
alert("Process\nPROCESSOR_ARCHITECTURE=["+proc_archP+"]\nPROCESSOR_ARCHITEW6432=["+proc_arch6432P+"]\n\nSystem\nPROCESSOR_ARCHITECTURE=["+proc_archS+"]\nPROCESSOR_ARCHITEW6432=["+proc_arch6432S+"]");
}
</script>
</head>
<body>

<input type="button" onclick="myFunction()" value="Show bitness">

</body>
</html>


Note that now I get the values of %PROCESSOR_ARCHITECTURE% and %PROCESSOR_ARCHITEW6432% at both the process and the system level.

32-bit IE9 is still on the bottom left and 64-bit IE9 is still on the bottom right.

So to get the OS bitness you can use the same logic that I have advocated all along, testing the values of both %PROCESSOR_ARCHITECTURE% and %PROCESSOR_ARCHITEW6432%, using either the process or the system level variables will give the same result, or you can just check the value of only the SYSTEM %PROCESSOR_ARCHITECTURE%, if you are smart enough to know that you can do that. AFAIK, you can't do the latter via CMD batch script.

Geej, I don't think the code you posted in post #37 is "wrong". I think it will work correctly, it's just that since you were testing the SYSTEM level variables, you really didn't need to test them both. Testing only %PROCESSOR_ARCHITECTURE% should give the same result.

Cheers and Regards

This post has been edited by bphlpt: 07 March 2013 - 03:37 AM


#43 User is offline   Yzöwl 

  • Wise Owl
  • Group: Super Moderator
  • Posts: 4,363
  • Joined: 13-October 04
  • OS:Windows 7 x64

Posted 07 March 2013 - 12:58 PM

View PostGeej, on 07 March 2013 - 01:30 AM, said:

Seems like Obj.AddressWidth method is much easier in vbscript. (in Post #20)

vbscript is not something I look or consider scripting as my first choice of language, also there are always so much to learn...


How difficult is the single line batch/comand using WMIC I posted in post 21?

#44 User is offline   gunsmokingman 

  • MSFN Master
  • Group: Super Moderator
  • Posts: 2,351
  • Joined: 02-August 03
  • OS:none specified
  • Country: Country Flag

Posted 07 March 2013 - 01:16 PM

It not second rated now you are using the correct object for the tasks. You could use ExpandEnvironmentStrings to
get the w6432, it uses the process environment. My only critique is instead of alert it might of been nicer to have
it display the information in the HTA.

Example
<TITLE>Test</TITLE>
<STYLE type="text/css">
  Body
   {
    Padding-Top:5pt;Padding-Bottom:1pt;Margin:1pt;
    Font-Size:10.25pt;Font-Weight:Bold;
    Font-Family:Segoe Ui, Arial,Tahoma,Comic Sans MS;
    Color:Black;BackGround-Color:#EFE9E3;
    Text-Align:Center;Vertical-Align:Top;
   }
  DIV
   {
    Font-Size:9.25pt;Font-Weight:Bold;Color:#008181;
    Font-Family:Segoe Ui, Arial,Tahoma,Comic Sans MS;
    width:250;
   }
</STYLE>
 <script LANGUAGE='JScript'>
//-> Resize And Place In Approx center
 window.resizeTo(327,150)
 window.moveTo(screen.availWidth/2-(327/2),screen.availHeight/2-(150/2))
//-> Onload
  window.onload=function(){ 
  var Act = new ActiveXObject("WScript.Shell");
  var Env = Act.Environment("System")
  var W6432 = Act.ExpandEnvironmentStrings("%PROCESSOR_ARCHITEW6432%");
   Tx1.innerHTML= '<TABLE>PROCESSOR_ARCHITECTURE=['+Env("PROCESSOR_ARCHITECTURE")+']<TABLE>'+
                 '<TABLE>PROCESSOR_ARCHITEW6432=['+W6432+']<TABLE>'}
 </SCRIPT>  
 <BODY><DIV ID='Tx1'>  </DIV></BODY>


Attached File  SampleHta.png (101.64K)
Number of downloads: 5

#45 User is offline   Geej 

  • Senior Member
  • PipPipPipPip
  • Group: Members
  • Posts: 634
  • Joined: 01-January 08
  • OS:XP Pro x86
  • Country: Country Flag

Posted 07 March 2013 - 08:57 PM

View PostYzöwl, on 07 March 2013 - 12:58 PM, said:

View PostGeej, on 07 March 2013 - 01:30 AM, said:

Seems like Obj.AddressWidth method is much easier in vbscript. (in Post #20)

vbscript is not something I look or consider scripting as my first choice of language, also there are always so much to learn...


How difficult is the single line batch/comand using WMIC I posted in post 21?

Certainly not hard at all. I always have this "WOW' or "awesome" feeling for a single line code.
I wonder why David Wang comes up with such a confusing method using batch. He certainly confuse me :)

Share this topic:


  • 3 Pages +
  • 1
  • 2
  • 3
  • You cannot start a new topic
  • You cannot reply to this topic

2 User(s) are reading this topic
0 members, 2 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2013 msfn.org
Privacy Policy