AutoHotkey Community

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

All times are UTC [ DST ]




Post new topic Reply to topic  [ 17 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: November 7th, 2009, 8:37 pm 
thanks for the help guys. i really appreciate it

i have a new, slightly similar problem.

what i want to do now is capture the url of the page and then paste it into notepad, then add a new line, and then capture the webpage and paste that into the same notepad file.

Code:
^`::
IfWinExist, Mozilla Firefox
    WinActivate ; use the window found above
else
    MsgBox,Firefox not open
Sleep 50
clipboard = ; Empty the clipboard
Sleep 50
Send {F6}
Sleep 50
Send {Ctrl Down}a
Sleep 50
Send {Ctrl Up}
Sleep 50
Send {Ctrl Down}c
Sleep 50
Send {Ctrl Up}
Sleep 50
ClipWait, 2
if ErrorLevel
{
    MsgBox, The attempt to copy text onto the clipboard failed.
    return
}
IfWinExist, ahk_class Notepad
    WinActivate ; use the window found above
else
    MsgBox,Notepad not open
Sleep 50
Send {Ctrl Down}v
Sleep 50
Send {Ctrl Up}
Sleep 50
clipboard = `r`n
Sleep 50
Send {Ctrl Down}v
Sleep 50
Send {Ctrl Up}
Sleep 50
IfWinExist, Mozilla Firefox
    WinActivate ; use the window found above
else
    MsgBox,Firefox not open
Sleep 50
Send {F6}
Sleep 50
Send {Tab 3}
Sleep 50
Send {Ctrl Down}a
Sleep 50
Send {Ctrl Up}
Sleep 50
Send {Ctrl Down}c
Sleep 50
Send {Ctrl Up}
Sleep 50
Clipwait, 2
if ErrorLevel
{
    MsgBox, 2nd attempt to copy text onto the clipboard failed.
    return
}
Sleep 50
IfWinExist, ahk_class Notepad
    WinActivate ; use the window found above
else
    MsgBox,Notepad not open
Sleep 50
Send {Ctrl Down}v
Sleep 50
Send {Ctrl Up}
Sleep 50
IfWinExist, Mozilla Firefox
    WinActivate ; use the window found above
else
    MsgBox,Firefox not open
Sleep 50
Send {Ctrl Down}{Tab}
Sleep 50
Send {Ctrl Up}


I can get up to the error 2nd attempt to copy. Not sure what is wrong there.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 7th, 2009, 9:28 pm 
Offline

Joined: March 27th, 2009, 1:00 am
Posts: 26
You might find it more reliable to use Sean's COM and GetWebBrowser functions... I'm not sure what you need from the webpage, but it can likely be found just as easy (if not easier) in the source.

This works for me in IE7...
Code:
#NoEnv
#include COM.ahk
#include GetWebBrowser.ahk

`::
Com_Init()
pwb := GetWebBrowser()
gUrl := COM_Invoke(pwb, "LocationURL")
pwbHtml := COM_Invoke(pwb,"document.documentelement.outerHTML")
FileDelete, %A_WorkingDir%\Temp.txt
FileAppend, %gUrl%`n%pwbHtml%, %A_WorkingDir%\Temp.txt
Run, %A_WorkingDir%\Temp.txt
Com_Term()


It's how I would do it anyway.

Sean's GetWebBrowser:


Code:
GetWebBrowser() ; written by Sean
{
   ControlGet, hIESvr, hWnd, , Internet Explorer_Server1, ahk_class IEFrame
   If Not   hIESvr
      Return
   DllCall("SendMessageTimeout", "Uint", hIESvr, "Uint", DllCall("RegisterWindowMessage", "str", "WM_HTML_GETOBJECT"), "Uint", 0, "Uint", 0, "Uint", 2, "Uint", 1000, "UintP", lResult)
   DllCall("oleacc\ObjectFromLresult", "Uint", lResult, "Uint", COM_GUID4String(IID_IHTMLDocument2,"{332C4425-26CB-11D0-B483-00C04FD90119}"), "int", 0, "UintP", pdoc)
   IID_IWebBrowserApp := "{0002DF05-0000-0000-C000-000000000046}"
   pweb := COM_QueryService(pdoc,IID_IWebBrowserApp,IID_IWebBrowserApp)
   COM_Release(pdoc)
   Return   pweb
}


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot] and 17 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