Hi All,
Not sure if this is possible with AHK, but I'm looking to see if a script would allow say an 'Alt + MouseClick' on a URL, which would then paste the text link into a NotePad window, and subsequent links below the first.
Any ideas?
Script to capture/collect URL and paste to Notepad on click
Started by
Pilkojr
, Jun 06 2012 12:56 AM
17 replies to this topic
FileAppend, clipboard variable, send command and clipwait. With these you should go fine.
#2
-
Posted 06 June 2012 - 01:01 AM
Let us not be lazy. Someday it might just kill us.
FileAppend, clipboard variable, send command and clipwait. With these you should go fine.
I've used 'Send' before, but none of the others :-)
#=:: FileAppend, %clipboard%`n, C:\Users\Pilkojr\Desktop\mg.txt Return
This sends the URL I copy to the clipboard into the mg.txt file (if not currently opened). Where would I add code to make it do the above action if I use 'Alt+LeftMouseClick'?
#3
-
Posted 06 June 2012 - 01:33 AM
Ta,
Pilkojr
Pilkojr
!Lbutton:: clipboard := "" clean clipboard KeyWait, Alt ;waits for Alt button to be released Send ^c ;copies whats selected Clipwait ;wait for the clipboard to have content FileAppend, %clipboard%`n, C:\Users\Pilkojr\Desktop\mg.txt Return
This will only work if the url is on the browser bar.
#4
-
Posted 06 June 2012 - 02:56 AM
Let us not be lazy. Someday it might just kill us.
!Lbutton:: clipboard := "" clean clipboard KeyWait, Alt ;waits for Alt button to be released Send ^c ;copies whats selected Clipwait ;wait for the clipboard to have content FileAppend, %clipboard%`n, C:\Users\Pilkojr\Desktop\mg.txt Return
This will only work if the url is on the browser bar.
So would the URL in the browser bar have to be fully selected, then Alt+LeftClick?
I'm trying to get the url/shortcut copied to the clipboard from a html link into notepad (if that makes sense).
#5
-
Posted 06 June 2012 - 03:06 AM
Ta,
Pilkojr
Pilkojr
This code requires AutoHotkey_L and jethrow's Acc Library (saved to your Lib folder), when you press the hotkey it will automatically write the URL for the link under the mouse to the text file:
!LButton:: Acc := Acc_ObjectFromPoint(child), state := Acc.accState(child) if state in 4194368,12582976 FileAppend, % Acc.accValue(child) "`n", C:\Users\Pilkojr\Desktop\mg.txt return
#6
-
Posted 06 June 2012 - 05:19 AM
This code requires AutoHotkey_L and jethrow's Acc Library (saved to your Lib folder), when you press the hotkey it will automatically write the URL for the link under the mouse to the text file:
!LButton:: Acc := Acc_ObjectFromPoint(child), state := Acc.accState(child) if state in 4194368,12582976 FileAppend, % Acc.accValue(child) "`n", C:\Users\Pilkojr\Desktop\mg.txt return
Thank you for the code.
I've d/l'd and installed Autohotkey_L, but I'm unsure about the Acc Library file, and exactly where to put it. I gather the library file is the 'Acc.ahk' file. If so, which Lib folder do I need to put them in?
#7
-
Posted 06 June 2012 - 08:21 AM
Ta,
Pilkojr
Pilkojr
Just a folder named Lib in the same path that you run the script.
Example:
If you run your script at My Documents, just create a folder named Lib there and put Acc.ahk inside it.
Example:
If you run your script at My Documents, just create a folder named Lib there and put Acc.ahk inside it.
#8
-
Posted 06 June 2012 - 11:35 AM
Let us not be lazy. Someday it might just kill us.
Just a folder named Lib in the same path that you run the script.
Example:
If you run your script at My Documents, just create a folder named Lib there and put Acc.ahk inside it.
Thank you. Will try it now
#9
-
Posted 06 June 2012 - 02:07 PM
Ta,
Pilkojr
Pilkojr
It's returning a whole bunch of errors. I'll try to screen capture and post
#10
-
Posted 06 June 2012 - 02:17 PM
Ta,
Pilkojr
Pilkojr
Hi,
I was able to achieve the desired result using this code;
It's probably a bit crude in the code world, but does what I need.
Thank you everyone for your input, as I was able to use bits and pieces to get it going.
I was able to achieve the desired result using this code;
+MButton:: clipboard := "" ;clean clipboard KeyWait, Shift ;waits for Shift button to be released MouseClick, right Sleep 200 Send {t} Sleep 500 Send {Enter} Sleep 1000 FileAppend, %clipboard%`n, C:\Users\Pilkojr\Desktop\mg.txt ;MsgBox, %clipboard% was sent to mg.txt Return
It's probably a bit crude in the code world, but does what I need.
Thank you everyone for your input, as I was able to use bits and pieces to get it going.
#12
-
Posted 06 June 2012 - 02:59 PM
Ta,
Pilkojr
Pilkojr
They aren't errors, they're warnings. At the top of your script you'll find a line that says
#Warn
, put a semicolon in front of that line ;#Warn
, save and restart your script. My code should run fine in either case.
#13
-
Posted 06 June 2012 - 03:14 PM
Thank you, but it didn't paste anything into the mg.txt file
#14
-
Posted 06 June 2012 - 03:20 PM
Ta,
Pilkojr
Pilkojr
It's not going to "paste". Don't even have the text file open, my script automatically writes the URL to the file. Run the hotkey a few times, then open the text file and check for the URLs you hovered over.
#15
-
Posted 06 June 2012 - 04:05 PM