Reading a currently open webpage and getting data

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
malcev
Posts: 1769
Joined: 12 Aug 2014, 12:37

Re: Reading a currently open webpage and getting data

02 Sep 2020, 20:55

Why you add a reference twice?
Just to show that when We release 1 of them - 1 remains.
Why you link to an outdated forum?
Because there is answer:
Window := ComObjEnwrap(9, pwin, 1) ; <-- does pwin still need released?
if I wrap the pointer with ComObj(9,ptr,1), would I still have to Release the object?
No.
At help of old version 1.1.12.00 - August 14, 2013 We can read:
ComObjActive is polymorphic; that is, any function-call beginning with "ComObj" that does not match one of the other COM functions actually calls ComObjActive. For example, ComObj(9, DispPtr) and ComObjActive(DispPtr) are both equivalent to ComObjEnwrap(DispPtr)
teadrinker
Posts: 4326
Joined: 29 Mar 2015, 09:41
Contact:

Re: Reading a currently open webpage and getting data

02 Sep 2020, 21:09

Ok, remains incomprehensible why ObjAddRef(DispPtr) needs to be used here:
ComObject := ComObject(9, DispPtr, 1), ObjAddRef(DispPtr)
malcev
Posts: 1769
Joined: 12 Aug 2014, 12:37

Re: Reading a currently open webpage and getting data

02 Sep 2020, 21:13

Found lexikos answer:
In short, ObjAddRef is needed when you want another "reference"...

If you have a pointer in variable x which is going to be released and you want a copy of the pointer (a "reference") in variable y which must exist after x is released, you need to AddRef (and Release at some point). For instance, if you are given a pointer as a parameter in a callback and you want to store it, you must AddRef, because the caller owns the initial "reference".

To put it another way, ComObj(9, Ptr, 1) will call ObjRelease(Ptr) at some point. If that is not appropriate, you need to balance it out in advance by calling ObjAddRef(Ptr).
https://www.autohotkey.com/boards/viewtopic.php?p=58465#p58465
guest3456
Posts: 3463
Joined: 09 Oct 2013, 10:31

Re: Reading a currently open webpage and getting data

03 Sep 2020, 11:19

haha ok thanks guys, so AddRef is not needed after all

william_ahk
Posts: 486
Joined: 03 Dec 2018, 20:02

Re: Reading a currently open webpage and getting data

11 Aug 2021, 23:44

@teadrinker I extended RunJsFromChromeAddressBar (toclip, bounds, etc.) a bit, should I post it here or in a new thread?
Nixcalo
Posts: 116
Joined: 06 Feb 2018, 04:24

Re: Reading a currently open webpage and getting data

02 May 2022, 19:20

teadrinker wrote:
17 Mar 2020, 07:43
A simple example. Open https://time.is/Unix_time_now in Chrome, run the script:
How the heck is this simple? It's Navajo mixed with ancient Chinese and a pinch of prehistoric Greek for me! I understand not a thing! Isn't there a simple way to get the text for the translation result frame in a simple deepl.com translation done in Edge/Chrome? Man I have spent like one hour trying to decipher 1% of your Unix timestamp reading script, and failed miserably!
teadrinker
Posts: 4326
Joined: 29 Mar 2015, 09:41
Contact:

Re: Reading a currently open webpage and getting data

03 May 2022, 05:20

Nixcalo wrote: get the text for the translation result frame in a simple deepl.com translation
See this post.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: makdc96, RandomBoy, Rohwedder and 177 guests