BrewManNH Posted June 4, 2015 Share Posted June 4, 2015 _FileWriteToLine always returns @error 5 because True = 1 and False = 0 for $bOverWrite parameter.Func _FileWriteToLine($sFilePath, $iLine, $sText, $bOverWrite = False) ... ... If Not IsBool($bOverWrite) Or $bOverWrite = 0 Or $bOverWrite = 1 Then Return SetError(5, 0, 0) ; For old versions. That bug has been fixed and will be available in an upcoming release. I'm not sure when that release might be though.Just put parentheses around everything in the line starting before IsBool and ending after the last "= 1" in the interim. If Not (IsBool($bOverWrite) Or $bOverWrite = 0 Or $bOverWrite = 1) Then Return SetError(5, 0, 0) ; For old versions. 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 Link to comment Share on other sites More sharing options...
junkew Posted June 22, 2015 Share Posted June 22, 2015 With an array map should I be able to get an object type back? $oShell = ObjCreate("shell.application") Example() Func Example() ; Declare a map and assign with various keys value pairs. Local $mMap[] $mMap[1] = "Integer One" ; Integer value as a key. $mMap["2"] = "String Two" ; String value representing an integer as a key. This is a string not an integer. $mMap["shell"]=$oShell MapAppend($mMap, "Integer Two") ; Append a value using the next available integer, which is 2 in this case. ; Retrieve the keys contained in the map. A zero-based one-dimensional array is returned. Local $aMapKeys = MapKeys($mMap) For $vKey In $aMapKeys ; Or a For loop can be used as well. consolewrite("Key: " & $vKey & _ ; The key. " Value: " & $mMap[$vKey] & _ ; Use the array value of MapKeys() to display the value of the key. " Variable Type: " & VarGetType($vKey) & @CRLF) ; Display the variable type of the key i.e. integer or string. Next EndFunc ;==>ExampleOutput>"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /beta /ErrorStdOut /in "C:\Users\Elwin\Documents\UIA\testme.au3" /UserParams +>23:17:47 Starting AutoIt3Wrapper v.14.801.2025.0 SciTE v.3.4.4.0 Keyboard:00020409 OS:WIN_7/Service Pack 1 CPU:X64 OS:X64 Environment(Language:0413) +> SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE UserDir => C:\Users\Elwin\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper SCITE_USERHOME => C:\Users\Elwin\AppData\Local\AutoIt v3\SciTE >Running AU3Check (3.3.13.20) from:C:\Program Files (x86)\AutoIt3\Beta input:C:\Users\Elwin\Documents\UIA\testme.au3 +>23:17:48 AU3Check ended.rc:0 >Running:(3.3.13.20):C:\Program Files (x86)\AutoIt3\Beta\autoit3.exe "C:\Users\Elwin\Documents\UIA\testme.au3" --> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop Key: 1 Value: Integer One Variable Type: Int64 Key: 2 Value: String Two Variable Type: String Key: shell Value: Variable Type: String Key: 2 Value: Integer Two Variable Type: Int64 +>23:17:48 AutoIt3.exe ended.rc:0 +>23:17:48 AutoIt3Wrapper Finished. >Exit code: 0 Time: 0.2577 FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
jchd Posted June 22, 2015 Share Posted June 22, 2015 (edited) This what I tried:#include "..\include\dump.au3" $oShell = ObjCreate("shell.application") Example() Func Example() ; Declare a map and assign with various keys value pairs. Local $mMap[] $mMap[1] = "Integer One" ; Integer value as a key. $mMap["2"] = "String Two" ; String value representing an integer as a key. This is a string not an integer. $mMap["shell"]=$oShell MapAppend($mMap, "Integer Two") ; Append a value using the next available integer, which is 2 in this case. ConsoleWrite(_VarDump($mMap) & @LF) EndFunc ;==>Exampleand I get this:Map[4] [1] => String (11) 'Integer One' ['2'] => String (10) 'String Two' ['shell'] => Object IShellDispatch5 [2] => String (11) 'Integer Two'Dump.au3 being this: https://dl.dropboxusercontent.com/u/26433628/Dump.au3Bottom line: yes, you're getting an object back but since you're treating it as a string by coding" Value: " & $mMap[$vKey] & _ ; ...it then /-is-/ converted to a string! Edited June 22, 2015 by jchd 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...
FaridAgl Posted June 22, 2015 Share Posted June 22, 2015 I also write something similar to your Dump.au3 a while ago, here it is:expandcollapse popup#include <Constants.au3> Global $s = 'Hello world!' Global $d = Binary('0xDEADBEEF') Global $o = ObjCreate('InternetExplorer.Application') Global $keyword = Default Global $fu = MsgBox Global $t = DllStructCreate('BYTE[4]; DWORD; CHAR[128];') Global $b = True Global $f = 1.6516534234234234 Global $i32 = 416161235 Global $i64 = 416161235416161235 Global $h = HWnd(0x000B1032) Global $p = DllStructGetPtr($t) Global $m0[], $m1[] $m0['s'] = $s $m0['d'] = $d $m0['o'] = $o $m0['keyword'] = $keyword $m0['fu'] = $fu $m0['t'] = $t $m0['b'] = $b $m0['f'] = $f $m0['i32'] = $i32 $m0['i64'] = $i64 $m0['h'] = $h $m0['p'] = $p $m1['s'] = $s $m1['d'] = $d $m1['o'] = $o $m1['keyword'] = $keyword $m1['fu'] = $fu $m1['t'] = $t $m1['b'] = $b $m1['f'] = $f $m1['i32'] = $i32 $m1['i64'] = $i64 $m1['h'] = $h $m1['p'] = $p $m1['m'] = $m0 VarDump($m1) Func VarDump(ByRef $v) Local $sType = VarGetType($v) Switch $sType Case 'Array' ConsoleWrite('Array(' & UBound($v) & ') {' & @CRLF) For $i = 0 To UBound($v) - 1 ConsoleWrite('[' & $i & '] ') VarDump($v[$i]) Next ConsoleWrite('}' & @CRLF) Case 'Binary' ConsoleWrite('Binary(' & BinaryLen($v) & ') ' & $v & @CRLF) Case 'Bool', 'Double', 'Int32', 'Int64', 'Ptr' ConsoleWrite($sType & '(' & $v & ')' & @CRLF) Case 'DllStruct' ConsoleWrite('DllStruct(' & DllStructGetSize($v) & ')' & @CRLF) Case 'Function', 'UserFunction' ConsoleWrite('Function(' & FuncName($v) & ')' & @CRLF) Case 'Keyword' ConsoleWrite('Keyword(' & (IsKeyword($v) = $KEYWORD_DEFAULT ? 'Default' : 'Null') & ')' & @CRLF) Case 'Map' ConsoleWrite('Map(' & UBound($v) & ') {' & @CRLF) For $sKey In MapKeys($v) ConsoleWrite('[' & $sKey & '] ') VarDump($v[$sKey]) Next ConsoleWrite('}' & @CRLF) Case 'Object' ConsoleWrite('Object(' & ObjName($v) & ')' & @CRLF) Case 'String' ConsoleWrite('String(' & StringLen($v) & ') "' & $v & '"' & @CRLF) EndSwitch EndFuncInspired by PHP's var_dump(). http://faridaghili.ir Link to comment Share on other sites More sharing options...
JohnOne Posted June 22, 2015 Share Posted June 22, 2015 This what I tried:ConsoleWrite(_VarDump($mMap) & @LF)Does _VarDump no expect at least 2 arguments? 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 June 22, 2015 Share Posted June 22, 2015 (edited) No, the second is for:; $iLimit is the max number of entries of an array, map or DllStruct array element to be displayed in fullExample:Local $b[2][3] $b[1][1] = "Hello!" $b[0][2] = Null Local $m[] $m[444] = ObjCreate("Shell.Application") $m["what ever"] = $b $m["666"] = "Evil" $m[17] = DllStructCreate("byte[6];wchar[5];hwnd;double") Local $a = [ _ ['a', 123], _ [$m, Binary('fds opm $*k^ik$ph')] _ ] ConsoleWrite(_VarDump($a) & @LF)Displays:Array[2][2] [0][0] => String (1) 'a' [0][1] => Int32 123 [1][0] => Map[4] [444] => Object IShellDispatch5 ['what ever'] => Array[2][3] [0][0] => String (0) '' [0][1] => String (0) '' [0][2] => Keyword Null [1][0] => String (0) '' [1][1] => String (6) 'Hello!' [1][2] => String (0) '' ['666'] => String (4) 'Evil' [17] => Struct (32) @:02A9C100 (structure alignment is unknown) byte[6] 0x000000000000 wchar[5] '' ptr 0x00000000 double 0.0 [1][1] => Binary (17) 0x666473206F706D20242A6B5E696B247068whileLocal $c[15000][3] ConsoleWrite(_VarDump($c, 6) & @LF)givesArray[15000][3] [0][0] => String (0) '' [0][1] => String (0) '' [0][2] => String (0) '' [1][0] => String (0) '' [1][1] => String (0) '' [1][2] => String (0) '' ... there are 44994 more elements in this array Edited June 22, 2015 by jchd 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...
JohnOne Posted June 22, 2015 Share Posted June 22, 2015 Sorry, I was looking at __VarDump in your link. 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 June 22, 2015 Share Posted June 22, 2015 Ha! that more for internal, recursive use. See edited examples above. 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