Jump to content

How to slow down the typing?


lyonrt
 Share

Recommended Posts

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:

#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

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

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

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 by dabus
Link to comment
Share on other sites

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 by Nevin
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...