Jump to content

Run() and x64 conflict


Recommended Posts

I currently have a conflict and need assistance on a workaround. It seems that the included Excel.au3 UDF has issues with 64bit Windows 7 OS' and Outlook 2010. The workaround I found for this is to compile my script as 32bit, which does indeed make the Excel UDF work perfectly. This is where the problem starts, as it seems the Run() function included with Autoit breaks on 64bit Windows 7 OS' if the script isn't compiled as 64bit.

This leaves me in a bind, as I need my script to run as a 32bit script to get the UDF to work, however, I need it to run as a 64bit to get the Run() function to work. Any assistance on a workaround or fix would be appreciated.

Link to comment
Share on other sites

Bump. Still wondering if anyone has any suggestions for this. I've came up with a few of my own, but I want to know if there's anything more efficient. Don't be shy.

the Run function works fine in either mode, try quoting the path if you use command line parameters.

[Edit] or by any chance are you trying to run something in @ProgramFilesDir or @ProgramsCommonDir ?

Edited by Djarlo
Link to comment
Share on other sites

  • Developers

Remember that some directories have a different path in X86 and x64 mode.

Show the run() statement that fails in x86 mode.

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseX64=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

$s_IP = "0.0.0.0" ;This is usually an actual IP address.
$h_Cmd = Run("nbtstat.exe -a " & $s_IP, "", @SW_HIDE, 2)
MsgBox(0x40, "", @error)

This is the example using AutoIt3Wrapper_UseX64 to troubleshoot. =n(x86) gives me an @error of 1, and =y(x64) works fine.

Edit-

Using the below code gives the same results - works under x64 but not x86. Does it have something to do with nbtstat perhaps? or am I just missing something?

$h_Cmd = Run("C:\Windows\System32\nbtstat.exe -a " & $s_IP, "", @SW_HIDE, 2)
Edited by IAmTheManYo
Link to comment
Share on other sites

Thanks Jos and Djarlo. With the path and directory suggestions I was able to use those as a start for google, and found a really good article that explained redirection and an iffy little issue with nbtstat. The article explained how to use "\Windows\sysnative\" to bypass redirection and now everything seems to be working perfectly.

Here's the article for anyone else who stumbles into this problem.

http://scottiestech.info/2009/06/20/calling-a-32-bit-system-command-from-a-script-in-x64-windows/

WORKING CODE:

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseX64=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

$s_IP = "0.0.0.0"
$h_Cmd = Run("C:\Windows\sysnative\nbtstat.exe -a " & $s_IP, "", @SW_HIDE, 2)
MsgBox(0x40, "", @error)

Note: "\Windows\sysnative\" is (I do believe) a x64 directory only. Which means if you're writing a script that goes across multiple architectures, I suggest adding a @OSArch check to see if you should run the command normally, or not.

Link to comment
Share on other sites

  • 10 months later...

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
 Share

  • Recently Browsing   0 members

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