Jump to content

Do I need to always have a Main function or directly include the source?


MCP
 Share

Recommended Posts

if i create a new .au3 file and simply put two functions and i compile it, i should get an executable that simply does nothing. But can i directly access one of those functions from another executable / script?

is there anything like Run("MyDoNuthing.exe:FunctionOne()") to access them?

Link to comment
Share on other sites

if i create a new .au3 file and simply put two functions and i compile it, i should get an executable that simply does nothing. But can i directly access one of those functions from another executable / script?

is there anything like Run("MyDoNuthing.exe:FunctionOne()") to access them?

Perhaps you are thinking of AutoItX?

The more common way to do that would be with command line switches:

MyDoNuthing.exe /FunctionOne

:)

Edit: If the call is from an AutoIt script, then you could just include you functions as a UDF in those scripts:

#include <MyDoNuthing.au3>
Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

if i create a new .au3 file and simply put two functions and i compile it, i should get an executable that simply does nothing. But can i directly access one of those functions from another executable / script?

is there anything like Run("MyDoNuthing.exe:FunctionOne()") to access them?

Say your compiled script is:

MsgBox (0, "The command line was:", $CmdLine[$CmdLine[0]]); $CmdLine[$CmdLine[0]] returns the last parameter

compile it as "run.exe" and run it using the following code:

ShellExecute ('run.exe', '"This will be shown"')

Now, if you add an if...then...else...endif then you should be able to call different functions.

Hope it helps :)

Link to comment
Share on other sites

To answer your question (as I understand it) short. No, you can only use include files at compile time. There has been clever workarounds to this limitation. CoRoutine by neogia is one sample.

The problem is communication between the scripts. Passing variables (by reference would be great) getting return values. So, your best and most efficient bet if you want to create a library is to use another basic compiler (freebasic sample. Emergence basic looks promising to) or c/c++ (the autoit plugin api is one place to start. Unfortunately it has some short comings at the moment)

Happy scripting

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