lsakizada Posted April 1, 2008 Posted April 1, 2008 Is it possible to get the function name inside the function, e.g. when it running? Be Green Now or Never (BGNN)!
FreeFry Posted April 1, 2008 Posted April 1, 2008 I don't see th reason for this, but I guess you could create a local variable inside each function and define the function name there... that way you should be able to retrieve it..
lsakizada Posted April 1, 2008 Author Posted April 1, 2008 I don't see th reason for this, but I guess you could create a local variable inside each function and define the function name there... that way you should be able to retrieve it..Thanks, but I need it dynamics since I am creating dynamics au3 scripts with dynamics functions Be Green Now or Never (BGNN)!
weaponx Posted April 1, 2008 Posted April 1, 2008 How do you have dynamic functions? If you are using Call(), the functions are still predefined. If you are using /AutoIt3ExecuteLine, you still are using known function names. In PHP there is a global constant I think called __FUNCTION__, but PHP offers variable functions. Maybe there is something similar hidden in AutoIt. I have never used this in PHP but I have used get_class() which is nice.
martin Posted April 1, 2008 Posted April 1, 2008 What is a dynamic function? 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.
Xenobiologist Posted April 1, 2008 Posted April 1, 2008 What is a dynamic function?LOL, I guess your concept is very strange. Use one function which acts different with different parameters.Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times
weaponx Posted April 1, 2008 Posted April 1, 2008 This is effectively the same as Call(): <?phpfunction foo() { echo "In foo()<br />\n";}function bar($arg = ''){ echo "In bar(); argument was '$arg'.<br />\n";}// This is a wrapper function around echofunction echoit($string){ echo $string;}$func = 'foo';$func(); // This calls foo()$func = 'bar';$func('test'); // This calls bar()$func = 'echoit';$func('test'); // This calls echoit()?>
Beamer145 Posted December 5, 2012 Posted December 5, 2012 Has such a feature been added in the time since this topic was created ?I could not find any update info, but you never know.I don't see th reason for this, but I guess you could create a local variable inside each function and define the function name there... that way you should be able to retrieve it..A reason for wanting this is to put the function name in front of error log messages...(and adding a local variable to each function becomes a bit of a PITA )
BrewManNH Posted December 5, 2012 Posted December 5, 2012 No, such a feature hasn't been added, and adding a single variable with its contents being the name of the funtion it's in isn't that hard, just a LITTLE time consuming if you're adding to an existing script. Although you could probably modify the SciTE tool that adds function trace lines to a script to have it create the local variable instead of a consolewrite. The tool's code is in AutoItTools.lua. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator
JohnOne Posted January 7, 2013 Posted January 7, 2013 No, such a feature hasn't been added, and adding a single variable with its contents being the name of the funtion it's in isn't that hard, just a LITTLE time consuming if you're adding to an existing script.Although you could probably modify the SciTE tool that adds function trace lines to a script to have it create the local variable instead of a consolewrite. The tool's code is in AutoItTools.lua.Exactly what I done at one point, you could also write a quick script to add them, but I'd personally love to see (and I know new macros are on the not to do list) @FunctionName. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
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