Sign in to follow this  
Followers 0
Bookman

Buffer Input Hotkey

11 posts in this topic

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.

Share this post


Link to post
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.


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

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

Share this post


Link to post
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.

Share this post


Link to post
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.


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

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

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

The (F6) should be {F6}. I've fixed my code above to reflect this. Sorry about that.

Share this post


Link to post
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).

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

I see how that works, got it. Thanks for all of your help.

Share this post


Link to post
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
Sign in to follow this  
Followers 0