Spiff59 Posted May 23, 2010 Share Posted May 23, 2010 (edited) I thought something like this is supposed to use the default for the second parameter? $parm1 = "xxx" $parm2 = "" test($parm1, $parm2) Func Test($p1 = "1111", $p2 = "2222") Msgbox(1,"",$p1 & @CRLF & $p2) EndFunc I find no way (anymore) to get the "2222" value assigned to $p2. Something change lately? typo Edited May 23, 2010 by Spiff59 Link to comment Share on other sites More sharing options...
Yoriz Posted May 23, 2010 Share Posted May 23, 2010 Dont pass anything as the second parameter and it will use your default, if you pass a second parameter it overwrites the default. $parm1 = "xxx" $parm2 = "" test($parm1) Func Test($p1 = "1111", $p2 = "2222") Msgbox(1,"",$p1 & @CRLF & $p2) EndFunc GDIPlusDispose - A modified version of GDIPlus that auto disposes of its own objects before shutdown of the Dll using the same function Syntax as the original.EzMySql UDF - Use MySql Databases with autoit with syntax similar to SQLite UDF. Link to comment Share on other sites More sharing options...
GEOSoft Posted May 23, 2010 Share Posted May 23, 2010 (edited) Nothing has changed. It's always been like that and Yoriz gave you the correct way. In trying to do what you are doing your function would have to contain something like If NOT $p2 Then $p2 = "2222" Edited May 23, 2010 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
jchd Posted May 23, 2010 Share Posted May 23, 2010 You can as well use the Default parameter placeholder in the call part, but that requires the function tests it with If IsKeyword($p2) Then $p2 = '2222'. Many functions in the standard UDFs work this way. This allows you to explicitely pass a third effective parameter while leaving the second to the default value and, more importantly, not caring what the default value is. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
Spiff59 Posted May 23, 2010 Author Share Posted May 23, 2010 (edited) It seems different... I'm fighting my way through the Alzheimers... I guess I'm just imagining the way I think it ought to behave. So with a multi-parameter function, where you want to modify the default for just the 6th parament, you'd have to have coded the function to check for, and replace, empty strings (or "Default" or -1, etc) for each the proceeding arguments, or else force the user to provide the default values all the way out to the parm they want to override. Not very convenient. Thanks for refreshing my memory. Edited May 23, 2010 by Spiff59 Link to comment Share on other sites More sharing options...
jchd Posted May 23, 2010 Share Posted May 23, 2010 Null parameters, enumerated parameters and named parameters are not in the AutoIt v3 syntax. _myFct(3, 'abc', , , 19) _myFct(#2:'abc', #1:3, #5:19) _myfct(handle=3, count=19, prefix='abc') This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
BrettF Posted May 24, 2010 Share Posted May 24, 2010 Check out _LoginBox for an example. Link in the sig... Cheers, Brett Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! 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