Is there a paste function in chrome console?

Chrome provides a copy(myCopyObj) to copy an object. Do we have anything similar in terms of pasting an object or getting the contents from the clipboard?

Chrome Extension find, then store in clipboard

I currently have a little program that I made using a simple coding program called AutoHotKey. What this program does, is every time the user presses CTRL+F1 it will open the source code inspector in google chrome (CTRL+SHIFT+I) copy all of the code (CTRL+C) and close the source code inspector. Once it has all of the source code in the clipboard, it stores it into variable Haystack.

(But first, it trims off the first 190,000 characters because 100% of the time the code it needs is not there). Then it stores search functions into variables, to make my code look better.
(installDateNeedle = (?<=txtAppointmentDate" value=").*(?=">) means it will look for the string between the double colons :: "txtAppointmentDate" value=" :: and ending with :: "> ::.

Then it begins with the simple Needle in the haystack searches. Once it finds all of the information, it stores all of the data back into the clipboard in the format of:

install: xx
acc#: xx
internet: xx
prev prov: xx
auto pay: xx
pp: xx

My code works, 100%. But the biggest issue is the beginning, pulling the source code off of google chrome. Because The latency of that window pulling up changes every time, so I have to have a large pause window to ensure that it opens up fully. And sometimes it still doesn’t work.

I want to create a google chrome extension that does everything this program does.

BUT, instead of triggering it with CTRL+F1, I want them to just click an icon in the top right-hand corner. Instead of having to use key presses and CTRL+C to get the HTML code, I want it to automatically import it all into the program. After that, everything can be the same.

I have never made any extensions before, so I don’t even know where to start.

My questions:

  • Is this possible with a google chrome extension?
  • Can I use some of my old code? Specifically the RegExMatch stuff.
  • How do I start?

This is my code that works as a small EXE file from AutoHotkey:


Send, {lcontrol Down}{lshift Down}{i}{lcontrol Up}{lshift Up}
sleep, 1000
Send, {lcontrol Down}{a}{lcontrol Up}
sleep, 500
Send, {lcontrol Down}{c}{lcontrol Up}
Send, {lcontrol Down}{lshift Down}{i}{lcontrol Up}{lshift Up}

StringTrimLeft, Haystack, Clipboard, 190000

installDateNeedle = (?<=txtAppointmentDate" value=").*(?=">)
installSTimeNeedle = (?<=txtStartTime" value=").*(?=">)
installFTimeNeedle = (?<=txtEndTime" value=").*(?=">)
internetNeedle = (?<=id="cmbCustom7DDDB" value=").*(?=">)
prevProvNeedle = (?<=id="cmbCustom14DDDB" value=").*(?=">)
autoPayNeedle = (?<=id="cmbCustom17DDDB" value=").*(?=">)
ppNeedle = (?<=id="cmbCustom18DDDB" value=").*(?=">)
accNumNeedle = (?<=claimID=)d+

RegExMatch(Haystack, installDateNeedle, installDate)
RegExMatch(Haystack, installSTimeNeedle, installStart)
RegExMatch(Haystack, installFTimeNeedle, installFinish)
RegExMatch(Haystack, internetNeedle, internet)
RegExMatch(Haystack, prevProvNeedle, prevProv)
RegExMatch(Haystack, autoPayNeedle, autoPay)
RegExMatch(Haystack, ppNeedle, pp)
RegExMatch(Haystack, accNumNeedle, accNum)

Clipboard := Format("install: {:l} {:l} - {:l}`nacc#: {:l}`ninternet: {:l}`nprev prov: {:l}`nauto pay: {:l}`npp: {:l}", installDate, installStart, installFinish, accNum, internet, prevProv, autoPay, pp)