ATnightAT Posted March 26, 2010 Share Posted March 26, 2010 Good morning... I'd like to know, how i could write a function with a optional number of parameters... I can't express it more precisely, because my english isn't very well^^ A Example would be BitOR(). You can call this function with infinite parameters. mfg @night@ Link to comment Share on other sites More sharing options...
Yashied Posted March 26, 2010 Share Posted March 26, 2010 http://www.autoitscript.com/forum/index.php?showtopic=90605 My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
99ojo Posted March 26, 2010 Share Posted March 26, 2010 (edited) Hi, i try to make as simple as i can and i hopefully understand what you mean. You can define default parameters in function call. mymsgbox () mymsgbox ("my title", "my text") _mymsgbox ("_my msgbox") _mymsgbox ("_my msgbox", "_my text") ;_mymsgbox () would cause an error Func mymsgbox ($title = "no title", $text = "no text") MsgBox (0, $title, $text) EndFunc Func _mymsgbox ($title, $text = "no text") MsgBox (0, $title, $text) EndFunc ;-)) Stefan Edited March 26, 2010 by 99ojo Link to comment Share on other sites More sharing options...
ATnightAT Posted March 26, 2010 Author Share Posted March 26, 2010 Thank you! It's a pity, that @NumParam doesn't work... Then i've to use the array... mfg @night@ Link to comment Share on other sites More sharing options...
KaFu Posted March 26, 2010 Share Posted March 26, 2010 It's a pity, that @NumParam doesn't work... Where did you read that? Test(1,1,1,1,1,1) Func Test($v1 = 0, $v2 = 0, $v3 = 0,$v4 = 0,$v5 = 0,$v6 = 0,$v7 = 0,$v8 = 0,$v9 = 0,$v10 = 0) For $i = 1 To @NumParams ConsoleWrite("Param #" & $i & "= " & Eval("v" & $i) & @CRLF) Next EndFunc OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
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