Bookman Posted October 22, 2005 Share Posted October 22, 2005 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 More sharing options...
BigDod Posted October 22, 2005 Share Posted October 22, 2005 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 More sharing options...
Bookman Posted October 22, 2005 Author Share Posted October 22, 2005 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 EndFuncOnce the scanner is activated, it sends F6 <string>EnterThe process is for AutoIT is:Recognize the hot keySave the <string> to the clipboardSend CtrlS to the database programWait for the recognition window to openSend the <string> from the clipboardWhat 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 More sharing options...
BigDod Posted October 22, 2005 Share Posted October 22, 2005 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 EndFuncOnce the scanner is activated, it sends F6 <string>EnterThe process is for AutoIT is:Recognize the hot keySave the <string> to the clipboardSend CtrlS to the database programWait for the recognition window to openSend the <string> from the clipboardWhat 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 More sharing options...
LxP Posted October 23, 2005 Share Posted October 23, 2005 (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 October 23, 2005 by LxP Link to comment Share on other sites More sharing options...
Bookman Posted October 23, 2005 Author Share Posted October 23, 2005 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) EndFuncI'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 More sharing options...
LxP Posted October 23, 2005 Share Posted October 23, 2005 The (F6) should be {F6}. I've fixed my code above to reflect this. Sorry about that. Link to comment Share on other sites More sharing options...
LxP Posted October 23, 2005 Share Posted October 23, 2005 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) EndFuncWith 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 More sharing options...
Bookman Posted October 24, 2005 Author Share Posted October 24, 2005 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 More sharing options...
LxP Posted October 24, 2005 Share Posted October 24, 2005 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 More sharing options...
Bookman Posted October 25, 2005 Author Share Posted October 25, 2005 I see how that works, got it. Thanks for all of your help. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now