Leaderboard
Popular Content
Showing content with the highest reputation on 07/18/2019 in all areas
-
[SOLVED] _IEFrameGetObjByName Errors.
Earthshine and one other reacted to Nine for a topic
But you did the job, glad someone can actually take advise and change it into code ! I am proud of you, really ! You could use leveled Exitloop instead of using boolean, would make your script more readable...2 points -
Introduction JSON (Javascript Object Notation) is a popular data-interchange format and supported by a lot of script languages. On AutoIt, there is already a >JSON UDF written by Gabriel Boehme. It is good but too slow, and not supports unicode and control characters very well. So I write a new one (and of course, fast one as usual). I use a machine code version of JSON parser called "jsmn". jsmn not only supports standard JSON, but also accepts some non-strict JSON string. See below for example. Important Update!! I rename the library from jsmn.au3 to json.au3. All function names are changed, too. Decoding Function Json_Decode($Json) $Json can be a standard or non-standard JSON string. For example, it accepts: { server: example.com port: 80 message: "this looks like a config file" } The most JSON data type will be decoded into corresponding AutoIt variable, including 1D array, string, number, true, false, and null. JSON object will be decoded into "Windows Scripting Dictionary Object" retuned from ObjCreate("Scripting.Dictionary"). AutoIt build-in functions like IsArray, IsBool, etc. can be used to check the returned data type. But for Object and Null, Json_IsObject() and Json_IsNull() should be used. If the input JSON string is invalid, @Error will be set to $JSMN_ERROR_INVAL. And if the input JSON string is not finish (maybe read from stream?), @Error will be set to $JSMN_ERROR_PART. Encoding Function Json_Encode($Data, $Option = 0, $Indent = "\t", $ArraySep = ",\r\n", $ObjectSep = ",\r\n", $ColonSep = ": ") $Data can be a string, number, bool, keyword(default or null), 1D arrry, or "Scripting.Dictionary" COM object. Ptr will be converted to number, Binary will be converted to string in UTF8 encoding. Other unsupported types like 2D array, dllstruct or object will be encoded into null. $Option is bitmask consisting following constant: $JSON_UNESCAPED_ASCII ; Don't escape ascii charcters between chr(1) ~ chr(0x1f) $JSON_UNESCAPED_UNICODE ; Encode multibyte Unicode characters literally $JSON_UNESCAPED_SLASHES ; Don't escape / $JSON_HEX_TAG ; All < and > are converted to \u003C and \u003E $JSON_HEX_AMP ; All &amp;amp;amp;s are converted to \u0026 $JSON_HEX_APOS ; All ' are converted to \u0027 $JSON_HEX_QUOT ; All " are converted to \u0022 $JSON_PRETTY_PRINT ; Use whitespace in returned data to format it $JSON_STRICT_PRINT ; Make sure returned JSON string is RFC4627 compliant $JSON_UNQUOTED_STRING ; Output unquoted string if possible (conflicting with $JSMN_STRICT_PRINT) Most encoding option have the same means like PHP's json_enocde() function. When $JSON_PRETTY_PRINT is set, output format can be change by other 4 parameters ($Indent, $ArraySep, $ObjectSep, and $ColonSep). Because these 4 output format parameters will be checked inside Jsmn_Encode() function, returned string will be always accepted by Jsmn_Decode(). $JSON_UNQUOTED_STRING can be used to output unquoted string that also accetped by Jsmn_Decode(). $JSON_STRICT_PRINT is used to check output format setting and avoid non-standard JSON output. So this option is conflicting with $JSON_UNQUOTED_STRING. Get and Put Functions Json_Put(ByRef $Var, $Notation, $Data, $CheckExists = False) Json_Get(ByRef $Var, $Notation) These functions helps user to access object or array more easily. Both dot notation and square bracket notation can be supported. Json_Put() by default will create non-exists objects and arrays. For example: Local $Obj Json_Put($Obj, ".foo", "foo") Json_Put($Obj, ".bar[0]", "bar") Json_Put($Obj, ".test[1].foo.bar[2].foo.bar", "Test") Local $Test = Json_Get($Obj, '["test"][1]["foo"]["bar"][2]["foo"]["bar"]') ; "Test" Object Help Functions Json_ObjCreate() Json_ObjPut(ByRef $Object, $Key, $Value) Json_ObjGet(ByRef $Object, $Key) Json_ObjDelete(ByRef $Object, $Key) Json_ObjExists(ByRef $Object, $Key) Json_ObjGetCount(ByRef $Object) Json_ObjGetKeys(ByRef $Object) Json_ObjClear(ByRef $Object) These functions are just warps of "Scripting.Dictionary" COM object. You can use these functions if you are not already familiar with it. == Update 2013/05/19 == * Add Jsmn_Encode() option "$JSMN_UNESCAPED_ASCII". Now the default output of Json_Encode() is exactly the same as PHP's json_encode() function (for example, chr(1) will be encoded into u0001). $JSON_UNESCAPED_ASCII ; Don't escape ascii charcters between chr(1) ~ chr(0x1f) == Update 2015/01/08 == * Rename the library from jsmn.au3 to json.au3. All function names are changed, too. * Add Json_Put() and Json_Get() * Add Null support * Using BinaryCall.au3 to loading the machine code. == Update 2018/01/13== (Jos) * Add JsonDump() to list all Json Keys and their values to easily figure out what they are. == Update 2018/10/01== (Jos) * Fixed JsonDump() some fields and values were not showing as discussed here - tnx @TheXman . == Update 2018/10/01b== (Jos) * Added Json_ObjGetItems, Tidied source and fixed au3check warnings - tnx @TheXman . == Update 2018/10/28== (Jos) * Added declaration for $value to avoid au3check warning - tnx @DerPensionist == Update 2018/12/16== (Jos) * Added another declaration for $value to avoid au3check warning and updated the version at the top - tnx @maniootek == Update 2018/12/29== (Jos) * Changed Json_ObjGet() and Json_ObjExists() to allow for multilevel object in string. == Update 2019/01/17== (Jos) * Added support for DOT notation in JSON functions. == Update 2019/07/15== (Jos) * Added support for reading keys with a dot inside when using a dot as separator (updated) == Update 2021/11/18== (TheXman) * Update details in below post: == Update 2021/11/20== (TheXman) * Minor RegEx update, no change to the functionality or result._Json(2021.11.20).zip1 point
-
[SOLVED] _IEFrameGetObjByName Errors.
Earthshine reacted to Davidowicza for a topic
I actually never knew Exitloop had parameters to work with! It makes life so much easier haha. Thanks for that. Changed to: While 1 $oFrames = _IEFrameGetCollection($o_IE) $iNumFrames = @extended For $i = 0 to ($iNumFrames - 1) $oFrame = _IEFrameGetCollection($o_IE, $i) if $oFrame.name = "j_id53" Then $oSelects = _IETagNameGetCollection($oFrame, "select") ExitLoop(2) EndIf Next sleep(100) WEnd1 point -
I'm not sure where you're getting @error equals 1 means listview doesn't exist, as I mentioned if you look at ListViewColorsFonts_SetItemColorsFonts return values (see below), this function requires that $fColorsFonts includes 1/2/4? The $fColorsFonts is set in "$L_Stat = ListViewColorsFonts_Init( $G_LViewHdl, 64, 1, False )", you are using 64 but haven't added 1, 2 or 4 or a combination? You also haven't added the ListViewColorsFonts(_Redraw(...) which changes the color afterwards, I recommend you look at Lars examples specifically "...\Examples\0) UDF examples\3) ListViewColorsFonts_SetItemColorsFonts" and work backwards from that. ; Return values .: Failure - Returns -1 and sets @error: ; 1 - This function requires that $fColorsFonts includes 1/2/4 ; 2 - Listview not found ; 3 - Invalid listview item ; 4 - Invalid listview subitem ; 5 - Invalid font or style ; 6 - Too many color parameters ; 7 - Invalid color value1 point
-
%windir% folder on a networked PC
weirddave reacted to Network_Guy for a topic
u can use cmd commend like : echo %windir% to get winpath , then use any remote cmd execution method to run it remotly for any pc in domain like PSexec remote WMIC1 point -
If you look at the return codes of the function, it tells you that this issue is with ListViewColorsFonts_Init second parameter $fColorsFonts, you also are using GuiCtrlSetData (...) which means you have no listview items, you would need to use GUICtrlCreateListViewItem(...) instead to create the items.1 point
-
Use %1 example: Save this Script as Commands.au3 Compile as Commands.exe Run: Commands.exe --Install nb: This adds the registry items for all files You should now be able to right click any file and get the path. PS: Run: Commands.exe --Uninstall (if you want to uninstall) #RequireAdmin #NoTrayIcon If _CmdLine_Exists("Install") Then RegWrite('HKCR\*\shell\Send parameters to this CmdLine.exe -1\command', '', 'REG_SZ','"' & @ScriptFullPath & '" -1 "%1"') RegWrite('HKCR\*\shell\Send parameters to this CmdLine.exe -2\command', '', 'REG_SZ','"' & @ScriptFullPath & '" -2 "%1"') Exit ElseIf _CmdLine_Exists("Uninstall") Then RegDelete('HKCR\*\shell\Send parameters to this CmdLine.exe -1') RegDelete('HKCR\*\shell\Send parameters to this CmdLine.exe -2') Exit EndIf Global $g_sCmdLine If _CmdLine_Exists("1") Then $g_sCmdLine = _CmdLine_SwitchValue("1") If $g_sCmdLine = Null Then Exit MsgBox(4096, "CmdLine 1", "CmdLine 1 - Null Value") MsgBox(4096, "CmdLine 1", $g_sCmdLine) ElseIf $g_sCmdLine = _CmdLine_SwitchValue("2") Then If $g_sCmdLine = Null Then Exit MsgBox(4096, "CmdLine 2", "CmdLine 2 - Null Value") MsgBox(4096, "CmdLine 2", $g_sCmdLine) EndIf Func _CmdLine_SwitchValue($sCmdLine, $vResult = Null) For $i = 1 To $CmdLine[0] If $CmdLine[$i] = "/" & $sCmdLine Or $CmdLine[$i] = "-" & $sCmdLine Or $CmdLine[$i] = "--" & $sCmdLine Then If $CmdLine[0] >= $i + 1 Then If StringLeft($CmdLine[$i + 1], 1) = "/" Or StringLeft($CmdLine[$i + 1], 1) = "-" Or StringLeft($CmdLine[$i + 1], 2) = "--" Then Return $vResult Else Return $CmdLine[$i + 1] EndIf EndIf EndIf Next Return $vResult EndFunc Func _CmdLine_Exists($sCmdLine) For $i = 1 To $CmdLine[0] If $CmdLine[$i] = "/" & $sCmdLine Or $CmdLine[$i] = "-" & $sCmdLine Or $CmdLine[$i] = "--" & $sCmdLine Then Return True EndIf Next Return False EndFunc1 point
-
[SOLVED] _IEFrameGetObjByName Errors.
Earthshine reacted to Davidowicza for a topic
I want to thank you @Nine for pointing me in the right direction. Changed when looking for iFrames to this: $bFound = False While $bFound = False $oFrames = _IEFrameGetCollection($o_IE) $iNumFrames = @extended For $i = 0 to ($iNumFrames - 1) $oFrame = _IEFrameGetCollection($o_IE, $i) if $oFrame.name = "j_id53" Then sleep(500) $bFound = True $oSelects = _IETagNameGetCollection($oFrame, "select") ExitLoop EndIf Next sleep(100) WEnd and it works like a charm! (took me so long to respond because after I got this working, other areas were causing me grief so I had to take care of those first)1 point -
Currently not, you can find the currently supported abbrevs in the file Data\Properties\abbrev.properties. (Or can replace it with your own copy)1 point
-
Finding last row in an excel column
pixelsearch reacted to Jfish for a topic
Yes, see this line below. $LastRow = $oWorkbook.ActiveSheet.Range("A1").SpecialCells($xlCellTypeLastCell).Row1 point -
If window is not active then exit
SkysLastChance reacted to ssubirias3 for a topic
Try something like the below example. Also search the Help file for WinWait() and WinExists() for more information. WinWait("Program Name", "", 3) If WinExists("Program Name", "") Then If Not WinActive("Program Name", "") Then WinActivate("Program Name", "") WinWaitActive("Program Name", "") Sleep(5000) Else Exit EndIf1 point -
Solved. Thanks to Dent for working on this so diligently. Turns out if I _FTP_FileDelete the file first then the newly uploaded one is fine. I may well have discovered an FTPEx.au30 points