Sign in to follow this  
Followers 0
aef03

Compile for 32bit on a 64bit system

13 posts in this topic

I have searched the forums and I understand the cautions about compiling autoit scripts to be 64bit EXEs.

My question, before I go to the effort of setting up, is can I compile AutoIt scripts for 32bit when I am running under a 64bit OS?

Thanks.

Share this post


Link to post
Share on other sites



I have searched the forums and I understand the cautions about compiling autoit scripts to be 64bit EXEs.

My question, before I go to the effort of setting up, is can I compile AutoIt scripts for 32bit when I am running under a 64bit OS?

Thanks.

Yes, you can compile 32-bit AutoIt scripts on a 64-bit machine. You can run 32-bit compiled scripts on a 64-bit machine as well.

Share this post


Link to post
Share on other sites

Yes, you can compile 32-bit AutoIt scripts on a 64-bit machine. You can run 32-bit compiled scripts on a 64-bit machine as well.

Thanks!

Sorry for the follow up - if I will only be compiling for 32-bit, which version of AutoIT (32 or 64) do I install on my 64 bit machine?

Thanks.

Share this post


Link to post
Share on other sites

I would install the x64 Version of AutoIt and then in SciTE4AutoIt3 use this >> #AutoIt3Wrapper_UseX64=N at the top of the Script.


_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

I would install the x64 Version of AutoIt and then in SciTE4AutoIt3 use this >> #AutoIt3Wrapper_UseX64=N at the top of the Script.

Thanks,

Could you please elaborate on why?

Compatibility with 32 bit systems is the absolute #1 priority.

Also, it sounds like from your message it is actually possible to install the 32-bit version?

Share this post


Link to post
Share on other sites

Because I personally tend to install all native x64 Versions if available. You can use the x32 Version of AutoIt if you want, its up to you! But just for good practice I would always add #AutoIt3Wrapper_UseX64=N if you want to create a x32 Compiled AutoIt Program.


_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

Because I personally tend to install all native x64 Versions if available. You can use the x32 Version of AutoIt if you want, its up to you! But just for good practice I would always add #AutoIt3Wrapper_UseX64=N if you want to create a x32 Compiled AutoIt Program.

Yes, I usually approach the softwware that as well - but I know I don't want to have to start sleuthing out obscure bugs in code that currently works rock solid when compiled on a 32-bit box.

Thanks for taking time to explain!

Share this post


Link to post
Share on other sites

I don't actually know, but if you install the x32 on a x64 system you might not need #AutoIt3Wrapper_UseX64=N as it might be checking the Version installed and not the system (have no way of testing) But like I said best practice to use #AutoIt3Wrapper_UseX64=N anyway.

Also I very rarely use x64 Compiled AutoIt EXE's especially when using ListViews and the dreaded WM_NOTIFY problem! :)


_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

When you install AutoIt you will be asked if you want to use x64 tools where available, choose yes and you will run x64 by default and will use #AutoIt3Wrapper_UseX64=n to run x86, choose no and use #AutoIt3Wrapper_UseX64=y to run x64.

If you know in advance that you are going to use x86 more often, then answer no and you wont have to use the statement so often.

But if you write code that only works on x64/x86 and share it with others, please use the statement anyway or you will confuse people.

And don't forget to install SciTE4AutoIt3

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

I have no interest in writing scripts compatible with 32 bit systems. All of our workstations here are 64 bit systems and I would like to write scripts to conform to that.

Many of the scripts I copy/paste from here do not work out of the gate and I didn't know why.... I got no errors - they just wouldn't function. 

For example - this is a drag and drop script for a listbox that would not work for me.

After reading this post, I added "#AutoIt3Wrapper_UseX64=N" to the top of it and ran it and it worked as expected. 

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Compile_Both=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <Constants.au3>
#include <GUIListBox.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>

Global $gnDRAGLISTMSGSTRING = _WinAPI_RegisterWindowMessage("commctrl_DragListMsg")
Global $DL_BEGINDRAG = $WM_USER + 133
Global $DL_DRAGGING = $WM_USER + 134
Global $DL_DROPPED = $WM_USER + 135
Global $DL_CANCELDRAG = $WM_USER + 136
Global Enum $DL_STOPCURSOR = 1, $DL_COPYCURSOR, $DL_MOVECURSOR
Global $gtDRAGLISTINFO = "long uNotification;long hWnd;long x;long y"
Global $gfItemAdded = False

Global $hMain = GUICreate("DragList", 200, 400)
Global $cListbox = GUICtrlCreateList("", 16, 16, 168, 368, $WS_BORDER + $WS_VSCROLL)
GUICtrlSetFont($cListbox, 10, Default, Default, "Tahoma")
Global $hListbox = GUICtrlGetHandle($cListbox)
GUICtrlSetData($cListbox, "Apples|Oranges|Bananas|Pears|Grapefruits|Limes|Lemons|Strawberries|Plums|Melons|Grapes|")
GUISetState()

_ComCtl32_MakeDragList($hListbox)

Global $wProcNew = DllCallbackRegister("_MyWndProc", "int", "hwnd;int;wparam;lparam")
Global $wProcOld = _WinAPI_SetWindowLong($hMain, $GWL_WNDPROC, DllCallbackGetPtr($wProcNew))

