Richard Robertson Posted September 29, 2007 Share Posted September 29, 2007 I'm going to have to mess with this and find an unknown variable. Link to comment Share on other sites More sharing options...
therks Posted September 29, 2007 Author Share Posted September 29, 2007 Hehehe, have fun. I'm sure the dev's would be glad to find out about a variant that they don't have an Is____() function for. My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
Richard Robertson Posted September 30, 2007 Share Posted September 30, 2007 Found one, but I had to modify your code just a little bit. MsgBox(0, '', _VarDump(0, '', True)) Func _VarDump(ByRef $vVar, $sIndent = '', $IsSupposedToBeUnknown = False) Select Case $IsSupposedToBeUnknown Return 'Unknown(' & $vVar & ')' Case IsDllStruct($vVar) Return 'Struct(' & DllStructGetSize($vVar) & ')' Case IsArray($vVar) Return 'Array' & @CRLF & _VarDumpArray($vVar, $sIndent) Case IsBinary($vVar) Return 'Binary(' & BinaryLen($vVar) & ')' Case IsBool($vVar) Return 'Boolean(' & $vVar & ')' Case IsFloat($vVar) Return 'Float(' & $vVar & ')' Case IsHWnd($vVar) Return 'HWnd(' & $vVar & ')' Case IsInt($vVar) Return 'Integer(' & $vVar & ')' Case IsKeyword($vVar) Return 'Keyword(' & $vVar & ')' Case IsObj($vVar) Return 'Object(' & ObjName($vVar) & ')' Case IsString($vVar) Return 'String(' & StringLen($vVar) & ') ' & $vVar Case Else Return 'Unknown(' & $vVar & ')' EndSelect EndFunc Link to comment Share on other sites More sharing options...
Achilles Posted September 30, 2007 Share Posted September 30, 2007 Found one, but I had to modify your code just a little bit. MsgBox(0, '', _VarDump(0, '', True)) Func _VarDump(ByRef $vVar, $sIndent = '', $IsSupposedToBeUnknown = False) Select Case $IsSupposedToBeUnknown Return 'Unknown(' & $vVar & ')' Case IsDllStruct($vVar) Return 'Struct(' & DllStructGetSize($vVar) & ')' Case IsArray($vVar) Return 'Array' & @CRLF & _VarDumpArray($vVar, $sIndent) Case IsBinary($vVar) Return 'Binary(' & BinaryLen($vVar) & ')' Case IsBool($vVar) Return 'Boolean(' & $vVar & ')' Case IsFloat($vVar) Return 'Float(' & $vVar & ')' Case IsHWnd($vVar) Return 'HWnd(' & $vVar & ')' Case IsInt($vVar) Return 'Integer(' & $vVar & ')' Case IsKeyword($vVar) Return 'Keyword(' & $vVar & ')' Case IsObj($vVar) Return 'Object(' & ObjName($vVar) & ')' Case IsString($vVar) Return 'String(' & StringLen($vVar) & ') ' & $vVar Case Else Return 'Unknown(' & $vVar & ')' EndSelect EndFuncAm I missing something or did you just modify his code so that it shows you that a variable is unknown if you put the third argument as true? That seems utterly pointless to me... My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
Richard Robertson Posted September 30, 2007 Share Posted September 30, 2007 It was a joke. There really shouldn't be anything that will show up as unknown right now. Link to comment Share on other sites More sharing options...
Achilles Posted September 30, 2007 Share Posted September 30, 2007 It was a joke.Ahhh.... that would explain it! My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
Nutster Posted October 3, 2007 Share Posted October 3, 2007 It's pretty, but what kind of variable would be unknown?The one you are calling a UDF with, so you need to check it. You want to make sure you can display it/process it properly. Particularly true for array dumps. David NuttallNuttall Computer Consulting An Aquarius born during the Age of Aquarius AutoIt allows me to re-invent the wheel so much faster. I'm off to write a wizard, a wonderful wizard of odd... Link to comment Share on other sites More sharing options...
JRSmile Posted October 4, 2007 Share Posted October 4, 2007 this is far mostly the most usable function i will ever use since ConsoleWrite ... BIG THX... $a=StringSplit("547275737420796F757220546563686E6F6C75737421","") For $b=1 To UBound($a)+(-1*-1*-1)step(2^4/8);&$b+=1*2/40*µ&Asc(4) Assign("c",Eval("c")&Chr(Dec($a[$b]&$a[$b+1])));''Chr("a")&"HI" Next ;time_U&r34d,ths,U-may=get$the&c.l.u.e;b3st-regards,JRSmile; MsgBox(0x000000,"",Eval("c"));PiEs:d0nt+*b3.s4d.4ft3r.1st-try:-) Link to comment Share on other sites More sharing options...
therks Posted October 4, 2007 Author Share Posted October 4, 2007 (edited) Whooooaaa. I got moved! Haha I guess the example forum is more appropriate now anyway. I've been playing with this a bit more, adding some comments. I also added a _VarDumpNotByRef(), it's basically a wrapper for _VarDump() but, as the title implies, takes the variable not by reference. Using ByRef you're stuck with dumping variables only. For example, I recently was working with a COM object for Winamp, and had this piece of code:$oWinamp = ObjGet('', 'ActiveWinamp.Application') If IsObj($oWinamp) Then ConsoleWrite(_VarDump($oWinamp.PlayList.GetSelection) & @CRLF) EndIfWhich threw me this error:D:\Rob\Desktop\Miniamp\Copy of Miniamp.au3 (8) : ==> Error parsing function call.: ConsoleWrite(_VarDump($oWinamp.PlayList.GetSelection) & @CRLF) ConsoleWrite(_VarDump($oWinamp^ ERRORSo I created this function:Func _VarDumpNotByRef($vVar) Return _VarDump($vVar) EndFuncWhich easily bypasses the error. If I submit this for official inclusion (although I don't know that it would make the cut) should I include this wrapper function as well? Or maybe go vice versa and rename the current _VarDump() to _VarDumpByRef() and have _VarDump() be a non-byref compatible function?*Edit: On a slightly related side note, that piece of code I used as an example gives me an array of the items selected in Winamp's playlist, and when there was nothing selected the function returned this:Array( 0 )Weird huh? I looked into it and when there's nothing selected it does indeed return an array... a completely empty array! I even used UBound to check how many subscripts it had, and it returned 0! I wonder how often that comes up, considering we can't even make a completely empty array ourselves (what would be the point anyway?). Scrap that, I made a mistake. Still trying to figure it out though. Edited October 5, 2007 by Saunders My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
therks Posted October 5, 2007 Author Share Posted October 5, 2007 (edited) Okay, figured it out.. kinda.$oWinamp = ObjGet('', 'ActiveWinamp.Application') If IsObj($oWinamp) Then $aSel = $oWinamp.PlayList.GetSelection ConsoleWrite(IsArray($aSel) & @CRLF) ConsoleWrite(UBound($aSel, 0) & @CRLF) ConsoleWrite(UBound($aSel, 1) & @CRLF) EndIfReturned:110To get that normally you'd basically have to Dim $array[0] and we can't even do that, not that we have a reason to.*Edit: I'm just going to have the dumper function return an error string when something like that happens. So now the dump on that variable looks like this:Array( [0] !! Error reading index ) Edited October 5, 2007 by Saunders My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
Beamer145 Posted March 15, 2013 Share Posted March 15, 2013 In case anyone else ends up in this thread looking for a method to determine the variable type: the _VarDump method should not be used, use VarGetType() instead. See for a discussion on this topic. czardas 1 Link to comment Share on other sites More sharing options...
JohnOne Posted March 15, 2013 Share Posted March 15, 2013 VarGetType() was not native function at the time of this thread, which is six years old by the way. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
jchd Posted March 15, 2013 Share Posted March 15, 2013 I've posted what I believe is a correct version in the thread mentionned. It needs the beta for Null support BTW. czardas 1 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...
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