Sign in to follow this  
Followers 0
IAmTheManYo

Run() and x64 conflict

8 posts in this topic

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.

Share this post


Link to post
Share on other sites



Anyone have any idea's or suggestions?

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

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

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


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

#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

Share this post


Link to post
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.

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