PROCESSOR_ARCHITECTURE

(defun AcadPlatform (/ proc_arch str)    (if (and (setq proc_arch (getenv "PROCESSOR_ARCHITECTURE"))
(< 1 (strlen proc_arch))
(eq "64" (substr proc_arch (1- (strlen proc_arch))))
)
(setq str "x64")
(setq str "x32")
)
str
)

i found this routine on this forum from daniel.
this effectively tests the ACAD platform and not the windows OS ? so ACAD 32bit or BCAD 32bit on 64bit returns "x32"
thanks !

Comments

  • And...

    is
    (getenv "IsWindowsX64") fullproof in both BCAD and ACAD ?
  • Dear Dirk,

    no, PROCESSOR_ARCHITECTURE only returns the mode of the CPU ...
    values are AMD64, x32 ....

    So even if you install 32-bit-OS you can get the above values - therefore, it is
    not a safe indicator what version (32/64 bit) of CAD system you are running;
    besides, you can run 32 + 64 bit AutoCAD on Windows 64 bit :-)

    Also, I do not have (getenv "IsWindowsX64") on my machine ...

    Many greetings !
  • thx for the reply Torsten,

    My goal it to make a single installer for my app.
    If the OS is 32 bit things are easy but when it is 64 bit it depends on the ACAD version. When it is 32 bit my app won't work in ACAD. When it is BCAD it will however. When it is 64 bit ACAD it will work too.
    Problem is my installer puts 32 and 64 bit files in different directories depending on OS version...

    Doslib does have functions i believe but then you would first need to know what doslib to load...



  • you can use WMI as well

    [code]

    (defun c:doit ( / item meth1 meth2 s wmi x)
     (setq WMI (vlax-create-object "WbemScripting.SWbemLocator")
           meth1 (VLAX-INVOKE WMI 'ConnectServer "." "\\root\\cimv2" nil nil nil nil nil nil)
           meth2 (vlax-invoke meth1 'ExecQuery "SELECT * FROM Win32_OperatingSystem ")
           s (vlax-for item meth2 (setq x (cons(vlax-get item 'OSArchitecture)x)))
     )
     (vlax-release-object wmi)
     s
    )

    [/code]

    Cheers

  • darn OSARCHITECTURE is not available on XP, but then again, there are not many 64bit XP systems out there

  • edit... maybe it is, but it's not on my virtual machine ..
  • Dear Dirk,

    here an solution, which is *opposite* to MS usual (and useless) design :
    do NOT install into default program folders - those are different and under
    ownership of "TrustedInstaller", at least in Win7 .... so user can not change anything
    in those folders, nor that your program can write a file in it at all ...

    stupid approach - because installing into any own folder like c:\tools\MyApp complete
    bypasses that "protection" ...

    Then, you can simply install all files into single program folder .... and the filenames indicate
    where the file applies to :
    MyTool32.arx -> Acad 32 bit
    MyTools64.arx ->Acad 64 bit
    MyTools32.brx -> Bricscad

    why not ? :-)

    Many greetings
    Torsten
  • Link:
    http://blog.jtbworld.com/2007/04/determine-programmatically-if-autocad.html
    Make sure to follow the David Wang link (PROCESSOR_ARCHITEW6432).

    Other interesting variables:
    (getvar 'platform) ; => OS info.
    (getvar 'acadprefix) ; => Program folder info: 32-bit programs are installed in a different default folder in 64-bit Win.
    But of course the user may have installed the cad program in a different folder.
This discussion has been closed.