Jump to content

Recommended Posts

Posted

Hello. I'm having trouble pasting information into an Access form. Right now my Autoit script grabs the text from another Program and pastes it into Notepad.

It was a start, but what I really need it to do is paste the information into individual fields on a form.

This is my code so far.

; Get text from Notepad and Put it into Access or Notepad

;Create Variable

Dim $var1 = "No Text Grabbed"

Dim $grabPrimaryIndex, $grabSecondaryIndex, $grabDrawer, $grabFolderType, $grabDoctype

Dim $captureWin = "ImageRight Enterprise Scanner"

Dim $pasteWin = "Untitled - Notepad"

Dim $pasteAccess = "Microsoft Access - Acces_Project_Main : Database (Access 2000 file format)"

; Wait for page to appear

if WinWait($captureWin,"",5) Then

if WinActive($captureWin,"") = 0 then WinActivate($captureWin,"")

;Make sure the controls have all been updated... requires you to change the controls's focus

ControlFocus($captureWin,"","TEdit2")

Send ("{TAB}")

Sleep (500)

$grabPrimaryIndex = ControlGetText($captureWin,"","TEdit2")

$grabSecondaryIndex = ControlGetText($captureWin,"","TEdit1")

$grabDrawer = ControlCommand($captureWin,"","TComboBox3","GetCurrentSelection")

$grabFolderType = ControlCommand($captureWin,"","TComboBox2","GetCurrentSelection")

$grabDoctype = ControlCommand($captureWin,"","TComboBox1","GetCurrentSelection")

;Open Notepad.exe

if WinWait($pasteWin,"",1) = 0 Then run ("notepad.exe")

;Wait for Notepad to open

WinWait ($pasteWin, "")

if WinActive($pasteWin,"") = 0 then WinActivate($pasteWin,"")

if ControlCommand($captureWin,"","TButton3","IsEnabled") Then

$var1 = "Primary Index: " & @TAB & $grabPrimaryIndex & @CRLF

$var1 = $var1 & "Secondary Index: " & @TAB & $grabSecondaryIndex & @CRLF

$var1 = $var1 & "Drawer: " & @TAB & $grabDrawer & @CRLF

$var1 = $var1 & "Folder Type: " & @TAB & $grabFolderType & @CRLF

$var1 = $var1 & "Doc Type: " & @TAB & $grabDoctype & @CRLF

Else

$var1 = "BAD DATA!"

EndIf

ControlSetText ($pasteWin,"","Edit1",$var1)

;Only enable in final production, clicks the scan button if possible.

if ControlCommand($captureWin,"","TButton3","IsEnabled") Then ControlClick ($captureWin,"","TButton3")

EndIf

Any Help would be extremely appreciated.

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
  • Recently Browsing   0 members

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