AutoHotkey Community

It is currently May 26th, 2012, 7:25 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 309 posts ]  Go to page Previous  1 ... 15, 16, 17, 18, 19, 20, 21  Next
Author Message
 Post subject:
PostPosted: April 30th, 2009, 7:48 pm 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
ok i give up
how on earth can i modify the following code to allow ctrl+character combo
below allows a ctrl v but blocks v when it is used without ctrl

Code:
WM_KEYDOWN(wParam, lParam, nMsg, hWnd)
{
  If  (wParam = 0x09 || wParam = 0x0D || wParam = 0x11 || wParam = 0x56 || wParam = 0x2E || wParam = 0x26 || wParam = 0x28) ; tab enter delete up down
  {
      WinGetClass, Class, ahk_id %hWnd%
      If  (Class = "Internet Explorer_Server")
          {
             Global pipa
             VarSetCapacity(Msg, 28)
             NumPut(hWnd,Msg), NumPut(nMsg,Msg,4), NumPut(wParam,Msg,8), NumPut(lParam,Msg,12)
             NumPut(A_EventInfo,Msg,16), NumPut(A_GuiX,Msg,20), NumPut(A_GuiY,Msg,24)
             DllCall(NumGet(NumGet(1*pipa)+20), "Uint", pipa, "Uint", &Msg)
             Return 0
          }
  }
}

_________________
No matter what your oppinion Please join this discussion
Formal request to Polyethene
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 30th, 2009, 9:01 pm 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
ok so this is what i came up with it mostly works accepts ctrl v c and x
Code:
WM_KEYDOWN(wParam, lParam, nMsg, hWnd)
{
   ;http://www.asciitable.com/
   global preKey
   If  (wParam = 0x09 || wParam = 0x0D || wParam = 0x11 || wParam = 0x56 || wParam = 0x43 || wParam = 0x58 || wParam = 0x2E || wParam = 0x26 || wParam = 0x28) ; tab enter delete up down
   {
      WinGetClass, Class, ahk_id %hWnd%
      If   ((preKey <> 0x11) && (wParam = 0x56 || wParam = 0x43 || wParam = 0x58)){
         preKey:=0
         Return
      }
      preKey:= wParam=0x11 ? wParam : 0
      If  (Class = "Internet Explorer_Server")
      {
         Global pipa
         VarSetCapacity(Msg, 28)
         NumPut(hWnd,Msg), NumPut(nMsg,Msg,4), NumPut(wParam,Msg,8), NumPut(lParam,Msg,12)
         NumPut(A_EventInfo,Msg,16), NumPut(A_GuiX,Msg,20), NumPut(A_GuiY,Msg,24)
         DllCall(NumGet(NumGet(1*pipa)+20), "Uint", pipa, "Uint", &Msg)
         Return 0
      }

   }
}

_________________
No matter what your oppinion Please join this discussion
Formal request to Polyethene
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 1st, 2009, 1:32 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
tank wrote:
ok so this is what i came up with it mostly works accepts ctrl v c and x
You can check whether ctrl modifier is pressed or not using GetKeyState(). In this case, however, I recommend monitoring WM_HOTKEY instead after registering the hotkeys using RegisterHotKey API.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 1st, 2009, 3:52 am 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
Thanks Sean
i didnt think of getkeystate
RegisterHotKey API is well way over my head I'm afraid

_________________
No matter what your oppinion Please join this discussion
Formal request to Polyethene
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 1st, 2009, 4:31 am 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
Sean wrote:
tank wrote:
ok so this is what i came up with it mostly works accepts ctrl v c and x
You can check whether ctrl modifier is pressed or not using GetKeyState(). In this case, however, I recommend monitoring WM_HOTKEY instead after registering the hotkeys using RegisterHotKey API.
Thanks a ton Sean here is the final working product
Code:
WM_KEYDOWN(wParam, lParam, nMsg, hWnd)
{
   ;http://www.asciitable.com/
   If  (wParam = 0x09 || wParam = 0x0D || (GetKeyState("Control", "P") && wParam)  || wParam = 0x2E || wParam = 0x26 || wParam = 0x28) ; tab enter delete up down
   {
      WinGetClass, Class, ahk_id %hWnd%
      If  (Class = "Internet Explorer_Server")
      {
         Global pipa
         VarSetCapacity(Msg, 28)
         NumPut(hWnd,Msg), NumPut(nMsg,Msg,4), NumPut(wParam,Msg,8), NumPut(lParam,Msg,12)
         NumPut(A_EventInfo,Msg,16), NumPut(A_GuiX,Msg,20), NumPut(A_GuiY,Msg,24)
         DllCall(NumGet(NumGet(1*pipa)+20), "Uint", pipa, "Uint", &Msg)
         Return 0
      }

   }
}

