script to copy and paste first page of google doc Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
vbanait
Posts: 50
Joined: 09 Jul 2016, 05:51

script to copy and paste first page of google doc

Post by vbanait » 29 Jan 2022, 01:21

I want to copy and paste *first-page* of google document for my work. The document contains many pages. I use the following code. It works well when the document consists of one page only. But using it over multipage documents leads to unnecessary duplication. How can I limit it to copy the first page only

Code: Select all

;; Copy and paste the first page of document and bring cursor to beginning of document 
::c@:: 
SendInput, ^a
Sleep 10
SendInput, ^c
Sleep 10
SendInput, {Click} 
Sleep 10
SendInput, {CTRL} {Home} 
Sleep 10
SendInput, ^v
Sleep 10
SendInput, {Click} 
Sleep 10
SendInput, {CTRL}{Home} 
Sleep 10
SendInput, {Click} 
Return

BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: script to copy and paste first page of google doc

Post by BoBo » 29 Jan 2022, 05:04

[guessing]BC you're using ^a (select all) multiple pages will get selected (aren’t Google Doc pages webpages?). Check out if there's a print option available, probably there's a "print current page" included?[/guessing]

Similar approach: https://support.google.com/docs/thread/3192179?hl=en

Looks like the page number is displayed beside the scrollbar (?) what about to limit the selection of text until that page number changes/appears?
https://chrome.google.com/webstore/detail/google-docs-page-jumper/ncgeflnanllngnoanebehpodalfhhpna

vbanait
Posts: 50
Joined: 09 Jul 2016, 05:51

Re: script to copy and paste first page of google doc  Topic is solved

Post by vbanait » 01 Feb 2022, 06:13

Here is my answer. Click below the final line on the page and run the code :)

Code: Select all

::c@:: 
SendInput, {CTRL}{ENTER}
Sleep 1000
SendInput, {CTRL}{SHIFT}{HOME}
Sleep 1000
SendInput, ^c
Sleep 1000
SendInput, {Click} 
Sleep 100
SendInput, {CTRL} {Home} 
Sleep 100
SendInput, ^v
Sleep 100
SendInput, {Click} 
Sleep 100
SendInput, {CTRL}{Home} 
Sleep 100
SendInput, {Click} 
Return  

Post Reply

Return to “Ask for Help (v1)”