Jump to content

Starting AutoIt compiled (.exe) script from external program


tutui
 Share

Recommended Posts

hi guys,

i do have a strange problem... maybe no that strange for you folks, but definetly for me! :P

i wrote a small peace of code, that should be executed before a backup job has to be started. so, there is a possibility in the backup software to execute a command, exe, vbs, bat etc at the begining of the backup job (backup exec, arcserve, hp data protector etc). it doesen't matter which kind of backup software i use... but my autoit compiled (.exe) script will not work as it should! i the task will be started (can be seen in the task manager), but nothing happens at all! even when i try to start the autoit compiled (.exe) script using a batch or a vbs script nothing will happen.

the strange thing is, that when i start the autoit compiled (.exe) script manually or through a batch or vbs script everything works fine. so my question is, is there a known problem with autoit compiled (.exe) scripts started trough an external program? if not, is there something i miss at this point?

thanks a lot for your help!

peace,

tutui.

Link to comment
Share on other sites

when i try to start the autoit compiled (.exe) script using a batch or a vbs script nothing will happen.

when i start the autoit compiled (.exe) script manually or through a batch or vbs script everything works fine

?? Hmmmmmmm... How is the program running it? Can you give us an example of a batch script?

Link to comment
Share on other sites

?? Hmmmmmmm... How is the program running it? Can you give us an example of a batch script?

hm, seems that i wasn't that cleat in my explanation. sorry for that... let me just give you a brief overview:

i have a backup software, i.e. hp data protector and i have defined a lot of back jobs to be run in the night. what i need now, is that before the backup job is running some task have to be made. this task were written in with autoit and compiled to a .exe file, which i can include in the backup job, to be started before the jobs run. ok? well, this doesn't work unfortunately... i can see the task to be started, but nothing happens... as i write everything in a log file i can see each step the program is executing, but there is nothing happen in the log.

so, what i tried as a next step, is to write a little batch or vbs script, that will initialize the autoit compiled code to be executed. like this:

@echo off

start "c:\app\test.exe"

or something like that:

Set WshShell = WScript.CreateObject("WScript.Shell")

WshShell.Run "c:\app\test.exe"

when i just execute the batch or vbs script, everything works fine and the test.exe application is well executed. when i put either of the script into the backup job, nothing happens... or more specific, the test.exe application will not work correctly, the task will be started, but thers is no log and the tasks of test.exe aren't executed.

the application itself works perfectly when it is executed manually or within the scripts. it doesn't matter if it is compiled or if it is just coded in a .au3 manner.

hope this brings some more light in this issue.

peace,

tutui.

Link to comment
Share on other sites

It still sounds to me like you are using the scripts to run it. Have you tried running the plain .exe from the program? Have a look into google... :P

Edited by Bert
Link to comment
Share on other sites

It still sounds to me like you are using the scripts to run it. Have you tried running the plain .exe from the program? Have a look into google... :P

hey bert,

thanks a lot once more for your reply! yes, i tried to run the plain .exe from the backup program... and it doesn't work! that was the first thing i tried, because i was sure that this will work, but it didn't! that's why i tried to start the plain .exe from within a script... but it didn't work either, so i am still looking for someone giving me a clue. maybe i am missing something if there is a program trying to start my plain .exe program? could it be that there is a permission problem somewhere? i must confess that i couldn't believe that there is something messing up with the permissions, as i can run manually the plain .exe program successfuly!

and yes, i did allready a lot of google search, but i didn't found anything suitable in my case... but as someone said: nobody is perfect! so, i would still appreciate some help...

peace,

tutui.

Link to comment
Share on other sites

I'm not sure what much else can be done. I do not have the program. Maybe try a script like below when you try to run it... :P

If ProcessExists ("Name.Of.The.Exe.to.be.run.exe") Then
    MsgBox (0, "", "Process Exists")
EndIf
Link to comment
Share on other sites

  • 1 year later...

