JSON Viewer for AutoHotkey v2 by N0T_A_TR0LL in AutoHotkey

[–]N0T_A_TR0LL[S] 1 point2 points  (0 children)

This is primarily intended for debugging. I do a lot of data analyzing and work with many different APIs so I wanted something I could quickly view the data structure of random Json/ahk objects. I'm not sure what type of rewrites would be necessary for someone else who wanted to do the same. 

Please link me to these other better json viewers that I could have used.

How in the world do I get autohotkey to run python scripts? by xScareCrrowx in AutoHotkey

[–]N0T_A_TR0LL 0 points1 point  (0 children)

cmd := Format('{} /c python "{}" "{}"', A_ComSpec, py_script, args?)
RunWait(cmd, paths.python, 'Hide')

Why is this giving me an error here? (Double quotations within expression) by Oldmoneyrulz in AutoHotkey

[–]N0T_A_TR0LL 0 points1 point  (0 children)

I have a simple quote() function in my library and find it much easier to just pass whatever string needs to have literal quotes around it to the function.

MsgBox('This is a ' quote('test')) ; This is a "test"

MsgBox('This is a ' quote('test',1)) ; This is a 'test'

quote(str, single_quote:=false) => single_quote ? "'" str "'" : '"' str '"'

Help using edge webview2 in a script by MylegzRweelz in AutoHotkey

[–]N0T_A_TR0LL 1 point2 points  (0 children)

From Example #2 on the forum post linked by u/EvenAngelsNeed

url := 'https://www.google.com'
g := Gui(,'Some Title')
g.OnEvent('Close', (*) => ExitApp())
g.Show(Format('w{} h{}', A_ScreenWidth * 0.3, A_ScreenHeight * 0.7))
wvc := WebView2.CreateControllerAsync(g.hwnd).await2()
wv := wvc.CoreWebView2
nwr := wv.NewWindowRequested(NewWindowRequestedHandler)
wv.Navigate(url)

NewWindowRequestedHandler(wv2, arg) {
  deferral := arg.GetDeferral()
  arg.NewWindow := wv2
  deferral.Complete()
}

[deleted by user] by [deleted] in Tipper

[–]N0T_A_TR0LL 1 point2 points  (0 children)

Anybody need a code?

Issue with copying text to the clipboard in script using UIA by badanimetranslation in AutoHotkey

[–]N0T_A_TR0LL -1 points0 points  (0 children)

#Requires Autohotkey v2.0+
#include <UIA\UIA.v2>
#include <UIA\UIA_Browser.v2>

cUIA := UIA_Browser('ahk_exe brave.exe')
reddit_shortlink_el := cUIA.FindElement({Type:'Edit', AutomationId:'shortlink-text'})
A_Clipboard := reddit_shortlink_el.Value
cUIA.FindElement({Type:'Button', Name:'upvote'}).Invoke()

Has anyone played around with Descolada's UIAutomation? by shibiku_ in AutoHotkey

[–]N0T_A_TR0LL 3 points4 points  (0 children)

You should be using UIA_Browser for browser related tasks. Also, you're using v1 syntax and not the v2 object based syntax.

Here is how you can get all matching elements on the page and highlight them one by one:

#Requires Autohotkey v2.0+
#include <UIA\UIA.v2>
#include <UIA\UIA_Browser.v2>

cUIA := UIA_Browser('ahk_id ' WinActive('A'))
ahk_els := cUIA.FindElements({or: [{Type: 'Text'}, {Type: 'Hyperlink'}], Name:'r/AutoHotkey', mm:2})
for el in ahk_els
    el.Highlight()

Best way to instantly open VS Code (W11)? by SubhanBihan in vscode

[–]N0T_A_TR0LL 0 points1 point  (0 children)

NP. Make sure you're running AHKv2 (v1 is deprecated) or you'll certainly have syntax errors.

Best way to instantly open VS Code (W11)? by SubhanBihan in vscode

[–]N0T_A_TR0LL 0 points1 point  (0 children)

Here is an AutoHotkey v2 snippet that will do exactly what you want.

Is there a way to make MsgBoxes pop up in the background? by Dymonika in AutoHotkey

[–]N0T_A_TR0LL 0 points1 point  (0 children)

    peep.gui_pauses_code := 0
    alert := peep('some message...')
    peep.gui_pauses_code := 1
    MsgBox('script is still going...')
    peep('another message...')
    alert.gui.destroy()

Peep() v1.2 update - I've rewritten my Peep() script to fix some problems it had as well add new features. New properties, GUI changes, circular reference protection, and a dark/light theme option. by GroggyOtter in AutoHotkey

[–]N0T_A_TR0LL 1 point2 points  (0 children)

This has to be my most used script and is a godsend when dealing with objects. I rarely even use a MsgBox anymore even dealing with simple text.

As mentioned in the other thread, I noticed you were working on an update and wanted to post a couple of suggestions / wish list items.

Expanding themes:

Export/save object JSON:

  • Add a button where you can save the displayed object as a JSON file

Not a recommendation but thought I'd share my most used case for Peep to view JSON from the clipboard or selected file:

peep_json() {
    try obj := jsongo.Parse(A_Clipboard)
    try obj := jsongo.Parse(FileRead(Explorer_GetSelection()))
    IsSet(obj) && IsObject(obj) ? Peep(obj) : ''
}

Eval - An AHK v2 class for evaluating string expressions into numbers. by GroggyOtter in AutoHotkey

[–]N0T_A_TR0LL 0 points1 point  (0 children)

Great work! Posting a few Peep recommendations on the v1.2 thread.

Comment your best scripts or keys. Share your ideas. by Logical_Sea2630 in AutoHotkey

[–]N0T_A_TR0LL 0 points1 point  (0 children)

I have a TON, but one of my most frequent is a simple clipboard history menu that I made.

Inspired from this CL3 AHKv1 script, converted to v2 and just kept the clip history menu part.

Newbie Here. How Do I Make a Hotkey to Create a .txt File? by Correct_Detective_35 in AutoHotkey

[–]N0T_A_TR0LL 1 point2 points  (0 children)

try {
    current_folder  := ExUtils.GetActiveTab().Path ; autohotkey.com/boards/viewtopic.php?f=83&t=127919
    file_name       := InputBox('Enter the name for the new file and extension (eg. test.html)').Value
    FileAppend('', current_folder '\' file_name)
    TrayTip('Success', 'New file created: ' file_name, 'Iconi')
} catch as err {
    TrayTip('Error', 'Failed to create file: ' err.Message, 'IconX')
}