Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Title + url + TimeDate + FixedText + Selected text of chrome
#1
Hello,

I want to make this for chrome browser. I have an extension - Tabcopy - which copies title n url of current tab. I want to do this - 
1. Move mouse (not click) to the chrome extension icon (which is next to address bar) (Can I somehow treat chrome extension icon as child of chrome, to click to its extension icon accurately ? This wud be very helpful)
2. Wait for 1.2 sec
3. Now click on the extension icon.
4. Now after getting the tile n url of current pg copied to clipboard after clicking on extension icon, I want current date+time to be copied to clipboard in a custom format - like 03:15 PM - 27Sep20 (for todays 12hour format time n date)
5. Next I want that the selected text which I have already selected before running this macro, in chrome, is copied to clipboard - this just needs ctrl + c key to be pressed.

6. Now I want all these things copied alltogether to clipboard - The titlenurl got + newline + custom date + newline + a fixed text line like (MY CHROME COPIED CONTENTS) + newline + newline + selected text.
This wud be done by saving to different variables in quickmacros, the clipboard content got at above steps and merging them all up with newlines n my fixed line above.

Need help on creating this all.

Thanks really.
#2
I have been waiting for long to get the answer, please help me in this Masters - Gintaras or Kevin or anyone else.
#3
You don't even need tabcopy extension at all for this

Code:
Copy      Help
int w=wait(3 WV win("- Google Chrome" "Chrome_WidgetWin_1"))
Acc a.Find(w "DOCUMENT" "" "" 0x3000 3)
str title=a.Name
str url =a.Value
str td.timeformat("{hh:mm tt} - {ddMMMyy}")
act w
str contents.getsel(0 0 0)
str result=F"{title}[]{url}[]{td}[](MY CHROME COPIED CONTENTS)[][]{contents}"
out result;; just here to show output in qm not needed
result.setclip
#4
Thanks master Kevin. This was good to begin.

Although I am having some issue - that I have saved your code in a new macro and am calling the macro from a toolbar button, the toolbar runs at chrome.

I have a clipboard utility that saves all clipboard contents - Clipdiary software. Its great to use for my purposes. I have set it also to make a sound every time it captures new clipboard content.

Now when I clicked the toolbar button, the sound that comes from clipdiary comes at much delay - like sometimes 4 seconds, after clicking the toolbar button, and sometimes even 10+ seconds, sometimes no sound comes even after clicking the toolbar button for even 20+ seconds.

- -

I also tried to call macro by setting keyboard trigger of ctrl + shift + alt + r key, to see if any problem is calling by toolbar button. but still problem exists.

- -

So now I thought maybe getting title n url by qm method of find in your given code is causing delays. So I tried to edit the code to just get title + url by ALT+C key which is the tabcopy chrome extensions hotkey to copy the title + url to clipboard.

Now I am using this code - 

 
Code:
Copy      Help
 
int w=win("- Google Chrome" "Chrome_WidgetWin_1")
key Ac          ;; Alt+C

str tabcopystextboth.getclip
str td.timeformat("{hh:mm tt} - {ddMMMyy}")
act w
str contents.getsel(0 0 0)
 str result=F"{title}[]{url}[]{td}[](MY CHROME COPIED CONTENTS)[][]{contents}"
str result=F"{tabcopystextboth}[]{td}[](MY CHROME COPIED CONTENTS)[][]{contents}"
out result;; just here to show output in qm not needed
result.setclip

Now error coming with this code is - this macro when run by even trigger of ctrl+alt+shift+r, just copies the tabcopy ext title+url, and doesnt set to clipboard the whole format that I desire from result.setclip.

Whats going wrong ?

I just want the macro to run fast without initial delay problems and want to get title+url, just by pressing ALT+C of tabcopy extension.

Sorry for the long detailed post and Really Thanks for your help MASTER KEVIN or MASTER GINTARAS or other users.
#5
need  to add  opt clip 1
Code:
Copy      Help
spe -2;;autodelay for code to run smoother if this code is in a function
opt clip 1;; this sets options to not restore clipboard after using getsel
int w=win("- Google Chrome" "Chrome_WidgetWin_1")
act w
key Ac          ;; Alt+C
0.3;;needs some delay here for tabcopy to finish
str tabcopystextboth.getclip
str td.timeformat("{hh:mm tt} - {ddMMMyy}")
str contents.getsel
str result=F"{tabcopystextboth}[]{td}[](MY CHROME COPIED CONTENTS)[][]{contents}"
out result;; just here to show output in qm not needed
result.setclip


i don't know if your toolbar is attached to chrome window or not. below is code for attached toolbar and functions run off that toolbar

Toolbar Toolbar_Attached_To_Chrome
Trigger !a"- Google Chrome" "Chrome_WidgetWin_1"     Help - how to add the trigger to the macro
Code:
Copy      Help
Use QM :int+ c_tbwindow=GetToolbarOwner(TriggerWindow); mac "GetInfo_Acc"
Use TabCopy :int+ c_tbwindow=GetToolbarOwner(TriggerWindow); mac "GetInfo_tabcopy"

toolbar functions
Function GetInfo_Acc
Code:
Copy      Help
opt clip 1
spe -2
int+ c_tbwindow
int w1=c_tbwindow
Acc a.Find(w1 "DOCUMENT" "" "" 0x2000 3)
str title=a.Name
str url=a.Value
str td.timeformat("{hh:mm tt} - {ddMMMyy}")
str contents.getsel
str result=F"{title}[]{url}[]{td}[](MY CHROME COPIED CONTENTS)[][]{contents}"
out result;; just here to show output in qm not needed
result.setclip
act _hwndqm;;just here to show qm window again not needed

Function GetInfo_tabcopy
Code:
Copy      Help
spe -2
opt clip 1
int+ c_tbwindow
int w1=c_tbwindow
str s.all; s.setclip
key Ac          ;; Alt+C
0.3;;needs some delay here for tabcopy to finish
str tabcopystextboth.getclip
str td.timeformat("{hh:mm tt} - {ddMMMyy}")
str contents.getsel
str result=F"{tabcopystextboth}[]{td}[](MY CHROME COPIED CONTENTS)[][]{contents}"
out result;; just here to show output in qm not needed
result.setclip
act _hwndqm;;just here to show qm window again not needed

Also make sure Enable chrome acc when it starts is checked in qm options
qm window menu tools/options
   
#6
Thanks Master.

The first code is working perfect for me. I also added up the other two functions and also the toolbar code n run the toolbar. The qm info getter still takes many seconds delay before getting all, even after chrome acc option enabling, but the tabcopy getter works very well.

I was wanting these codes for so long, u really helped me a great deal here.

Thank you Again.


Forum Jump:


Users browsing this thread: 1 Guest(s)