Jump to content

Buffer Input Hotkey


Bookman
 Share

Recommended Posts

I just started using Autoit and really like it. I'm trying to create a hot key set that will receive a hot key sent by a scanner (or Mag Stripe Reader)Receive the data from the scanner, send a Ctrl+S keystroke combination, Sleep for 1/2 second, then send the data from the scanner. I have a program in Filemaker 8 Advanced that I am trying to automate the input, but when I use a hotkey combo and dont buffer the data output, the program is not fast enough and loses the first two or three characters of the data. For example, everything works fine, triggering the script, but when scanning a credit card, part of the last name is lost, or when scanning a part number, only 10 or 11 of the 13 digits comes through. If I maually trigger the script (in FM) then scan, everything works fine. I tried inserting a pause in the output, bu it is not possible with my barcode scanner. If anyone has an idea, it would be greatly appreciated.

Link to comment
Share on other sites

I just started using Autoit and really like it. I'm trying to create a hot key set that will receive a hot key sent by a scanner (or Mag Stripe Reader)Receive the data from the scanner, send a Ctrl+S keystroke combination, Sleep for 1/2 second, then send the data from the scanner. I have a program in Filemaker 8 Advanced that I am trying to automate the input, but when I use a hotkey combo and dont buffer the data output, the program is not fast enough and loses the first two or three characters of the data. For example, everything works fine, triggering the script, but when scanning a credit card, part of the last name is lost, or when scanning a part number, only 10 or 11 of the 13 digits comes through. If I maually trigger the script (in FM) then scan, everything works fine. I tried inserting a pause in the output, bu it is not possible with my barcode scanner. If anyone has an idea, it would be greatly appreciated.

It may be easier for someone to help if you could post some of your code.


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

It may be easier for someone to help if you could post some of your code.

Thanks. I really don't know what I'm doing with AutoIt yet, but here is my first attempt.

HotKeySet("(F6)","Search")

Func Search()

ClipPut()

send("^s")

Sleep(500)

ClipGet

EndFunc

Once the scanner is activated, it sends F6 <string>Enter

The process is for AutoIT is:

Recognize the hot key

Save the <string> to the clipboard

Send CtrlS to the database program

Wait for the recognition window to open

Send the <string> from the clipboard

What I'm getting currently directly from the scanner is that the first 1 to 3 characters of the <string> are lost while the database program opens it recognition window, and there is no way to program a pause into the sacnner output.

Link to comment
Share on other sites

Thanks. I really don't know what I'm doing with AutoIt yet, but here is my first attempt.

HotKeySet("(F6)","Search")

Func Search()

ClipPut()

send("^s")

Sleep(500)

ClipGet

EndFunc

Once the scanner is activated, it sends F6 <string>Enter

The process is for AutoIT is:

Recognize the hot key

Save the <string> to the clipboard

Send CtrlS to the database program

Wait for the recognition window to open

Send the <string> from the clipboard

What I'm getting currently directly from the scanner is that the first 1 to 3 characters of the <string> are lost while the database program opens it recognition window, and there is no way to program a pause into the sacnner output.

I suspect that the data is getting lost at the ClipPut stage and not whilst waiting for the recognition window to open.


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

Welcome to the forums!

Perhaps this will help you:

HotkeySet('{F6}', 'Search')

Func Search()
    Local $Input = InputBox('Scanning', 'Incoming data:')
    WinActivate('Title of database program goes here')
    Send('^s')
    WinWaitActive('Title of entry window goes here')
    Send($Input, 1)
EndFunc
Edited by LxP
Link to comment
Share on other sites

Welcome to the forums!

Perhaps this will help you:

HotkeySet('(F6)', 'Search')

Func Search()
    Local $Input = InputBox('Scanning', 'Incoming data:')
    WinActivate('Title of database program goes here')
    Send('^s')
    WinWaitActive('Title of entry window goes here')
    Send($Input, 1)
EndFunc
I'm trying this , but with not much luck. I can't get the machine to recognize the hot key. I'll keep trying.

Thanks

Link to comment
Share on other sites

Actually, I'll add a small modification:

HotkeySet('{F6}', 'Search')
While 1
    Sleep(0x7FFFFFFF)
WEnd

Func Search()
    Local $Input = InputBox('Scanning', 'Incoming data:')
    If @Error Then Return
    WinActivate('Title of database program goes here')
    Send('^s')
    WinWaitActive('Title of entry window goes here')
    Send($Input, 1)
EndFunc

With this modification if the user presses the F6 key on the keyboard, they can now click Cancel on the resulting box and all will be alright. Also I added a While..WEnd loop to make sure that the script remains in memory (therefore being able to intercept the hotkey).

Link to comment
Share on other sites

I'm still fiddling with the code, but making progress. Another question, is there a way that this script can be modified so that I can send a command from another program to close the script? I'm using this with a Filemaker DB app and would like the script to close when the user closes the DB. I can script to send a command o close automatically, but can't send a hot key.

Thanks

Link to comment
Share on other sites

Something like this should do the trick:

; Define the main database window title here
Global Const $DB = 'MyDatabase v1.0 - Main Window'

; Wait for the database software to open
; (continue if already open)
WinWait($DB)

; Activate the hotkey
HotkeySet('{F6}', 'Search')

; Wait for the database software to close
WinWaitClose($DB)

; The script will terminate at this point

Func Search()
    Local $Input = InputBox('Scanning', 'Incoming data:')
    If @Error Then Return
    WinActivate($DB)
    Send('^s')
    WinWaitActive('Title of entry window goes here')
    Send($Input, 1)
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...