AutoHotkey Community

It is currently May 27th, 2012, 11:06 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 56 posts ]  Go to page Previous  1, 2, 3, 4
Author Message
 Post subject: Chinese characters
PostPosted: December 14th, 2010, 5:23 pm 
Sorry in advance for a dumb question. When I try this out of the box, I get a MsgBox with only Chinese characters in it, not the URL I was expecting. I am running this on a Windows 7, English language box. Any ideas why? I ran the same script on an XP box and it worked fine. Is it a Windows 7 issue? Do I have some library installed with Chinese characters or something?

Thanks,
-Dave


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 7th, 2011, 9:19 pm 
This script seems to not work in Firefox 4. Any updated way to grab the URL of the current page through DDE or any other way without using mouse/keyboard actions (control+L , control+C )?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 7th, 2011, 9:54 pm 
Offline

Joined: May 27th, 2007, 9:41 am
Posts: 4999
It does work for me with FF4 so post the code you used.

_________________
AHK FAQ
TF : Text files & strings lib, TF Forum


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 7th, 2011, 10:09 pm 
Code:
ff_dde:

/*
XCLASS_DATA  := 0x2000
XCLASS_FLAGS := 0x4000
XTYP_EXECUTE := 0x0050 | XCLASS_FLAGS
XTYP_POKE    := 0x0090 | XCLASS_FLAGS
XTYP_REQUEST := 0x00B0 | XCLASS_DATA
*/

sServer := "firefox"
sTopic  := "WWW_GetWindowInfo"
sItem   := "0xFFFFFFFF"

idInst  := DdeInitialize()

hServer := DdeCreateStringHandle(idInst, sServer)
hTopic  := DdeCreateStringHandle(idInst, sTopic )
hItem   := DdeCreateStringHandle(idInst, sItem  )

hConv := DdeConnect(idInst, hServer, hTopic)
hData := DdeClientTransaction(0x20B0, hConv, hItem)   ; XTYP_REQUEST
sData := DdeAccessData(hData)

DdeFreeStringHandle(idInst, hServer)
DdeFreeStringHandle(idInst, hTopic )
DdeFreeStringHandle(idInst, hItem  )

DdeUnaccessData(hData)
DdeFreeDataHandle(hData)
DdeDisconnect(hConv)
DdeUninitialize(idInst)

;-----------------------------------
Loop,   Parse,   sData, CSV
   If   A_Index = 1
      sURL   := A_LoopField
   Else If   A_Index = 2
      sTitle   := A_LoopField

