Retrieve AddressBar of Firefox through DDE Message
#1
Posted 13 May 2007 - 11:48 AM
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.
#2
Posted 13 May 2007 - 01:00 PM
#3
Posted 13 May 2007 - 02:43 PM
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.
#4
Posted 13 May 2007 - 03:48 PM
#5
Posted 14 May 2007 - 12:19 AM
I don't think there is a (dde) topic related with the statusbar. You may take a look at this page.Any way to copy the Statusbar text to Clipboard ?
<!-- m -->http://support.micro...com/kb/q160957/<!-- m -->
Looks like not all topics here are supported by firefox.
#6
Posted 14 May 2007 - 12:22 AM
I think it's the last 'active' one to be precise.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?
The best way I can think of atm is that cycling through the opened firefox windows, then activating each and retrieving the URL.
#7
Posted 14 May 2007 - 01:43 PM
I don't think there is a (dde) topic related with the statusbar. You may take a look at this page.
<!-- m -->http://support.micro...com/kb/q160957/<!-- m -->
Thanks for the Link.
#8
Posted 21 May 2007 - 12:47 AM
thanks!
here is my NOT WORKING & I DON'T KNOW WHY code (from <!-- m -->http://www.autohotke...topic17326.html<!-- m --> )
; 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...
#9
Posted 21 May 2007 - 03:05 AM
here is my NOT WORKING & I DON'T KNOW WHY code
Looks like some of the variables are defined wrongly.
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.
#10
Posted 21 May 2007 - 07:39 AM
Now, there exist two versions: DDEMessage & DDEML.
And, it'll finally work with iexplore too.
#11
Posted 22 May 2007 - 12:31 AM
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!
<!-- m -->http://msdn2.microso...y/ms648995.aspx<!-- m -->
my... UGGGGG... not seeming to want to work for me 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!!
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 )
}
#12
Posted 22 May 2007 - 12:54 AM
With Execute or Poke, unlike in Request, you can't neglect the first/second arguments in DdeClientTransaction.poke, and Execute (for eg. word & excell control...)
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).
hData := DllCall("DdeCreateDataHandle", ...)
DllCall("DdeClientTransaction", "Uint", hData, "Uint", -1, "Uint", hConv, "Uint", hItem, "Uint", 1, "Uint", XTYP_POKE, "Uint", 10000, "UintP", nResult)
#13
Posted 22 May 2007 - 01:32 AM
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
"Uint", hConv, "Uint", hItem, "Uint", 1,
is ignored...
i think... so.... actually accord MS...
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!!!!!
#14
Posted 22 May 2007 - 01:35 AM
OK, I overlooked you used DDE Messages.BTW, I don't think you have to do GlobalAlloc yourself with DDE
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.
#15
Posted 22 May 2007 - 01:39 AM
You're right. hItem & nFormat should be set to 0 with Execute.is ignored..."Uint", hConv, "Uint", hItem, "Uint", 1,
DllCall("DdeClientTransaction", "Uint", &Command, "Uint", StrLen(Command)+1, "Uint", hConv, "Uint", 0, "Uint", 0, "Uint", XTYP_EXECUTE, "Uint", 10000, "UintP", nResult)




