Tomb Posted April 16, 2008 Posted April 16, 2008 with a script in uncompiled form, you can keep some of your functions in a seperate script / text file. similar to how a UDF works. like for example if i had a file called text.txt and in this file i had wriiten Func TestFunction() MsgBox(0, "", Hello. This is just a test") EndFunc now if i had a seperate .au3 script that called that function, and i wrote #Include "text.txt" like this example #Include "Text.txt" TestFunction() now i can make use of the function in my seperate file. and if you were to compile the main script, the Text.txt function would be included into my script. this making the compiled script a standalone .exe but, what i want to do is have a script that includes a file similar to Text.txt in my example above, but without including it in the script once compiled. I would like the newly compiled script to still reference to a text file from which the functions could be edited in at a later time. very similar to how it can reference the text.txt in uncompiled form. ofcourse, if the file was not existing, there would be a problem, but lets just assume i will always have it right there. i thought of just using like fileread or iniread but then i soon realized it wouldn't work for the functions properly.
Tomb Posted April 16, 2008 Author Posted April 16, 2008 (edited) Execute()I think that might just work.just wish my autoit helpfile had a better example for executing functions.i am going to search for an example of execute, i believe the answer is somewhere located in this function.thanks Edit: i spelled helpfile wrong. Edited April 16, 2008 by Tomb616
Tomb Posted April 16, 2008 Author Posted April 16, 2008 ok hmm i didn't figure it out. i did find a term that makes more sense to describe what i'm trying to accomplish though. Executing a External Function.
FreeFry Posted April 16, 2008 Posted April 16, 2008 So basically what you want(in the long run) is to define a function, after that the script is run, at run-time ?
Tomb Posted April 17, 2008 Author Posted April 17, 2008 So basically what you want(in the long run) is to define a function, after that the script is run, at run-time ?well, the function could be defined previous to running the script.but also edited during running yes.
FreeFry Posted April 19, 2008 Posted April 19, 2008 Well you can't really "edit" a function after it has been run. You can modify how/what the script executes/does, but not modify the function after runtime... Only way to do that would be to write the code of the function to a .au3 file, then run that script with the AutoIt commandline parameters...
MrCreatoR Posted April 19, 2008 Posted April 19, 2008 (edited) I think he wants to be able change the function (in external module or something) even after the script is compiled... @Tomb616 You can write the needed functions and they execution to some file (module), for example «External_UDFs.fnc»: expandcollapse popup#NoTrayIcon If $CmdLine[0] = 0 Then Exit ;We need at least 1 command line ;Collecting parameters $sParams = "" For $i = 2 To $CmdLine[0] $sParams &= $CmdLine[$i] & "|" Next $sParams = StringTrimRight($sParams, 1) Call($CmdLine[1], $sParams) ;==== UDFs Part ==== Func Some_UDF($sParams) Local $iRet = MsgBox(36, "Question", $sParams) ConsoleWrite($iRet) EndFuncoÝ÷ Ø Ý¶§Ê«r©W±Êâ¦Ü"Yh¢K,¢g)à)¶¬jëh×6Global $sUDFs_Module = @ScriptDir & "\External_UDFs.fnc" $vRet = _ExecuteExternalFunc("Some_UDF", "test") MsgBox(64, "", "Returned Message from ExternalFunc: " & $vRet) Func _ExecuteExternalFunc($sFuncName, $sParams="") Local $iPID = Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & $sUDFs_Module & '" ' & $sFuncName & ' ' & $sParams, '', '', 2 + 4) Local $sStdOutRead = "" While ProcessExists($iPID) $sStdOutRead &= StdoutRead($iPID) WEnd Return $sStdOutRead EndFunc Edited April 19, 2008 by MsCreatoR Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now