Grab Current URL From Firefox
Right now I am just sending F6 to highlight the address bar and collect that text, but this is very inefficient and can produce issues if the caret is already in the address or search bar.
Firefox does not display any kind of control text I can grab either.
I need these URLs to put into a database of recent stumbles and Stumble Upon doesn't offer an API of any sort, so I am a bit lost.
Does anyone have any ideas?
This seems to work for me. I'm using a portable copy of firefox - not sure if that will make a difference or not:
SessionStorePath := "" ; enter sessionstore.js FileName WinGetTitle, WinTitle, ahk_class MozillaUIWindowClass StringReplace, WinTitle, WinTitle, % " - Mozilla Firefox" needle = "url":"([^"]*?)","title":"%WinTitle% FileRead, data, %SessionStorePath% RegExMatch(data,needle,match) MsgBox, %match1%The path to the sessionstore.js file should be something like: %A_AppData%\Mozilla\Firefox\Profile\your profile name\sessionstore.js
Retrieve AddressBar of Firefox through DDE Message
<!-- m -->http://www.autohotke...ic19169-15.html<!-- m -->
F6 and Alt+s work as well...I wrote something similar a while ago, and used ctrl+l (control plus L) to highlight the address bar URL, seemed to be very effective and stable ... and simple.
Programmers don't die, they GOSUB without RETURN
Based on this thread.
This seems to work for me. I'm using a portable copy of firefox - not sure if that will make a difference or not:SessionStorePath := "" ; enter sessionstore.js FileName WinGetTitle, WinTitle, ahk_class MozillaUIWindowClass StringReplace, WinTitle, WinTitle, % " - Mozilla Firefox" needle = "url":"([^"]*?)","title":"%WinTitle% FileRead, data, %SessionStorePath% RegExMatch(data,needle,match) MsgBox, %match1%The path to the sessionstore.js file should be something like: %A_AppData%\Mozilla\Firefox\Profile\your profile name\sessionstore.js
Jethrow - This is very very cool. I had no idea that Firefox kept this data.
The only problem with reading the sessionrestore.js file is that Firefox waits about 1 second AFTER the page is fully loaded to write to this file, which is not a huge problem.
Lexikos - I haven't had time to check this out yet, it will take me a minute to wrap my head around what you are doing. but it seems like some very cool stuff as well as hugov's suggestion of using DDE.
Thanks everyone for their valued and highly appreciated help.
This is why i keep coming back to AHK.
thats interesting - how exactly do you use it though? doesn't really make sense to meI've been using Seans' method for a long time:
Retrieve AddressBar of Firefox through DDE Message
http://www.autohotke...ic19169-15.html
and simply run DDEMessage.ahk
You could create a function for, make a label and #include it in your script it or simply run the Script
run DDEMessage.ahkand it will place title & url on the clipboard for further processing, by adopting the script you can have the title or url only. Works with FF, IE and Opera as far as I know.
Download <!-- m -->https://ahknet.autoh...Scripts/DDE.zip<!-- m -->
and simply run DDEMessage.ahk
You could create a function for, make a label and #include it in your script it or simply run the Scriptrun DDEMessage.ahkand it will place title & url on the clipboard for further processing, by adopting the script you can have the title or url only. Works with FF, IE and Opera as far as I know.
How can I get the URL only? no "s and no title
Don't have the files at hand but look at the sData or sInfo or clipboard variable they contain the url & title. You can simply stringtrim, substr or stringsplit? etc to get either the url or the titleHow can I get the URL only? no "s and no title
Don't have the files at hand but look at the sData or sInfo or clipboard variable they contain the url & title. You can simply stringtrim, substr or stringsplit? etc to get either the url or the titleHow can I get the URL only? no "s and no title
How do I get what is between the first 2 ""?
So insteend of this:
"http://www.google.com/intl/en/","Google",""
this:
<!-- m -->http://www.google.com/intl/en/<!-- m -->
Look at this:How do I get what is between the first 2 ""?
So insteend of this:
"http://www.google.com/intl/en/","Google",""
this:
<!-- m -->http://www.google.com/intl/en/<!-- m -->
list = "http://www.google.com/intl/en/","Google","" Loop, Parse, list, CSV MsgBox %A_LoopField%
No signature.
Look at this:
list = "http://www.google.com/intl/en/","Google","" Loop, Parse, list, CSV MsgBox %A_LoopField%
Hmm..
Why is it so difficult :?
I just want the URL and not the title
I added yours like this:
Clipboard := % sData list = %Clipboard% Loop, Parse, list, CSV MsgBox %A_LoopField%
But then I get 3 msg boxes, url, title and an empty one!
And all I want is to have the url on the clipboard
I believe there is a way to even edit DDEML.ahk itself so it returns with that only, I just don't know how
clipboard="http://www.google.com/intl/en/","Google","" ;method one url1:=substr(clipboard,instr(clipboard,Chr(34))+1,instr(clipboard,Chr(34),false,2)-2) MsgBox % Url1 ;method two Loop, parse, clipboard, csv { url2:=A_LoopField Break } MsgBox % Url2 ;method three StringSplit, url3, clipboard, `, MsgBox % Url31 ; still need to trim " StringTrimLeft, Url31, Url31, 1 StringTrimRight, Url31, Url31, 1 MsgBox % Url31 ; correctYou could also use RegExReplace and a number of other methods I'm sure.