Jump to content

Running a script from a compiled exe using /AutoIt3ExecuteScript


r1ch4rd
 Share

Recommended Posts

Hi Everyone,

I have a compiled exe that has some UDFs included in the compilation, and now I want to execute an external au3 file with Run(@AutoItExe & ' /AutoIt3ExecuteScript). The problem is that I want to have my external au3 file run UDFs that were included in the exe.

I've been searching the forum for a while now, and so far I understand that includes are a compile-time directive and not run-time, but if this is true then why can't my au3 file run the functions in the exe? I thought it would work because my compiled exe is running the au3.

Many thanks to anyone who could help me on this one.

Thanks,

Richard

Link to comment
Share on other sites

Hi Everyone,

I have a compiled exe that has some UDFs included in the compilation, and now I want to execute an external au3 file with Run(@AutoItExe & ' /AutoIt3ExecuteScript). The problem is that I want to have my external au3 file run UDFs that were included in the exe.

I've been searching the forum for a while now, and so far I understand that includes are a compile-time directive and not run-time, but if this is true then why can't my au3 file run the functions in the exe? I thought it would work because my compiled exe is running the au3.

Many thanks to anyone who could help me on this one.

Thanks,

Richard

The udf's are included in the code for the process that is run. When you start another process then that process will only be able to use the code that was included in its own script. In other words, running a script B from script A is the same as running script A then running script B from the command line, -they know nothing about each other.

If you need to have certain includes in the second script that are also in the first then you could have a line at the top of each script something like

#include "specialudfs.au3"

Then write the list of includes to file SpecialUdfs.au3 before running the first script.

Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Thanks for your reply martin,

The problem is that I didn't want to have the included scripts on the computer(in their raw au3 form). Do you know of any other way to execute one script from a compiled exe, other than command line, maybe something within the original exe code?

Link to comment
Share on other sites

Thanks for your reply martin,

The problem is that I didn't want to have the included scripts on the computer(in their raw au3 form). Do you know of any other way to execute one script from a compiled exe, other than command line, maybe something within the original exe code?

Look here, maybe it will help you.

solution for executing EXE directly from memory (or resources)

http://www.autoitscript.com/forum/index.php?showtopic=51103&view=findpost&p=760669

Link to comment
Share on other sites

Hi Zedna,

I took a look, but I don't think it's what I'm after, I want to execute an external au3 and run functions that are contained in my exe. I think it is impossible.

The reason I can't include the UDF in the external au3 is because I don't want to have the code for these functions available on the users PC.

Thanks anyway.

Link to comment
Share on other sites

Maybe compile your UDF as a3x.

But I don't know if user can include/use such precompiled a3x file from au3 script.

EDIT: just info about a3x format: it's normal compiled script just without included autoit interpreter

EDIT2: Look at this ticket which could solve your problem if will be implemented

Include A3X file as a script

http://www.autoitscript.com/trac/autoit/ticket/383

Edited by Zedna
Link to comment
Share on other sites

I think you only need a slight variation on what I suggested.

Use FileInstall in the first script to write the include files to a the script folder or other, including the file which list all those. The second script includes all those files by simply having the line #include "filelist.au3" and then in the script you can have something to delete these extra files.

Despite that, here is another option.

I would like to understand how the second script was going to be able to call functions that it disn't know were going to be included. Why do you need a second script if the first one has all the capabilities?

Assuming there is a good answer to that then you could pass a message to the first script and tell it the function and the parameters. The first script can do the work and give the answer back.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Hi everyone,

Thanks for all your suggestions, I think I have enough information for me to do this now. I'm going to run my main exe, then call the script using /Autoit3ExecuteScript, then have the 2nd process call main exe again with the function params OR send it a message with an ini or something.

Thanks for your help

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