Jump to content

Recommended Posts

Posted

My script was complied using the 32bit complier and work fine on 32 bit machines but fails to work on 64 bit.

Trying to run script on Windows 7 32 & 64bit machines.

$var = RegRead('HKLM\SOFTWARE\ODBC\ODBC.INI\VC Test', 'Server')
If @error = "0" Then
    RegWrite('HKLM\SOFTWARE\ODBC\ODBC.INI\VC Test', 'Server', 'Reg_sz', 'HQSQLDEV01')
EndIf
Exit
Posted

Doesn't it run at all (exe crashes) or doesn't it do what you want?

Please have a look at the help file (regread function). There is some info about running AutoIt on 64-bit

Function RegRead:

... When running on 64-bit Windows if you want to read a value specific to the 64-bit environment you have to suffix the HK... with 64 i.e. HKLM64. ..."

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted (edited)
It's not that easy I stand corrected, it is that easy for at least HKLM and maybe more (just add '64' => HKLM64) :mellow:. I'm talking about Windows 7 x64 btw. For example, the 64bit version of HKEY_CLASSES_ROOT = HKEY_CLASSES_ROOT\Wow6432Node\. Same for HKEY_LOCAL_MACHINE\Software => HKEY_LOCAL_MACHINE\Software\Wow6432Node. These are, however, only used by true 64bit programs, so not by 32bit versions. If ODBC is 32 bit it would be located at the same location, and your script probably works for me (Win7 64 bit). I don't know why the compiled version wouldn't work. A script I compiled on my 64 bit machine (as 32 bit .exes) works on 32bit windows versions. It also uses RegRead, only once though. Edited by d4ni
Posted

Doesn't it run at all (exe crashes) or doesn't it do what you want?

Please have a look at the help file (regread function). There is some info about running AutoIt on 64-bit

Function RegRead:

... When running on 64-bit Windows if you want to read a value specific to the 64-bit environment you have to suffix the HK... with 64 i.e. HKLM64. ..."

It doesnt crash or anything. It appears to run but when you check the registry the change has not been made.

I will check out RegRead. Most everything I do is for 32bit but in this case I have about 10 64bit machines that need updating.

Posted (edited)

Do some more debugging. See if it actually reads the right value, if it executes the body of the If statement, etc. Maybe it has something to do with administrator privileges, too.

Edited by d4ni
Posted (edited)

Do some more debugging. See if it actually reads the right value, if it executes the body of the If statement, etc. Maybe it has something to do with administrator privileges, too.

Found my issue. RegRead and RegWrite required HKLM64 or HKLM depending on the OS and it must run as Administrator. Thank you d4ni and water.

Here is my new script.

If @OSArch = "X64" Then
    $key = "HKLM64"
Else
    $key = "HKLM"
EndIf

$var = RegRead($key & '\SOFTWARE\ODBC\ODBC.INI\VC Test', 'Server')
If @error = "0" Then
    RegWrite($key & '\SOFTWARE\ODBC\ODBC.INI\VC Test', 'Server', 'Reg_sz', 'HQSQLDEV01')
EndIf
Exit
Edited by beb7089

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...