 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Sean
Joined: 12 Feb 2007 Posts: 2462
|
Posted: Sun May 13, 2007 11:48 am Post subject: Retrieve AddressBar of Firefox through DDE Message |
|
|
As firefox uses non-standard controls, there are few elegant ways to retrieve the URL from the address bar.
So, I tried to get it using DDE (Message) and managed it to work.
I tested it only with Firefox 2.0.0.3 in XPSP2.
But, it should work with IE and Opera too, as they also support DDE(ML).
DOWNLOAD DDE.ahk.
Last edited by Sean on Tue Aug 21, 2007 5:18 am; edited 6 times in total |
|
| Back to top |
|
 |
Arnoud
Joined: 23 Mar 2007 Posts: 15
|
Posted: Sun May 13, 2007 1:00 pm Post subject: |
|
|
| Works on Opera 9.20 WinXP SP2 |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 8688
|
Posted: Sun May 13, 2007 2:43 pm Post subject: |
|
|
Works in Win 2000 SP4
FireFox 2.0.0.3
Opera 9.20
Thanks ..
Any way to copy the Statusbar text to Clipboard ?
I have a script to automate image downloads in Google Image search
In IE, I hover the mouse over the link and press a hotkey. The URL will be fetched from the statusbar and processed before being added to my download manager. It would be nice If I can do it firefox.
 |
|
| Back to top |
|
 |
polyethene
Joined: 11 Aug 2004 Posts: 5248 Location: UK
|
Posted: Sun May 13, 2007 3:48 pm Post subject: |
|
|
It only gives the URL of the last open Firefox window. Is there anyway to get all URLs of windows belonging to the same process? _________________ GitHub • Scripts • IronAHK • Contact by email not private message. |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 2462
|
Posted: Mon May 14, 2007 12:19 am Post subject: |
|
|
| Skan wrote: | | Any way to copy the Statusbar text to Clipboard ? |
I don't think there is a (dde) topic related with the statusbar. You may take a look at this page.
http://support.microsoft.com/kb/q160957/
Looks like not all topics here are supported by firefox. |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 2462
|
Posted: Mon May 14, 2007 12:22 am Post subject: |
|
|
| Titan wrote: | | It only gives the URL of the last open Firefox window. Is there anyway to get all URLs of windows belonging to the same process? |
I think it's the last 'active' one to be precise.
The best way I can think of atm is that cycling through the opened firefox windows, then activating each and retrieving the URL. |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 8688
|
Posted: Mon May 14, 2007 1:43 pm Post subject: |
|
|
Thanks for the Link.  |
|
| Back to top |
|
 |
