Sign in to follow this  
Followers 0
MerkurAlex

Define functions from a file.

15 posts in this topic

I need a way to everytime i run my compiled script to define the functions in another file.


[quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote]

Share this post


Link to post
Share on other sites



#include "myfunctions.au3"

Share this post


Link to post
Share on other sites

#include "myfunctions.au3"

That will include the functions when i compile not everytime i run the compiled script.

[quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote]

Share this post


Link to post
Share on other sites

That will include the functions when i compile not everytime i run the compiled script.

And that made no sense it will include when I compile, not everytime I run the compiled script...?

If you #include it, it's in the script when you run, and when you compile it.

Share this post


Link to post
Share on other sites

And that made no sense it will include when I compile, not everytime I run the compiled script...?

If you #include it, it's in the script when you run, and when you compile it.

That is correct, the included files don't have to travel with your exe.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

And that made no sense it will include when I compile, not everytime I run the compiled script...?

If you #include it, it's in the script when you run, and when you compile it.

Its seriously not that hard to understand after i compile the script if i run that exe it needs to define function from a file that can change that way the exe itself doesn't need to be recompiled.

That is correct, the included files don't have to travel with your exe.

I know that and if i didn't i would have tested and i would have found out the thing is i need it to be able to travel with the exe. Edited by EagleClaw

[quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote]

Share this post


Link to post
Share on other sites

This would require a DLL file.

Share this post


Link to post
Share on other sites

You can't. Plain and simple.

Share this post


Link to post
Share on other sites

Search the help file for Command Line Parameters and read about AutoIt specific command Line Switches you will find the following switches:

Form3: Compiled.exe [/ErrorStdOut] [/AutoIt3ExecuteScript] file [params ...]

Execute another script file from a compiled AutoIt3 Script File. Then you don't need to fileinstall another copy of AutoIT3.exe in your compiled file.

Form4: AutoIt3.exe [/ErrorStdOut] /AutoIt3ExecuteLine "command line"

Execute one line of code.


AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line

Share this post


Link to post
Share on other sites

He wants to call functions from a source file.

Share this post


Link to post
Share on other sites

He wants to call functions from a source file.

And your point is...

Take any of your compiled script and run from the command window:

Compiled.exe /AutoItExecuteScript Function.au3 "_MsgBox" "This is testing _MsgBox Function"

Function.au3

Local $ExecuteFunc

If $CMDLine[0] > 0 Then
    $ExecuteFunc = $CMDLine[1] & '('
    For $x = 2 To $CMDLine[0]
        $ExecuteFunc &= '"' & $CMDLine[$x] & '",'
    Next
    $ExecuteFunc = StringTrimRight($ExecuteFunc, 1) & ')'
EndIf
Execute($ExecuteFunc)

Func _MsgBox($sTitle, $sText)
    MsgBox(0, $sTitle, $sText)
EndFunc

AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line

Share this post


Link to post
Share on other sites

That doesn't allow it to return a value to the calling script with the exception of an integer through the exit code.

I'm sure the return value ought to be important.

Share this post


Link to post
Share on other sites

When this happens in the real world it usually means you 1: need to make another executable or more likely 2: need to rethink how you are coding your file to begin with. Nobody pulls functions from a separate file, there might be an easier way if you explain what you're trying to do.

Share this post


Link to post
Share on other sites

@Distrophy

Im basically trying to allow the user to write a function that can be added as an addon for other people but i still need to be able to keep the source code of my actual script hidden.


[quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote]

Share this post


Link to post
Share on other sites

If you want users to be able to write their own functions, tell them to write dlls and call their dlls. That's how addons usually work unless you feel like implementing a parsing engine.

Share this post


Link to post
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
Sign in to follow this  
Followers 0