Sign in to follow this  
Followers 0
rudi

Autoit Macros, that differ for "x86" <-> "x64" compiled scripts.

7 posts in this topic

#1 ·  Posted (edited)

Hi.

Some Autoit Macros return different values on X64 Win7 boxes, dependent on the target choosen upon compiling the script: x86 or x64.

Target = x64
@AutoItExe = file01installtoolstestAI3-Test-Macros-x64.exe
@OSArch = X64
@AutoItX64 = 1
@CommonFilesDir = C:Program FilesCommon Files
@ProgramFilesDir = C:Program Files
@SystemDir = C:\Windows\System32\

Target = x86
@AutoItExe = file01installtoolstestAI3-Test-Macros-x86.exe
@OSArch = X64
@AutoItX64 = 0
@CommonFilesDir = C:Program Files (x86)Common Files
@ProgramFilesDir = C:Program Files (x86)
@SystemDir = C:WindowsSysWOW64

I'd like to get as well the "x64" values of these Autoit Macros for the Windows 7 64bit boxes, when using the compilation target = "x86". The background is simply, that few PCs don't have a x64 capable CPU, so the scripts have to run on both, x86 and x64 Win7. Hence I compile them as "target = x86", as this will run on both, x86 and x64 Win7 boxes.

But on the Win7 boxes I need to get both, the "x86-macro-values" as well as the "x64-macro-values".

One thing I could think of is to compile the script as <scriptname>.exe (x86) and a 2nd time as <scriptname>-x64.exe, and then call the one from the other, in case "@OSArch = X64". But I'd like to avoid to have to compile two versions of these scripts.

Any other suggestions?

Regards, Rudi.

<edit>

PS: I missed to mention, that trying to make use the Windows Environment Variables doesn't help here:

e.g. envget("Programfiles") and envget("Programfiles(x86)") will *BOTH* return "c:Program files(x64)", when the target of the script is "x86".

</edit>

Edited by rudi

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
Share on other sites



The macros are evaluated at run-time. If the exe is compiled for 32 bit you'll get the 32 bit values otherwies the values for 64 bit.

Use directives

#AutoIt3Wrapper_Compile_Both=y
#AutoIt3Wrapper_UseX64=y
and you will compile for 32 and 63 bit in one go.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Hi.

Thanks for the incredible fast reply ;)

#AutoIt3Wrapper_Compile_Both=y
#AutoIt3Wrapper_UseX64=y

MsgBox(0,"Programfiles",@ProgramFilesDir & @CRLF & EnvGet("programfiles(x86)"))

doing so will produce *TWO* EXE files, one <scriptname>.exe, the other one <scriptname>_x64.exe.

The first one will return the values for "x86" ONLY.

The "*_x64.exe" will not run on x86 systems: " ... is not a valid Win32 application."

Is there a posibility to create a x64 application, with a "x86 fallback" that will only execute, when runned on x86 systems?

Regards, Rudi.

Regards, Rudi.


Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

doing so will produce *TWO* EXE files, one <scriptname>.exe, the other one <scriptname>_x64.exe.

Correct.

The first one will return the values for "x86" ONLY.

Correct.

The "*_x64.exe" will not run on x86 systems: " ... is not a valid Win32 application."

64-bit executables work on 64-bit OS's only.

Is there a posibility to create a x64 application, with a "x86 fallback" that will only execute, when runned on x86 systems?

Create a 32-bit wrapper and use FileInstall to 'FileInstall' the 32-bit and 64-bit, then in the wrapper find out if the OS is x64 and 'FileInstall' the 64-bit, else use the 32-bit executable. 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

Hi.

thanks for your reply. Looks like the wrapper is the only way to get it done in one executable... ;)

Let me ask again this one question: There is no way to get the x64 values for the autoit macros from an Autoit EXE file, compiled with "target = x86" ?

Regards, Rudi.


Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
Share on other sites

Let me ask again this one question: There is no way to get the x64 values for the autoit macros from an Autoit EXE file, compiled with "target = x86" ?

Correct

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Hi.

Frustrating...

You've *SPOILED* my Sunday ;)

:):D :D

OK, I'll use the fileinstall() solution, you've mentioned before.

Thanks for your replies, Rudi.

PS: Wouldn't that be a nice feature for future releases of Autoit, to get the Win7 macro values for x64, even when the script is compiled to x86, and vice versa?


Earth is flat, pigs can fly, and Nuclear Power is SAFE!

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