Jump to content

Running Off C:\Program Files


Recommended Posts

If you run your Autoit3 3.1.1 scripts off from the C:\Program Files folder, do your scripts work as expected? Mine don"t. Please let me know if your Autoit3 3.1.1 scripts run without problems off C:\Program Files folder. Below are details surrounding my problem if you care to read more.

My environment details are:

Autoit3: version 3.1.1

Windows 2000 Pro English with the latest patches/upgrades (last patches download less than a week ago.)

CPU's: Pentium II's, II's and IV's

Memory: 128 min, 512 max

All scripts are run within the built-in Administrator account.

I place all my source and compiled scripts plus related working files in a project folder.

To make my scripts truly portable, all my path references are in the form of:

$path =  @ScriptDir & "\filename.ext"

The scripts work fine anywhere I place the project folder (making the set of scripts very portable even across PC's). They work even off a floppy disk.

But when I place the project folder inside C:\Program Files folder, the scripts begin to fail with unusual errors (both Autoit3 and Windows errors.)

The Windows (X) error window appears when running uncompiled scripts in C:\Program Files and reads:

C:\Program Files\Project\xxxxx.au3 is not a valid Win32 application.

The Autoit3 errors (as far as I have experienced) relate to file open errors and appear when running compiled scripts in C:\Program Files.

What makes this error condition frustrating is that once the errors are generated, Autoit3 is inevitably broken and the Windows and Autoit3 errors occur regardless of where I place the script folder (Please see attached image of the Windows error). Only a restore of the OS (by restoring an image of Drive C:) can get Autoit3 to work again.

It appears that as long as I avoid running Autoit3 scripts in the C:\Program Files folder, everything seems to work and continues to work. Autoit3 is broken only if I run scripts in the C:\Program Files folder. Is this a virus? or is this a Windows 2000 odd way of treating "unregistered" programs within the C:\Program Files folder? Could it be the Windows latest patches break Autoit3 when run off C:\Program Files?

If this is a virus, I can't understand why the virus would kick in only if my scripts are run within C:\Program Files. I'm extremely paranoid about viruses so I have confidence all my Windows environment (Drive C) images are virus free.

I look forward to hearing about your own tests. Thank you...

Error.bmp

Link to comment
Share on other sites

Odd indeed...

firstly which anti-virus you using?

Secondly just check you do not have a ProgramFiles folder as well as a

Program Files folder

"ProgramFiles" without the space is invalid, if this is present it will cause unpredictable results.

other than that, i've no idea.. Hopefully someone else will be able to help further.

HardCopy

Edited by HardCopy

Contributions: UDF _DateYearFirstChildren are like Farts, you can just about stand your own.Why am I not a Vegetarian?...Well...my ancestors didn't fight & evolve to the Top of the food chain for me to survive on Salad

Link to comment
Share on other sites

Welcome to the forums!

Sounds like some dodgy file associations in the registry to me. Have you tried uninstalling and reinstalling AutoIt?

If so, would you perhaps feel like exporting your HKEY_CLASSES_ROOT\.au3 and HKEY_CLASSES_ROOT\AutoIt3Script keys and pasting them here for us to see?

Link to comment
Share on other sites

But when I place the project folder inside C:\Program Files folder, the scripts begin to fail with unusual errors

Do any of the other folders where you've successfully run the script have a "space" in their pathname? You might need quotes around the full path name?
...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
Link to comment
Share on other sites

Thanks for the Welcome note.

If so, would you perhaps feel like exporting your HKEY_CLASSES_ROOT\.au3 and HKEY_CLASSES_ROOT\AutoIt3Script keys and pasting them here for us to see?

What I will do is export the keys you suggested BEFORE and AFTER the error occurs and see if there are any differences in the keys. I'll get back to you with the keys later (It's past midnight here now.) Again, thanks for the consideration.

Link to comment
Share on other sites

Au3 is not a Win32 application and I see no code to show how you are using your Run function. To run Au3 scripts, AutoIt needs to run them.

$path = '"' & @ScriptDir & '\filename.au3"'
$autoit = @ProgramFilesDir & '\AutoIt3\AutoIt3.exe'

Run($autoit & ' ' & $path)

or comspec may run it if the default registy setting is Run rather then Open.

RunWait(@ComSpec & ' /c ' & $path, '', @SW_HIDE)
Link to comment
Share on other sites

$autoit = @ProgramFilesDir & '\AutoIt3\AutoIt3.exe'

Wouldn't he need this as well:

$autoit = '"' & @ProgramFilesDir & '\AutoIt3\AutoIt3.exe' & '"'
...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
Link to comment
Share on other sites

Wouldn't he need this as well:

$autoit = '"' & @ProgramFilesDir & '\AutoIt3\AutoIt3.exe' & '"'
AutoIt should run without the quotes in the example, but other paths could be an issue with spaces in paths or filenames. Your reply does seem wise to add quotes in case of a spaces problem. ;)
Link to comment
Share on other sites

But I think that the main problem here isn't to do with AutoIt at all. The error box that the original poster is receiving isn't one that originates from AutoIt --

Error.bmp

I get this box whenever I run a corrupted EXE file (off a bad floppy for instance). It seems logical that you would see this box if you name some other file (like, oh... an AutoIt script?) to have a .EXE extension and then double-click it. Following that logic, it's possible that somehow the .AU3 file extension has been disturbed somehow and Windows is trying to run the script as a program itself. (This wouldn't explain why things work sometimes though -- maybe a file is corrupted.)

I would suggest that you uninstall and reinstall AutoIt before trying anything else.

Link to comment
Share on other sites

I've encountered a similar problem a few weeks back

a situation where I needed to run an DOS executable in the script

I think this is what you might be looking for:

let's say u have a DOS executable "doit.exe" in the programs folder like this-

C:\Programs Folder\Automation Programs\doit.exe

where "Automation Programs" is your script folder

you should do it like:

$autoit = FileGetShortName(@ScriptDir & "\doit.exe")

Read up on the "FileGetShortName" syntax for more info

The speed of sound is defined by the distance from door to computer divided by the time interval needed to close the media player and pull up your pants when your mom shouts "OH MY GOD WHAT ARE YOU DOING!!!"

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...