Feb 25 2010

AutoHotKey: Copy and Paste to Microsoft Excel

yar0zfuw AutoHotKey: Copy and Paste to Microsoft ExcelI was working on some stuff the other day; it was completely boring and monotonous, but I had to grab information from a webpage […] 3 pieces of it and then paste it in to a Microsoft Excel spreadsheet.

The constant switching back and forth was insane.

I wasn’t able to do all this automatically [hands off], but I made it a lot easier.

I wrote an AutoHotKey script to work for me…

I used my keyboards ‘S’, ‘D’ and ‘F’ keys to grab the 3 pieces of information from the web page and after the 3rd piece of information was collected, it inserted it in to the Excel spreadsheet. ‘X’ is the exit key – when your ready to exit, press it.

Simple, organized and clean. Took me a lot less time. And because I’ve to do this periodically – it’s a keeper, but I wanted to share.

It’s very simple.

Here:

SetTitleMatchMode 2
SetKeyDelay,10

s::
send, {CTRLDOWN}c{CTRLUP}
system=%clipboard%
TrayTip, Status, Copied System,,1000
return

d::
send, {CTRLDOWN}c{CTRLUP}
description=%clipboard%
sleep, 50
return

f::
send, {CTRLDOWN}c{CTRLUP}
price=%clipboard%
sleep, 100

;;— Enter the data in Excel
WinWait, Microsoft Excel,
IfWinNotActive, Microsoft Excel, , WinActivate, Microsoft Excel,
WinWaitActive, Microsoft Excel,

clipboard=%system%
send, {CTRLDOWN}v{CTRLUP}
send, {right}
sleep, 50

clipboard=%description%
send, {CTRLDOWN}v{CTRLUP}
send, {right}{right}{right}
sleep, 50

clipboard=%price%
send, {CTRLDOWN}v{CTRLUP}
send, {enter}{left}{left}{left}{left}
sleep, 50

clipboard=
return

x::exitapp
return

Just trying to help…

 

Thanks,
LHenryJr.
www.lehsys.com

Support the site — Share this!

  • Esgrimidor

    wonderful indeed.

    Best Regards

    • Glad it helps…
      Thanks for your comments…

  • Nathan Slaughter

    Exactly what I was looking for. Thanks for the write up and the code.

    • I still use this AHK to this day; I've modified it some more, but it seems to do the job. And it saves me a ton of time. Just trying to help…

      Thanks for your comments…
      I hope you have a nice day!

  • Berit

    can you please help me to do a script for farmtown I want to use Alt tab for harvest,plow and sawing, I am total stupid on this script thing 🙁
    tyvm in advance

    • I have one, called RAPIDO FARMER…
      I hope this helps…

      Until next time,
      Larry Henry Jr.

  • pritam barkade

    Hi your trick is so good.I am also frustrated due to some copy paste document .If you have some script to copy something and which will directly paste to excel document without opening it OR something like that please send me