hey bert,

thanks a lot once more for your reply! yes, i tried to run the plain .exe from the backup program... and it doesn't work! that was the first thing i tried, because i was sure that this will work, but it didn't! that's why i tried to start the plain .exe from within a script... but it didn't work either, so i am still looking for someone giving me a clue. maybe i am missing something if there is a program trying to start my plain .exe program? could it be that there is a permission problem somewhere? i must confess that i couldn't believe that there is something messing up with the permissions, as i can run manually the plain .exe program successfuly!

and yes, i did allready a lot of google search, but i didn't found anything suitable in my case... but as someone said: nobody is perfect! so, i would still appreciate some help...

peace,

tutui.

Hi tutui,

Have you found any solution yet?

I have the similar problem, I was trying to run compiled AutoIt script from a program. It was ok on the development machine, but encounted the exactly same problem as you described when I deployed to the customer's machine.

regards

boblin

Link to comment
Share on other sites

Welcome.

This is quite an old post, so I don't think Tutui posted a solution if he had found it... :)

So now to try fix your problem.

What program are you trying to run it from?

What paths have you specified for the application to use?

Are you 100% sure the exe exists and that the path is correct?

Can you specifiy other programs to run?

OS? AutoIt Version?

Cheers,

Brett

Link to comment
Share on other sites

Welcome.

This is quite an old post, so I don't think Tutui posted a solution if he had found it... :)

So now to try fix your problem.

What program are you trying to run it from?

What paths have you specified for the application to use?

Are you 100% sure the exe exists and that the path is correct?

Can you specifiy other programs to run?

OS? AutoIt Version?

Cheers,

Brett

Thanks for the reply.

The system conatins 4 apps:

1. A third party application which will be controlled by the compiled script.

2. The server. It is a Delphi VCL application. It receives data from the client and generates a data file, then runs the compiled script. The script reads the data from the data file feeds the data to the third party application and reads the result from the application's status line and writes the result back to the data file.

3. The client. It talks to the server via tcp/ip.

4. The compiled script.

On the problem machine, you can see the compiled script is launched ( the icon is on the Windows tool bar, when you click it, the menu item Paused has a tick on it, and you are able to exit it), and the third party application is activated by it (you can see its icon blinking on the Windows tool bar, but itself is not brought to the front), and the debug Notepad is launched as well, but its title does not changed to the title you specified in the script. The scrip does not continue running, there is no debug message produced. But if you run the script from CMD or File Explorer, the data is fed to the third party application and the result is written because you can see it.

The server is written in Delphi, and it calls the compiled script via ShellExectue. The interesting thing is that, after call ShellExecute, if the function finished(i.e. it is the last line logically), then the compiled script can be run without problems. If after ShellExecute, there are other attempts to monitor the finish of the script, the compiled script seems blocked. The attempts are something like:

1. Reading the data file to see if the result has been written. Sleep(1000) between readings. Or

2. Just sleep for 30 seconds by 30 times of Sleep(1000).

What the script is doing is as simple as :

1. WinWaitActive

1.5 _DebugSetup("Confirm Message"). On the problem machine, the Notepad's title is "Untitled"! How come?

1.6 IniRead

2. ControlSetText,

2.5 _DebugOut

2.6 ContolCommand

3. ControlGetText

4. IniWrite

The OS of development and customer's are both Windows XP. Development machine is running Chinese version Windows XP, the customer's is running English version.

This system has nothing to do with Chinese. The development machine is alway ok no matter what kind of method used.

Thanks in advance.

Bob Lin

Link to comment
Share on other sites

Link to comment
Share on other sites

Permissions that could cause the program not to run...

Any possibility of some antivirus stopping it?

Are you 100% sure the paths are correct?

All programs are running, the third party application must be running before running the script.

The only problem is the script is paused, and the Notepad's window title is not set.

In what circumstance, the script will be paused and teh debugging Notepad's title is net set?

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