_________________
No matter what your oppinion Please join this discussion
Formal request to Polyethene
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 1st, 2009, 5:53 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
tank wrote:
here is the final working product
I suppose it may be better just letting the control decide if it's an accelerator. BTW, I think it's a bug of ATL not to do all these by itself.
Code:
WM_KEYDOWN(wParam, lParam, nMsg, hWnd)
{
   If  (wParam = 0x09 || wParam = 0x0D || wParam = 0x2E || wParam = 0x26 || wParam = 0x28 || wParam = 0x43 || wParam = 0x56 || wParam = 0x58)
   {
      WinGetClass, Class, ahk_id %hWnd%
      If  (Class = "Internet Explorer_Server")
      {
         Global pipa
         VarSetCapacity(Msg, 28)
         NumPut(hWnd,Msg), NumPut(nMsg,Msg,4), NumPut(wParam,Msg,8), NumPut(lParam,Msg,12)
         NumPut(A_EventInfo,Msg,16), NumPut(A_GuiX,Msg,20), NumPut(A_GuiY,Msg,24)
         DllCall(NumGet(NumGet(1*pipa)+20), "Uint", pipa, "Uint", &Msg)
         Return 0
      }
   }
}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 1st, 2009, 6:23 am 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
@sean your version actually blocks the characters x c and v when used alone?? am i missing something? :?

_________________
No matter what your oppinion Please join this discussion
Formal request to Polyethene
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 1st, 2009, 6:47 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
Oops, sorry. Another discrepancy between my custom code and the posted one. Anyway, I changed it to check all the keys now. I was a bit concerned about lagging of keystrokes in doing this, so if experience a lag, then fall back to use only the chosen keys.
Code:
WM_KEYDOWN(wParam, lParam, nMsg, hWnd)
{
;   If   (wParam = 0x08 || wParam = 0x09 || wParam = 0x0D || wParam = 0x26 || wParam = 0x28 || wParam = 0x2E || wParam = 0x43 || wParam = 0x56 || wParam = 0x58)
   WinGetClass, Class, ahk_id %hWnd%
   If   (Class = "Internet Explorer_Server")
   {
      Global pipa
      VarSetCapacity(Msg, 28), NumPut(hWnd,Msg), NumPut(nMsg,Msg,4), NumPut(wParam,Msg,8), NumPut(lParam,Msg,12), NumPut(A_EventInfo,Msg,16), NumPut(A_GuiX,Msg,20), NumPut(A_GuiY,Msg,24)
      If   DllCall(NumGet(NumGet(1*pipa)+20), "Uint", pipa, "Uint", &Msg)=0
      Return   0
   }
}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 1st, 2009, 4:30 pm 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
Sean wrote:
I was a bit concerned about lagging of keystrokes in doing this,
Works perfectly
add an IF=0 wow how could any one but you really known it would be so simple

_________________
No matter what your oppinion Please join this discussion
Formal request to Polyethene
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 2nd, 2009, 1:19 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
And, that's not the end of the story. If add more monitoring messages, can also use Alt+Left/Right.
Code:
OnMessage(WM_SYSKEYDOWN:=0x0104, "WM_KEYDOWN"), OnMessage(WM_SYSKEYUP:=0x0105, "WM_KEYDOWN")


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 31st, 2009, 11:22 pm 
Offline

Joined: May 31st, 2009, 10:50 pm
Posts: 6
Sean wrote:
Don't use IE.ahk, it's no longer maintained. I don't even keep it in my machine, neither CoHelper.ahk nor COM.ahk.

