Sign in to follow this  
Followers 0
Syed23

OS Architecture Help

8 posts in this topic

hi Friends,

For past couple of weeks i am working on a project. That tool is only for Windows 7. But i have to meet the requirement like that should work for both 32 and 64 bit. I have completed most of my project work. But i need small help to make the project more efficient and simple.

What i mean is , currently in my project i am using XML files as a reference file in order to the tool work. Now problem is i have 2 XML files. Based on the OS Architecture the correct XML file will be called. Firs the ink let me tell what the XML will contain. The XML file contain the Application details.That means the XML will have the application name and Where the application will be available(like C:\program Files\). Now here the complication is in 32 bit the default installed application location will c:\program files, but in Windows 7 64 bit the default location will be as c:\program files(x86).... for these difference i am maintaing 2 different XML files.Now i am thinking to do it in different way..

Is there a way or help do we have? like if i run the tool....based upon the OS architecture the it should go and check the application in there respective location.

For Example,

If i run the tool on Windows 7 64 bit then the tool should automatically take application installed default location as "C:\program Files(x86)...How can we do that?

Any suggestions appreciated!


Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Share this post


Link to post
Share on other sites



Use @ProgramFilesDir


My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

MY PROJECTS


Active: IRC UDF, WindowEx UDF
Discontinued: GithubBubbleSort UDF

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Look at Environment Variables as @ProgramFilesDir will install to C:\Program Files on Windows 7 x64.

EnvGet("PROGRAMFILES(X86)")
EnvGet("PROGRAMFILES")
Edited by guinness

_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

question if i may

ConsoleWrite (EnvGet("PROGRAMFILES") & @CRLF) 
ConsoleWrite (EnvGet("PROGRAMFILES(X86)") & @CRLF)

returns this on win7 enterprise 64 bit

C:\Program Files (x86)

C:\Program Files (x86)

surely the the first one should have used the 32 bit allowed for 32 bit programs?

from the helpfile

Returns the requested variable (or a blank string if the variable does not exist)

And be just?

C:\Program Files

Or am i misunderstanding

Share this post


Link to post
Share on other sites

It depends how you compile your script. When you compile it as x86 and run it on a x64 OS you will get C:\Program Files (x86)

But if you compile it as x64 you will get C:\Program Files.

#AutoIt3Wrapper_UseX64=n ;change it to y to compile it as x64 (full SciTE package must be installed)

MsgBox(0, "Test", @ProgramFilesDir)

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

%PROGRAMFILES% will be different if you run the x86 version of Autoit under x64 Windows

IF @OSArch = 'x86' Then
    ConsoleWrite(EnvGet("PROGRAMFILES") & @CRLF)
Else
    ConsoleWrite(EnvGet("ProgramW6432") & @CRLF)
    ConsoleWrite(EnvGet("PROGRAMFILES(X86)") & @CRLF)
EndIf

That returned

C:\Program Files

C:\Program Files (x86)

im sorry im not getting this so the x86 failed because im 64bit

6432 returned program files because??

programfiles x86 obviously exists cause im 64 bit

so why does 6432 return program files?

Edited by Chimaera

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

im sorry im not getting this so the x86 failed because im 64bit

6432 returned program files because??

programfiles x86 obviously exists cause im 64 bit

so why does 6432 return program files?

The both extra variables ProgramW6432 and ProgramFiles(x86) exist in an x64 Windows,

so one can always easily get the programm files folder for 64Bit apps and the one for the 32Bit apps.

They point to the correct folder, no madder if you app is a native one or a WoW64 process.

The good old ProgramFiles will point the the folder depending on your app: x64 or x86.

Edited by JFX

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0