Jump to content

Select form data -> Copy -> Paste to different site


Recommended Posts

OK, I know there has to be a way to do this but for the life of me, I haven't been able to figure it out and I have been working on it all day. First, this application needs to be non-browser specific (so the _IE modules are out). Second, I have been able to check the active window to make sure the user is where they are supposed to be when they launch this application. But on that page they are supposed to be on is a HTML address form that already has data. I need to copy all of that data, store it, and paste it into another website. 

Now I have used AutoIT years ago and it worked beautifully, but the past few years, I haven't touched it so I am rusty. I tried using the recorder, but that gave me coordinates and I know that's not going to work. Could someone please point me in the right direction? Here's what I have so far (my several failed attempts have been commented out):

 

; change WinTitleMatchMode default from 1 (match title from start) to 2 (match any substring)
Opt("WinTitleMatchMode", 2)

#include <MsgBoxConstants.au3>
#include <IE.au3>
#Include <WinAPI.au3>

HotKeySet ('!x','_Exit'); Alt+Esc = Exit
;HotKeySet ('!c','_Clip'); Alt+c = copy
;HotKeySet ('!v','_Paste'); Alt+v = paste
HotKeySet ('!a','_Activate'); Alt+a = activate

While '1'
Sleep ('100'); Makes CPU usage 0%
WEnd

Func _Activate ()
  If WinActive("Sales Record") Then
    MsgBox($MB_SYSTEMMODAL, "", "WinActive" & @CRLF & "The correct window is active.")
    Local $sText = WinGetText("[ACTIVE]")
    ; Display the window text.
    MsgBox($MB_SYSTEMMODAL, "", $sText)
    ;Local $oIE = _IEAttach("Sales Record")
    $hWnd = WinGetHandle("[ACTIVE]", "")
    ;MsgBox($MB_SYSTEMMODAL, "", $hWnd)
    ;_WinAPI_SetFocus( $hWnd )
    ;ControlFocus($hWnd, "", "buyercontactname")

    ;MsgBox(64, "", $hWnd)
    ;Local $oInputs = _IETagNameGetCollection($oIE, "input")
    ;For $oInput In $oInputs
        ;MsgBox(64, oInput.name)
        ;MsgBox(64, oInput.value)
        ;if $oInput.name == "fsubmit" And $oInput.value == "Return to Login Page" Then
        ; your code here
        ;Endif
    ;Next
  Else
    MsgBox($MB_SYSTEMMODAL, "", "WinActive" & @CRLF & "You have the incorrect window active.")
  EndIf
EndFunc

Func _Exit ()
  Exit
EndFunc

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...