;While GUIGetMsg() <> -3
;    Sleep(10)
;Wend

While 1
    $idMsg = GUIGetMsg()
    Switch $idMsg
        Case $GUI_EVENT_CLOSE
            Exit
        case $idMsg <> -3
        Sleep(10)
    EndSwitch
WEnd

Exit

Func _MyWndProc($hWnd, $nMsg, $wParam, $lParam)
    Local $aRet, $nOldIndex, $sItemText
    If $nMsg = $gnDRAGLISTMSGSTRING Then
        Local $tDRAGLISTINFO = DllStructCreate($gtDRAGLISTINFO, $lParam)
        Local $uNotification = DllStructGetData($tDRAGLISTINFO, "uNotification")
        Local $x = DllStructGetData($tDRAGLISTINFO, "x"), $y = DllStructGetData($tDRAGLISTINFO, "y")
        Local $nItem = _ComCtl32_LBItemFromPt($hListbox, $x, $y)
        Switch $uNotification
            Case $DL_BEGINDRAG
                If $nItem < (_GUICtrlListBox_GetCount($hListbox) - 1) Then
                    _GUICtrlListBox_AddString($hListbox, "")
                    $gfItemAdded = True
                EndIf
                Return 1
            Case $DL_DRAGGING
                _ComCtl32_DrawInsert($hMain, $hListbox, $nItem)
                If $nItem = _GUICtrlListBox_GetCurSel($hListbox) Then Return $DL_STOPCURSOR
                Return $DL_MOVECURSOR
            Case $DL_DROPPED
                If $nItem > -1 Then
                    $nOldIndex = _GUICtrlListBox_GetCurSel($hListbox)
                    If $nItem <> $nOldIndex Then
                        $sItemText = _GUICtrlListBox_GetText($hListbox, $nOldIndex)
                        If $nItem < $nOldIndex Then $nOldIndex += 1
                        _GUICtrlListBox_InsertString($hListbox, $sItemText, $nItem)
                        _GUICtrlListBox_DeleteString($hListbox, $nOldIndex)
                        If $nItem > $nOldIndex Then $nItem -= 1
                        _GUICtrlListBox_SetCurSel($hListbox, $nItem)
                    EndIf
                EndIf
                If $gfItemAdded Then
                    _GUICtrlListBox_DeleteString($hListbox, _GUICtrlListBox_GetCount($hListbox) - 1)
                    $gfItemAdded = False
                EndIF
                _ComCtl32_DrawInsert($hMain, $hListbox, -1)
                Return 0
            Case $DL_CANCELDRAG
                If $gfItemAdded Then
                    _GUICtrlListBox_DeleteString($hListbox, _GUICtrlListBox_GetCount($hListbox) - 1)
                    $gfItemAdded = False
                EndIF
                _ComCtl32_DrawInsert($hMain, $hListbox, -1)
                Return 0
        EndSwitch
    EndIf
    Return _WinAPI_CallWindowProc($wProcOld, $hWnd, $nMsg, $wParam, $lParam)
EndFunc

Func _ComCtl32_MakeDragList($hWnd)
    Local $aRet = DllCall("comctl32.dll", "int", "MakeDragList", "hwnd", $hWnd)

    If @error Then Return SetError(@error, @extended, 0)
    Return $aRet[0]
EndFunc

Func _ComCtl32_LBItemFromPt($hWnd, $x, $y)
    Local $aRet = DllCall("comctl32.dll", "long", "LBItemFromPt", "hwnd", $hWnd, "long", $x, "long", $y, "long", 1)

    If @error Then Return SetError(@error, @extended, 0)
    Return $aRet[0]
EndFunc

Func _ComCtl32_DrawInsert($hWndParent, $hWnd, $nItem)
    DllCall("comctl32.dll", "none", "DrawInsert", "hwnd", $hWndParent, "hwnd", $hWnd, "long", $nItem)

    If @error Then Return SetError(@error, @extended, 0)
    Return
EndFunc

The question I have now is in the three functions at the bottom referencing the comctl32.dll - I can only assume that it is pulling from wow64 for that DLLCall - which for this script, is wrong. It needs comctl32.dll from system32.

How would I develop this same script for native 64 bit support? So when it goes to the comctl32.dll in wow64 it will work correctly. 

Edited by JakeKenmode

Share this post


Link to post
Share on other sites

32 bit programs will run on 64 bit operating systems. Probably 90% of the programs that run on a 64 bit Windows are actually 32 bit versions. You'll find FAR more programs listed in the C:Program Files (x86) folder than you will in the C:Program Files folder.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

While I understand this - I am still tasked with writing native 64 bit scripts. 

Would your advice be to write 32 bit scripts and just use #AutoIt3Wrapper_UseX64=N to force it to use 32bit?

Share this post


Link to post
Share on other sites

Unless you absolutely need to compile it for x64, then compile it as a 32 bit program. The only thing you'd need to worry about, as you mentioned above, is making sure the right DLLs are being used when you run the script. Folder redirection would come into play at that point.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

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