Joy2DWorld
Joined: 04 Dec 2006 Posts: 561 Location: Galil, Israel
|
Posted: Mon May 21, 2007 12:47 am Post subject: wow... nice |
|
|
This one has been frustrating me for MONTHS!!
thanks!
here is my NOT WORKING & I DON'T KNOW WHY code (from http://www.autohotkey.com/forum/topic17326.html )
| Code: |
; trying to figure out the DLLCALL equivalence...
;
;
LPDWORD := "UIntP"
PFNCALLBACK := "UInt" ; or should that be Int ?
DWORD := "UInt"
HSZ := "UInt" ; is that right ?
UINTc := "UShort" ; Can this be right ? is it UInt ?? Int ??
NULL := "Int"
LPTSTR := "str"
INTc := "short" ; maybe Int ??? SEE BELOW FOR MS DEFS...
APPCLASS_STANDARD := 0
CP_WINANSI := 1004
CF_TEXT := 1
XTYP_EXECUTE = 0x0050
XTYP_POKE = 0x0090
XTYP_REQUEST = 0x00B0
VarSetCapacity(ddeServer, 256,0)
VarSetCapacity(ddeDataE, 256,0)
VarSetCapacity(ddeData,33000)
VarSetCapacity(ReturnV1,33000)
ddeServer = excel
ddeTopic =
ddeData = [formula(\"SWI-Prolog\",\"r1c1\")]
pidInst := 0
if ( DllCall("DdeInitialize"
, LPDWORD, pidInst
, PFNCALLBACK, 0
, DWORD, APPCLASS_STANDARD
, DWORD, 0 ) )
msgbox ERROR with DDEInitialze !
HddeServer := DllCall("DdeCreateStringHandle"
, DWORD, pidInst
, LPTSTR, ddeServer
, INTc, CP_WINANSI )
HddeTopic := DllCall("DdeCreateStringHandle"
, DWORD, pidInst
, LPTSTR, ddeTopic
, INTc, CP_WINANSI )
ddeDataE =
HddeDataE := DllCall("DdeCreateStringHandle"
, DWORD, pidInst
, LPTSTR, ddeDataE
, INTc, CP_WINANSI )
HddeConversation := DllCall("DdeConnect"
, DWORD, pidInst
, HSZ, HddeServer
, HSZ, HddeTopic
, Null, 0 )
ddeData = [formula(\"SWI-Prolog\",\"r1c1\")]
BddeData := StrLen(ddeData) + 1
ddeResult = 0
;
; THIS IS NOT SEEMING TO WORK
;
ReturnV1 := DllCall("DdeClientTransaction"
, STR, ddeData
, DWORD, BddeData
, Uintc, HddeConversation
, DWORD , HddeDataE
, UINTc, CF_TEXT ; NOTE: should be ZERO with execute
, UINTc, XTYP_EXECUTE
, DWORD, 1000
, LPDWORD, ddeResult ) ;
compare := 0x4000 + 0
msgbox 32,, % DllCall("DdeGetLastError", DWORD, idInst) " :" compare
exitapp
|
likely you can figure out what i've missed out on ??
also had an idea about the callback....
made a very simple machine code 'do nothing' and return ... and put it into a string... then used the strings address as callback address...
but seems this all was unnecessary....
only SERVER seems to need callback...
would very much like your help to figure out...
a full fledged DDE tool would be nice for AHK... _________________ Joyce Jamce |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 2462
|
Posted: Mon May 21, 2007 3:05 am Post subject: Re: wow... nice |
|
|
| Joy2DWorld wrote: | | here is my NOT WORKING & I DON'T KNOW WHY code |
Looks like some of the variables are defined wrongly.
| Code: | XCLASS_DATA := 0x2000
XCLASS_FLAGS := 0x4000
XTYP_EXECUTE := 0x0050 | XCLASS_FLAGS
XTYP_POKE := 0x0090 | XCLASS_FLAGS
XTYP_REQUEST := 0x00B0 | XCLASS_DATA
|
BTW, as far as I can see, there is no argument with (U)INTc types there, but it won't affect the result in this case. |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 2462
|
Posted: Mon May 21, 2007 7:39 am Post subject: |
|
|
I updated the script.
Now, there exist two versions: DDEMessage & DDEML.
And, it'll finally work with iexplore too. |
|
| Back to top |
|
 |
Joy2DWorld
Joined: 04 Dec 2006 Posts: 561 Location: Galil, Israel
|
Posted: Tue May 22, 2007 12:31 am Post subject: Nice. |
|
|
@Sean,
somehow, the 'psychology' of DDE is evading my grasp...
poke, and Execute (for eg. word & excell control...) seem easy enough... but... just not working for me...
likely you can do better!
http://msdn2.microsoft.com/en-us/library/ms648995.aspx
my... UGGGGG... not seeming to want to work for me code!!!
| Code: | Command :="[command goes here]"
CommandL := strlen(Command) +1
HCommand := DllCall("GlobalAlloc"
, UINT, 0x0000 ; 0x0040 ??
, UINT, CommandL) ; ie. size
if HCommand
DllCall("MoveMemory"
, UINT, HCommand
, UINT, &Command
, UINT, CommandL )
Else
msgbox "error no HCommand handle from teh global allocation"
PostMessage, WM_DDE_EXECUTE, ClientHwnd, HCommand,, ahk_id %ServerHwnd% |
and... please...
what am I missing here ???
my dll execute is a flop too!!!! uggggggg!!
| Code: | DLL_Execute(Item, nTimeOut = 10000, nFormat = 0)
{
Global idInst, hConv,ddeResult
Return DllCall("DdeClientTransaction" , "UintP", Item, "Uint", strlen(Item) + 1 , "Uint" , hConv, "Uint", 0, "Uint", nFormat ,"Uint ", 0x2050, "Uint", nTimeOut, "Uint" , ddeResult )
} |
_________________ Joyce Jamce
Last edited by Joy2DWorld on Tue May 22, 2007 1:25 am; edited 1 time in total |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 2462
|
Posted: Tue May 22, 2007 12:54 am Post subject: Re: Nice. |
|
|
| Joy2DWorld wrote: | | poke, and Execute (for eg. word & excell control...) |
With Execute or Poke, unlike in Request, you can't neglect the first/second arguments in DdeClientTransaction.
| Code: | | DllCall("DdeClientTransaction", "Uint", &Command, "Uint", StrLen(Command)+1, "Uint", hConv, "Uint", hItem, "Uint", 1, "Uint", XTYP_EXECUTE, "Uint", 10000, "UintP", nResult) |
BTW, I don't think you have to do GlobalAlloc yourself with DDE, but, I must admit I haven't tried myself.
If it really needs GlobalAlloc or alike, you may better use DdeCreateDataHandle instead (:at least with Poke).
| Code: | hData := DllCall("DdeCreateDataHandle", ...)
DllCall("DdeClientTransaction", "Uint", hData, "Uint", -1, "Uint", hConv, "Uint", hItem, "Uint", 1, "Uint", XTYP_POKE, "Uint", 10000, "UintP", nResult)
|
|
|
| Back to top |
|
 |
Joy2DWorld
Joined: 04 Dec 2006 Posts: 561 Location: Galil, Israel
|
Posted: Tue May 22, 2007 1:32 am Post subject: |
|
|
re:
| Quote: | | DllCall("DdeClientTransaction", "Uint", &Command, "Uint", StrLen(Command)+1, "Uint", hConv, "Uint", hItem, "Uint", 1, "Uint", XTYP_EXECUTE, "Uint", 10000, "UintP", nResult) |
i think on the execute... the
| Quote: | | "Uint", hConv, "Uint", hItem, "Uint", 1, |
is ignored...
i think... so.... actually accord MS...
| Code: | | DllCall("DdeClientTransaction", "Uint", &Command, "Uint", StrLen(Command)+1, "Uint", hConv, "Uint", 0, "Uint", 0, "Uint", XTYP_EXECUTE, "Uint", 10000, "UintP", nResult) |
perhaps ??
ps: Sean... thanks... thanks... and more thanks... for the help, vision & enlightenment.... this is something that has alluded me in AHK for MONTHS!!!!! _________________ Joyce Jamce |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 2462
|
Posted: Tue May 22, 2007 1:35 am Post subject: Re: Nice. |
|
|
| Sean wrote: | | BTW, I don't think you have to do GlobalAlloc yourself with DDE |
OK, I overlooked you used DDE Messages.
Then, it requires GlobalAlloc according to the documentation.
At a glance with your code with GlobalAlloc, looks like you allocate it as GMEM_FIXED (0x0000), but may better use GMEM_MOVEABLE (0x0002) instead. |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 2462
|
Posted: Tue May 22, 2007 1:39 am Post subject: |
|
|
| Joy2DWorld wrote: | | Quote: | | "Uint", hConv, "Uint", hItem, "Uint", 1, | is ignored...
| Code: | | DllCall("DdeClientTransaction", "Uint", &Command, "Uint", StrLen(Command)+1, "Uint", hConv, "Uint", 0, "Uint", 0, "Uint", XTYP_EXECUTE, "Uint", 10000, "UintP", nResult) |
|
You're right. hItem & nFormat should be set to 0 with Execute. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|