Jump to content

ShellExecute() returns error in Win2003 SBS SP2


Recommended Posts

Hi there, I'd like to share this rather odd issue that's been following me around for a couple of days...

I have this server at the office and, every now and then, when my script detects unexpected behaviour during the night, it pops up the log file, so when I access the server the next morning, I'll see immediately which problems occurred while I was away.

Well, I mean, it SHOULD pop up the log file.

These three all return the same thing:

ShellExecute("notepad.exe")

ShellExecute("notepad.exe","log.txt")

ShellExecute("log.txt","",@ScriptDir,"edit")

Error returned:

Posted Image

But this doesn't close AutoIt. After I press the OK button, it will execute what is requested, the script will remain running and everything else is ok.

- I'm running Windows Server 2003 Small Business Server (Service Pack 2, English) in an Intel Xeon. 32-bit system.

- The error can be reproduced at least in AutoIt v3.2.4.9 to v3.2.8.x

- Using Run("notepad.exe log.txt") will do the trick with no errors. So I'm just posting this for a possible bug finding.

Thanks all for your concern.

Best,

footswitch

Link to comment
Share on other sites

I tried this on my Server 2003 SP2 box, it's enterprise edition, but should be very similar.

I created a text file called log.txt and placed it into my script directory.

CODE
ShellExecute("Notepad.exe")

ConsoleWrite("Error = "&@Error&@CRLF)

ShellExecute("Notepad.exe","log.txt")

ConsoleWrite("Error = "&@Error&@CRLF)

ShellExecute("log.txt","",@ScriptDir,"Edit")

ConsoleWrite("Error = "&@Error&@CRLF)

each ShellExecute correctly opened notepad. The first one opened a new notepad and the second two did open log.txt, and then exited automatically.

@Error returned 0 for each command.

I did not receive the error message that you were getting.

My server is running Autoit v3.2.6.0

Kerros===============================================================How to learn scripting: Figure out enough to be dangerous, then ask for assistance.

Link to comment
Share on other sites

  • Moderators

Hi there, I'd like to share this rather odd issue that's been following me around for a couple of days...

I have this server at the office and, every now and then, when my script detects unexpected behaviour during the night, it pops up the log file, so when I access the server the next morning, I'll see immediately which problems occurred while I was away.

Well, I mean, it SHOULD pop up the log file.

These three all return the same thing:

ShellExecute("notepad.exe")

ShellExecute("notepad.exe","log.txt")

ShellExecute("log.txt","",@ScriptDir,"edit")

Error returned:

Posted Image

But this doesn't close AutoIt. After I press the OK button, it will execute what is requested, the script will remain running and everything else is ok.

- I'm running Windows Server 2003 Small Business Server (Service Pack 2, English) in an Intel Xeon. 32-bit system.

- The error can be reproduced at least in AutoIt v3.2.4.9 to v3.2.8.x

- Using Run("notepad.exe log.txt") will do the trick with no errors. So I'm just posting this for a possible bug finding.

Thanks all for your concern.

Best,

footswitch

What version of PSAPI.dll are you using on that server?

i thinks this post is better in place on bug reports.

Now there's a concept.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Smoke, you're totally right.

I'd really like to see this happening in another system BEFORE assuming it's a bug.

Before anything else, let me clear it up a little bit more:

- Win2003 SBS was installed in 2006 with the OEM CDs that came along with the server;

- All updates were performed semi-automatically since then (via windows' auto-updater and MS' win update site)

PSAPI.dll is version 5.2.3790.3959 .

Kerros I think it would be nice of you to post your PSAPI.dll version as well.

Best,

footswitch

Link to comment
Share on other sites

  • Moderators

Smoke, you're totally right.

I'd really like to see this happening in another system BEFORE assuming it's a bug.

Before anything else, let me clear it up a little bit more:

- Win2003 SBS was installed in 2006 with the OEM CDs that came along with the server;

- All updates were performed semi-automatically since then (via windows' auto-updater and MS' win update site)

PSAPI.dll is version 5.2.3790.3959 .

Kerros I think it would be nice of you to post your PSAPI.dll version as well.

Best,

footswitch

It's probably a good idea to go ahead and register that version again as well. Never know if some other app registered an older version of it on your PC since that install.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

It's probably a good idea to go ahead and register that version again as well. Never know if some other app registered an older version of it on your PC since that install.

I tried that with regsvr32 %windir%\system32\psapi.dll, but regsvr32 would return an error like "DllRegisterServer entry point was not found".

So I did a search within the server's HD to see how many psapi's it had.

Turns out the PSAPI.dll that comes with AutoIt doesn't get along with my WinServer2003.

AutoIt's PSAPI.dll version (located in AutoIt directory, which is something I didn't know before) is 4.0.1280.1 (45KB).

WinServer2003's PSAPI.dll version is, as stated above, 5.2.3790.3959 (20KB).

Steps performed:

- Rename/delete AutoIt's PSAPI.dll.

- Done!

I hope I'm not getting myself into trouble in the near future for disregarding this file...

Do any of the veterans have anything to say on this?

Like, "no, don't delete the file" or "that works for you but you'll need 'our' psapi.dll if you want function xyz()" or maybe "yes, we'll update the psapi.dll in future releases"...?

Thanks all for your support! Really appreciated <_<

Link to comment
Share on other sites

  • Moderators

I usually port my own psapi.dll personally...

The reason that psapi.dll is in the autoit directory is because some systems didn't have it installed on them already.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Just FYI

I have three Versions of PSAPI.dll on my server

Windows\system32 Version 5.2.3790.3959

ATI\Support Version 4.0.1371.1 (ATI video card installed)

Autoit3 Version 4.0.1280.1

Kerros===============================================================How to learn scripting: Figure out enough to be dangerous, then ask for assistance.

Link to comment
Share on other sites

Well... What can I say. Problem is solved. I was just pointing out that AutoIt's PSAPI.dll doesn't seem to work properly in WinServer2003 SBS.

I don't know much about .dlls but maybe there could be a more compatible version of PSAPI.dll to be packed together with AutoIt. Or maybe an updated .dll would ruin AutoIt in Win9x, I honestly don't know.

I rest my case, because from now on, I don't know what I'm talking about.

Thanks again.

Link to comment
Share on other sites

  • Moderators

Well... What can I say. Problem is solved. I was just pointing out that AutoIt's PSAPI.dll doesn't seem to work properly in WinServer2003 SBS.

I don't know much about .dlls but maybe there could be a more compatible version of PSAPI.dll to be packed together with AutoIt. Or maybe an updated .dll would ruin AutoIt in Win9x, I honestly don't know.

I rest my case, because from now on, I don't know what I'm talking about.

Thanks again.

I agree...

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
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
 Share

  • Recently Browsing   0 members

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