Sean, I see that you don't maintain IE.ahk. Could the function IE_GoBack be used on existing Internet Explorer windows? All the examples I seen were using it for an Embeded IE Control.
I simply want to replace the
Code:
Send {Altdown}{Left}{AltUp}
in my code with a function. I am using Tanks IE7 functions for everything else and it is working great. I see Tank has updated his IE7 to iWeb. I plan on leaving my script using IE7 because it is working so well.

My script is able to navigate an IE webpage even with the webpage minimized. I just need this one last thing fixed.

I tried a few things. Of course this is wrong but it is all I have for now.
Code:
COM_Init()
OnExit,Term
pwb := COM_CreateObject("InternetExplorer.Application")

^f5::
Ie_GoBack(pwb)
MsgBox Wait see if it goes back a page
Return


IE_GoBack(pwb)
 {
  DllCall(NumGet(NumGet(1*pwb)+28), "Uint", pwb)
 }

Term:
COM_term()
ExitApp
thanks in advance


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 1st, 2009, 12:06 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
Anxious_Patient wrote:
Could the function IE_GoBack be used on existing Internet Explorer windows?
Sure. BTW, better use this instead.
Code:
COM_Invoke(pwb, "GoBack")


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 1st, 2009, 1:35 am 
Offline

Joined: May 31st, 2009, 10:50 pm
Posts: 6
I removed Ie_GoBack(pwb) and put COM_Invoke(pwb, "GoBack") in its place. Here is the error message I get.

---------------------------
COM Error Notification
---------------------------
Function Name: "GoBack"
ERROR: Unspecified error

(0x80004005)
PROG:
DESC:
HELP: ,0

Will Continue?
---------------------------
Yes No
---------------------------

I do have com.ahk in the lib folder.
Code:
COM_Init()
OnExit,Term
pwb := COM_CreateObject("InternetExplorer.Application")

^f5::
COM_Invoke(pwb, "GoBack")
;Ie_GoBack(pwb)
MsgBox Wait see if it goes back a page
Return




Term:
COM_term()
ExitApp



Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 1st, 2009, 2:58 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
What did you expect? There is no page to go back to.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 1st, 2009, 3:23 am 
Offline

Joined: May 31st, 2009, 10:50 pm
Posts: 6
Sean wrote:
What did you expect? There is no page to go back to.
As my first post indicated I am using an existing Internet Explorer web page.

I have my web page open when I press the hotkey.
I added more code to demostrate what I am trying to do.
Code:
COM_Init()
OnExit,Term
SetTitleMatchMode,2

^f5::
IfWinNotExist,google
MsgBox Please open google then click ok
Loop
 {
  random,Num,14,17
  IE7_Click_Element(IE7_Get("google"),num)
  IE7_readyState(myPageHandle)
  Gosub GetHtmlSourceCode
  IfInString,HtmlCode,Keyword
   {
    ;parse source code for more keywords
    ;do something based on those keywords
   }
  pwb := COM_CreateObject("InternetExplorer.Application")
  COM_Invoke(pwb, "GoBack")
  ;GOBACK a page
  sleep 1800000
 }

Term:
COM_term()
ExitApp

GetHtmlSourceCode:
if (!hIESvr or class != "Internet Explorer_Server")
 return
COM_Error(0)
WM_HTML_GETOBJECT := DllCall("RegisterWindowMessage", "str", "WM_HTML_GETOBJECT")
SendMessage, WM_HTML_GETOBJECT,,,, ahk_id %hIESvr%
lResult := ErrorLevel
DllCall("oleacc\ObjectFromLresult", "uint", lResult, "uint", COM_GUID4String(IID_IHTMLDocument2,"{332C4425-26CB-11D0-B483-00C04FD90119}"), "int", 0, "uint*", pDoc)
DocEle:=COM_Invoke(pDoc, "documentElement")
htmlcode:=COM_Invoke(DocEle,"innerHTML")
COM_Release(DocEle)
COM_Release(pDoc)
return
thanks for your help


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 309 posts ]  Go to page Previous  1 ... 15, 16, 17, 18, 19, 20, 21  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Scratch, Xx7 and 23 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