AutoHotkey Community

It is currently May 25th, 2012, 5:53 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 56 posts ]  Go to page 1, 2, 3, 4  Next
Author Message
PostPosted: May 13th, 2007, 12:48 pm 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
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 August 21st, 2007, 6:18 am, edited 6 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 13th, 2007, 2:00 pm 
Offline

Joined: March 24th, 2007, 12:41 am
Posts: 15
Works on Opera 9.20 WinXP SP2


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 13th, 2007, 3:43 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8775
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.

:)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 13th, 2007, 4:48 pm 
Offline
User avatar

Joined: August 11th, 2004, 1:47 am
Posts: 5346
Location: UK
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?

_________________
GitHubScriptsIronAHK Contact by email not private message.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 14th, 2007, 1:19 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 14th, 2007, 1:22 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 14th, 2007, 2:43 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8775
Sean wrote:
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/


Thanks for the Link. :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject: wow... nice
PostPosted: May 21st, 2007, 1:47 am 
Offline

Joined: December 4th, 2006, 10:35 am
Posts: 561
Location: Galil, Israel
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: wow... nice
PostPosted: May 21st, 2007, 4:05 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 21st, 2007, 8:39 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
I updated the script.
Now, there exist two versions: DDEMessage & DDEML.
And, it'll finally work with iexplore too.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Nice.
PostPosted: May 22nd, 2007, 1:31 am 
Offline

Joined: December 4th, 2006, 10:35 am
Posts: 561
Location: Galil, Israel
@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 May 22nd, 2007, 2:25 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: Nice.
PostPosted: May 22nd, 2007, 1:54 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
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)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 22nd, 2007, 2:32 am 
Offline

Joined: December 4th, 2006, 10:35 am
Posts: 561
Location: Galil, Israel
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: Nice.
PostPosted: May 22nd, 2007, 2:35 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 22nd, 2007, 2:39 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
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.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 56 posts ]  Go to page 1, 2, 3, 4  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 10 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group