msgbox, %sURL%`n%sTitle%
return
;-----------------------------------

DdeInitialize(pCallback = 0, nFlags = 0)
{
   DllCall("DdeInitialize", "UintP", idInst, "Uint", pCallback, "Uint", nFlags, "Uint", 0)
   Return idInst
}

DdeUninitialize(idInst)
{
   Return DllCall("DdeUninitialize", "Uint", idInst)
}

DdeConnect(idInst, hServer, hTopic, pCC = 0)
{
   Return DllCall("DdeConnect", "Uint", idInst, "Uint", hServer, "Uint", hTopic, "Uint", pCC)
}

DdeDisconnect(hConv)
{
   Return DllCall("DdeDisconnect", "Uint", hConv)
}

DdeAccessData(hData)
{
   Return DllCall("DdeAccessData", "Uint", hData, "Uint", 0, "str")
}

DdeUnaccessData(hData)
{
   Return DllCall("DdeUnaccessData", "Uint", hData)
}

DdeFreeDataHandle(hData)
{
   Return DllCall("DdeFreeDataHandle", "Uint", hData)
}

DdeCreateStringHandle(idInst, sString, nCodePage = 1004)         ; CP_WINANSI = 1004
{
   Return DllCall("DdeCreateStringHandle", "Uint", idInst, "Uint", &sString, "int", nCodePage)
}

DdeFreeStringHandle(idInst, hString)
{
   Return DllCall("DdeFreeStringHandle", "Uint", idInst, "Uint", hString)
}

DdeClientTransaction(nType, hConv, hItem, sData = "", nFormat = 1, nTimeOut = 10000)   ; CF_TEXT = 1
{
   Return DllCall("DdeClientTransaction", "Uint", sData = "" ? 0 : &sData, "Uint", sData = "" ? 0 : StrLen(sData)+1, "Uint", hConv, "Uint", hItem, "Uint", nFormat, "Uint", nType, "Uint", nTimeOut, "UintP", nResult)
}


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 7th, 2011, 10:15 pm 
Offline

Joined: May 27th, 2007, 9:41 am
Posts: 4999
Works for me, you are probably using the Unicode version of AHK_L aren't you? If so the DLLCalls will probably fail see http://www.autohotkey.net/~Lexikos/Auto ... Compat.htm (DLLCall) for info.

_________________
AHK FAQ
TF : Text files & strings lib, TF Forum


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 7th, 2011, 10:36 pm 
Yes, using latest AHK_L unicode. Any ideas on how to fix the DLLCall stuff? I see that one line of code mentions ANSI in the comment. But I don't understand the code enough to be able to fix it.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 8th, 2011, 3:00 pm 
Offline

Joined: May 27th, 2007, 9:41 am
Posts: 4999
Me neither :-( Perhaps someone will see this and post an updated version for AutoHotkey_L Unicode.

There are other alternatives:
1) MozRepl
http://www.autohotkey.com/forum/viewtopic.php?t=46974
2) reading sessionstore.js
http://www.autohotkey.com/forum/viewtop ... 115#316115
3) sending keyboard shortcuts to focus on location bar and copy url (ctrl-l, ctrl-a, ctrl-c)

_________________
AHK FAQ
TF : Text files & strings lib, TF Forum


Report this post
Top
 Profile  
Reply with quote  
PostPosted: May 31st, 2011, 7:52 pm 
Offline

Joined: May 26th, 2011, 9:46 pm
Posts: 1
I got it working using DDEmessage. How ever if i have multiple IE applications, I may get the inactive window or get response from multiple windows.

Is there some way to start DDE with just the active window of IE. I believe we can get the window handle of Active winodw using command

WinGet whndl A

Please help me figure this out


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 1st, 2011, 9:43 pm 
Offline

Joined: June 20th, 2008, 12:40 pm
Posts: 47
This Code works with AHK_L. Be aware though, that the returned clipboard format is CF_TEXT, not CF_UNICODETEXT, since I couldn't get that to work.

Code:
FF_RetrievePageName()
   {
   DllCall("DdeInitializeW","UPtrP",idInst,"Uint",0,"Uint",0,"Uint",0)

   ; CP_WINANSI = 1004   CP_WINUNICODE = 1200
   hServer := DllCall("DdeCreateStringHandleW","UPtr",idInst,"Str","firefox","int",1200)
   hTopic  := DllCall("DdeCreateStringHandleW","UPtr",idInst,"Str","WWW_GetWindowInfo","int",1200)
   hItem   := DllCall("DdeCreateStringHandleW","UPtr",idInst,"Str","0xFFFFFFFF","int",1200)

   hConv := DllCall("DdeConnect","UPtr",idInst,"UPtr",hServer,"UPtr",hTopic,"Uint",0)
   ; CF_TEXT = 1      CF_UNICODETEXT = 13
   hData := DllCall("DdeClientTransaction","Uint",0,"Uint",0,"UPtr",hConv,"UPtr",hItem,"UInt",1,"Uint",0x20B0,"Uint",10000,"UPtrP",nResult)
   sData := DllCall("DdeAccessData","Uint",hData,"Uint",0,"str")

   DllCall("DdeFreeStringHandle","UPtr",idInst,"UPtr",hServer)
   DllCall("DdeFreeStringHandle","UPtr",idInst,"UPtr",hTopic)
   DllCall("DdeFreeStringHandle","UPtr",idInst,"UPtr",hItem)
   DllCall("DdeUnaccessData","UPtr",hData)
   DllCall("DdeFreeDataHandle","UPtr",hData)
   DllCall("DdeDisconnect","UPtr",hConv)
   DllCall("DdeUninitialize","UPtr",idInst)
   result:=StrGet(&sData,"cp0")
   return result
   }



Page title and page address are returned as CSV, which could be split up like this:

Code:
sData:=FF_RetrievePageName()
Loop,Parse,sData,CSV
   {
   If A_Index = 1
      sURL := A_LoopField
   Else If A_Index = 2
      sTitle := A_LoopField
   }



Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 27th, 2012, 12:21 pm 
Offline

Joined: March 18th, 2010, 9:12 am
Posts: 72
My confusion if over - I think :-)
I had a script made in AHK, then I installed AHK_L because of "something", then suddently my old script didn't work - because of AHK_L differs from AHK - off cause!

Well, I tried the above script, and it works for both explorer and firefox, when I change the DllCall, but is it possible to call the function regardsless with browser I use?
Something like this: (But this don't work!)
Code:
....
B=firefox
result:=FF_RetrievePageName(B)
return

FF_RetrievePageName(Browser)
   {
   DllCall("DdeInitializeW","UPtrP",idInst,"Uint",0,"Uint",0,"Uint",0)

   ; CP_WINANSI = 1004   CP_WINUNICODE = 1200
;   hServer := DllCall("DdeCreateStringHandleW","UPtr",idInst,"Str","iexplore","int",1200)
   hServer := DllCall("DdeCreateStringHandleW","UPtr",idInst,"Str",%Browser%,"int",1200)
   hTopic  := DllCall("DdeCreateStringHandleW","UPtr",idInst,"Str","WWW_GetWindowInfo","int",1200)
   hItem   := DllCall("DdeCreateStringHandleW","UPtr",idInst,"Str","0xFFFFFFFF","int",1200)
....


Thanks
Ben


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 27th, 2012, 7:59 pm 
Code:
hServer := DllCall("DdeCreateStringHandleW","UPtr",idInst,"Str",Browser,"int",1200); remove the %%
:?:


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: iDrug, Yahoo [Bot] and 56 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