lyonrt Posted December 17, 2007 Share Posted December 17, 2007 I have a simple script that adds a printer then changes around some of the printing properties. However, When I have the script type in the word accounting (to name the printer accounting), it types it too fast and the script types in the word "ting" instead of "accounting." How can I slow down the typing of the word accounting so that it is typed in correctly. Here is the code: expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.10.0 Author: Tyler Lyon Script Function: Adds Accounting Printer for MVI #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here Run("rundll32 printui.dll,PrintUIEntry /il") ;launches add a printer wizard WinWaitActive("Add Printer Wizard") Send("!n") WinWaitActive("Add Printer Wizard") Send("!n") WinWaitActive("Add Printer Wizard") Send("Z");selects first printer to start with "Z" WinWaitActive("Add Printer Wizard") Send("!n") WinWaitActive("Add Printer Wizard") Send("!n") WinWaitActive("Add Printer Wizard") Send("Accounting");names printer "Accounting" Send("!n") WinWaitActive("Add Printer Wizard") Send("!n") WinWaitActive("Add Printer Wizard") Send("!n") WinWaitActive("Add Printer Wizard") Send("{ENTER}");this line completes the add a printer wizard ;Resent Printer Propeties to Point to Z Run("control printers") ;launches printer control panel WinWaitActive("Printers and Faxes") Send("a") Send("{ENTER}") WinWaitActive("Accounting") Send("!p") Send("r") WinWaitActive("Accounting") Send("{SHIFTDOWN}") Send("{TAB}") Send("{SHIFTUP}") Send("{RIGHT}") Send("{RIGHT}") Send("{RIGHT}") Send("{TAB}") Send("{TAB}") Send("{TAB}") Send("Z");selects first printer to start with "Z" Send("{ENTER}") Link to comment Share on other sites More sharing options...
dabus Posted December 17, 2007 Share Posted December 17, 2007 Put Opt("SendKeyDelay", 100) ;100 milliseconds On top of your script and test with more or less delay. Link to comment Share on other sites More sharing options...
lyonrt Posted December 17, 2007 Author Share Posted December 17, 2007 Thanks for the headway. I put in your suggestion and it seemed to run better. However, I heard a beep this time around on the window right before accounting is typed in. I think it is hesitating and then finally catching up to click on next. I tried using !n and I also used ENTER. They both work, but it still wants to beep a couple of times before going to the next page to type in Accounting. Any suggestions? Link to comment Share on other sites More sharing options...
dabus Posted December 17, 2007 Share Posted December 17, 2007 (edited) WinWaitActive("Add Printer Wizard", "put a text that's only in the window you are waiting for, since now you are waiting for a window that already exists") Edited December 17, 2007 by dabus Link to comment Share on other sites More sharing options...
lyonrt Posted December 17, 2007 Author Share Posted December 17, 2007 Im getting some good headway. Now the second part of the script. It seems like its not wanting to tab. What could I be doing wrong? inWaitActive("Accounting") Send("!p") Send("r") WinWaitActive("Accounting Properites") Send("{TAB}") Send("{TAB}") Send("{TAB}") Send("{TAB}") Send("{TAB}") Send("{TAB}") Send("{TAB}") Send("{TAB}") Send("{TAB}") Send("{TAB}") Send("{RIGHT}") Send("{RIGHT}") Send("{RIGHT}") Send("{TAB}") Send("{TAB}") Send("{TAB}") Send("Z");selects first printer to start with "Z" Send("{ENTER}") Link to comment Share on other sites More sharing options...
lyonrt Posted December 17, 2007 Author Share Posted December 17, 2007 The windows is in focus if that helps. Link to comment Share on other sites More sharing options...
dabus Posted December 17, 2007 Share Posted December 17, 2007 (edited) Err, I can't confirm it now but is there really a window with the name "Accounting Properites" ? I think you misspelled it. I would also advise you to shorten you script by using: Send('{Tab 10}{Right 3}{Tab 3}{z}{Enter}')oÝ÷ Ø Ý~º&¶¡zZ_WzwjºS®¢ÓZ¾(µëhìmrí®[ºÛhÈ^rFèÅëIéݪê-ù0ªê-5«â«^¶kzø¨ºÇ(Úè'§v«¨µ0ªê-5«â«^¶ÞÆÕ¢Ú0M¦è¤Úm·v&¥¢"Ú0Iéݪê-ù0ªê-5«â«^¶kzø¨ºÅ¢Ú0M¦ÒzwjºR instead of 10 normal keypresses. I also wonder if you want to click something. Be aware that sending is not recommanded. Have a look at the Controls-section if you want your work to be more advanced after you finished some easy scripts. Edited December 17, 2007 by dabus Link to comment Share on other sites More sharing options...
Nevin Posted December 17, 2007 Share Posted December 17, 2007 (edited) In case you didn't know what he meant by Controls-section, he meant check out the ControlSend* function. It will send the command to a particular window, even if it is out of focus. *There are also other Control commands that you should check out. Edited December 17, 2007 by Nevin 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