Jump to content

Define functions from a file.


Recommended Posts

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]

Link to comment
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]

Link to comment
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.

Link to comment
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.

Link to comment
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.

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]

Link to comment
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
Link to comment
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
Link to comment
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.

Link to comment
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]

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