Copy value from document.getElementbyId

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
RyanAyton
Posts: 49
Joined: 14 Aug 2017, 09:53

Copy value from document.getElementbyId

18 Dec 2017, 13:17

Hello

How would I go about getting the value of document.getElementbyId and copying it to my clipboard?

Thank you,
Ryan
User avatar
boiler
Posts: 16960
Joined: 21 Dec 2014, 02:44

Re: Copy value from document.getElementbyId

18 Dec 2017, 13:45

Replace "wb" with your web browser object name and "MyID" with the element ID:
Clipboard := wb.document.getElementById("MyID").Value
RyanAyton
Posts: 49
Joined: 14 Aug 2017, 09:53

Re: Copy value from document.getElementbyId

18 Dec 2017, 13:52

Thank you for that.

I use Chrome so would this work?

Clipboard := chrome.document.getElementById("pg:addCommentF:addCommentPB:rptOrder:1:emailCustomerPBS:emailCustomerPBSI:j_id93").innerText.trim().Value
RyanAyton
Posts: 49
Joined: 14 Aug 2017, 09:53

Re: Copy value from document.getElementbyId

18 Dec 2017, 14:18

Because what I have just now is I use this as an email template:

Code: Select all

::#p::
	Send, Hello {enter 4}
	Send, If you're happy with this outcome, then you don't need to reply as the case will close automatically. {enter 2}
	Send, If you feel this isn't resolved, please reply within 30 days and this will re-open the case back into my queue.{enter 2}
	Send, Kind Regards{enter}
	Send, Ryan Ayton
Return
What I would like is for the value I get from document.getElementbyId to be pasted after "Hello" so then I don't need to type/copy+paste the name into the email.
gregster
Posts: 9020
Joined: 30 Sep 2013, 06:48

Re: Copy value from document.getElementbyId

18 Dec 2017, 14:19

I use Chrome so would this work?
No, Chrome has no generic COM support. Either use use Internet Explorer (only browser which has it) or you will have to look into using the Selenium Webdriver with Chrome.
Also, I doubt that you can use the javascript (?) function Trim() like this with COM in AHK... but you can trim the value you get with AHK.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: NinjoOnline and 291 guests