Jump to content

santaryan

Members
  • Posts

    6
  • Joined

  • Last visited

santaryan's Achievements

Seeker

Seeker (1/7)

1

Reputation

  1. Here is the JSMN_Get function that Ward wrote in post #12 written to allow both delimiter notation (dot, comma, pipe, whatever notation) and JSON notation. ; #FUNCTION# =================================================================== ; Name: Jsmn_Get ; Description: Retrieves a value from the scripting.dictionary key specified ; ; Parameter(s): ; $Object Scripting dictionary object ; ; $Key Key for the value you want to retrieve. Follows delimiter based or JSON based format depending on the notation parameter ; ; $Notation ; 0 - Delimiter based - Key1.Key2 ; 1 - JSON format based ["key1"]["key2"] ; ; $Delim If notation = 0 Then this is the delimiter between keys ; ; Requirement(s): JSMN JSON library by Ward. ; ; Return Value(s): ; On Success Returns value from key ; ; On Failure Returns a blank string and an error value. ; @error ; 1 - key does not exist ; 2 - notation syntax error ; @Extended - Only used if notation = 0 ; See StringSplit error codes ; ; Author(s): Ward (modified slightly by SantaRyan to add delimiter notation) ;=============================================================================== Func Jsmn_Get($Object, $Key, $Notation = 0, $Delim = ".") If Not $Key Then Return $Object If IsKeyword($Notation) Then $Notation = 0 Local $Index, $Match, $Ret If $Notation = 0 Then $Match = StringSplit($Key, $Delim, 1) If IsArray($Match) Then $Index = $Match[1] $Key = "" For $i = 2 To $Match[0] $Key &= $Match[$i] & $Delim Next $Key = StringTrimRight($Key, 1) Else Return SetError(2, 0, "") EndIf ElseIf $Notation = 1 Then $Match = StringRegExp($Key, "(^\[([^\]]+)\])", 3) If IsArray($Match) Then $Index = Jsmn_Decode($Match[1]) $Key = StringTrimLeft($Key, StringLen($Match[0])) Else Return SetError(2, 0, "") EndIf EndIf If IsString($Index) And Jsmn_IsObject($Object) And Jsmn_ObjExists($Object, $Index) Then $Ret = Jsmn_Get(Jsmn_ObjGet($Object, $Index), $Key, $Delim) Return SetError(@error, 0, $Ret) ElseIf IsNumber($Index) And IsArray($Object) And $Index >= 0 And $Index < UBound($Object) Then $Ret = Jsmn_Get($Object[$Index], $Key, $Delim) Return SetError(@error, 0, $Ret) Else Return SetError(1, 0, "") EndIf EndFunc ;==>Jsmn_Get
  2. RunWait(@Comspec & ' /c set __COMPAT_LAYER=RunAsInvoker ' & 'start' & 'C:Program Filestest 123test 123.exe') Should be RunWait(@Comspec & ' /C set __COMPAT_LAYER=RunAsInvoker & start "" "C:Program Filestest 123test 123.exe"')
  3. Example: FindWindowEx(Null, Null, MAKEINTATOM(0xC017, TEXT("Start")) converted to AutoIt using a dll call (Which I assume is correct), $NULL = ""; null-terminated string $hWnd = _WinAPI_FindWindow("Shell_TrayWnd", "") $Atom = "" ;MAKEINTATOM(0xC017) - How would I do this in AutoIt? $StartMenu = DllCall("user32.dll", "HWND", "FindWindowEx", "HWND", $hWnd, "HWND", $Null, "str", $Atom, "str", "Start") I'm extremely new to using DllCall and I know very little C. The overall effect that I am trying to achieve is to hide the Windows 7 Start Orb. I have already hidden the taskbar. That's extremely easy. Just put in _WinAPI_ShowWindow($hWnd, @SW_HIDE) in the above code.
  4. Is there any way to use the macro MakeIntAtom in AutoIt?
  5. Ah... knew it was something silly like that.. Sorry for the trouble. I'm surprised that to function doesn't save the current working directory before it opens the dialog and then reapplies the working directory after the script is finished. Oh well, guess theres reasoning behind it that I don't fully know about at the current moment. xP Thank you for your quick reply.
  6. This is my first time making a GUI and I'm very inexperienced in AutoIt (just started actually using it), so sorry if this isn't the information you need to help me. I have a script that is asking to input (GUICtrlCreateInput) a path and filename and then write that given information into an .ini file (IniWrite). You have the option of doing this 3 different ways: drag and drop ($WS_EX_ACCEPTFILES, and $GUI_DROPACCEPTED)type directly into the input boxfile open prompt (FileOpenDialog) by clicking on a button (GUICtrlCreateButton)The first 2 ways work fine (Drag and Drop and Direct Typing), but the last one (File Open Prompt) disables the ability to write to the .ini. How my code functions for the file open prompt: You click on a button (GUICtrlCreateButton)You select an item from the dialog (FileOpenDialog)When you hit ok, it writes the return value to the input box (GUICtrlSetData)You then click another button which performs the actual writing (GUICtrlRead and IniWrite)It DOES write the information back into the input box properly, and I can verify this by a MsgBox (using GUICtrlRead just as I do on the IniWrite), but it fails to write to the ini. Another problem is that after using the File Open Dialog prompt, it entirely disables the ability to write to an ini. So even re-editing the input box by typing directly, or by dragging and dropping, won't make it work again. Anybody mind telling me what the problem is?? I have attached the script with the exit ability of the "Save And Exit" button disabled, the secondary input box ini writing disabled, and instead of just writing to the file with no verification, it will open a msgbox as well to verify the input box text. It is dirty scripting and doesn't have the variables declared at the top. If this is the problem then please let me know. I declare variables at the top only after I have finished writing the script. Lastly, I will reupload the file with detailed documentation if you cannot understand it. TestCFGRead.au3
×
×
  • Create New...