manish.aggarwal Posted May 13, 2005 Posted May 13, 2005 Hi, I am new to AutoIT, i have created my first script which is nothing much but just opening a word document and start typing few things.. The problem that i am facing is With CPU load the moment i satrted the script my CPU goes to 100% Can anyone suggest me what could be the problem many Thanks in Advance Manish
Andre Posted May 13, 2005 Posted May 13, 2005 hi, please post your source..... without it it's hard to see whats wrong. Andre What about Windows without using AutoIt ?It would be the same as driving a car without an steering Wheel!
manish.aggarwal Posted May 13, 2005 Author Posted May 13, 2005 hi,please post your source.....without it it's hard to see whats wrong.Andre<{POST_SNAPBACK}>Hi Andre,Thx for replying very soon.. please find the code mentioned belowrun("c:\Program Files\Microsoft Office\Office\WINWORD.EXE")WinWaitActive("Document1 - Microsoft Word")send("TEST DOCUMENT")send("{ENTER}")For $a = 5 to 1 Step -1send("The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog")send("{ENTER}")NextWinClose("Document1 - Microsoft Word")WinWaitActive("Microsoft Word")send("!n")
440LVB Posted May 13, 2005 Posted May 13, 2005 Should put the code into '['code']' you code there '['/code']' without the ' It's easier to read
manish.aggarwal Posted May 13, 2005 Author Posted May 13, 2005 Should put the code into '['code']' you code there '['/code']' without the 'It's easier to read<{POST_SNAPBACK}>For $a = 5 to 1 Step -1 send("The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog") send("{ENTER}") Next WinClose("Document1 - Microsoft Word") WinWaitActive("Microsoft Word") send("!n")
buzz44 Posted May 13, 2005 Posted May 13, 2005 (edited) Pretty sure its because your sending so much text at the same time in one go, copy it to the clip board and then paste it. I also added a little Sleep() and changed the Run function so you can open up your word document faster and easier. I got rid of the WinWait stuff cause I don't know what the title would be lol, so you should add that back in. Run('C:\Program Files\Microsoft Office\Office\WINWORD.EXE "TEST document.doc"') Sleep(5000) ClipPut("The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog") For $A = 5 to 1 Step - 1 Send("^v"); Not sure if this would work >> Send(ClipGet()) Send("{ENTER}") Sleep(10) Next send("!N") Edited May 13, 2005 by Burrup qq
GaryFrost Posted May 13, 2005 Posted May 13, 2005 Still cpu hog because of what's being sent, might want to play with the option I tried this at the top dropped cpu usage down to less than half Opt("SendKeyDelay",10) default is 5 ms SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
manish.aggarwal Posted May 13, 2005 Author Posted May 13, 2005 I need to create a script which will generate some keystroke so copy paste will not work.. what else can i do for reducing the cpu load
herewasplato Posted May 13, 2005 Posted May 13, 2005 I need to create a script which will generate some keystroke so copy paste will not work.. what else can i do for reducing the cpu load<{POST_SNAPBACK}>gafrost gave you your answer on how to modify your original script to reduce the CPU load... but per your request, here is a script that will "generate some keystroke" and does not use much CPU time.AutoItSetOption ("SendKeyDelay", 20) AutoItSetOption ("WinTitleMatchMode", 2) AutoItSetOption ("TrayIconDebug", 1) HotKeySet ("{PAUSE}", "Terminate") Run("notepad.exe") WinWait("Notepad") WinActivate("Notepad") WinWaitActive("Notepad") For $i = 1 to 5 For $ii = 1 to 10 Send("The quick brown fox jumps over the lazy dog. ") Next Send("{ENTER}") Next EXIT Func Terminate() EXIT EndFuncIf you want to use MS Word - then change the "Run line" and the subsequent "Win... lines" of code.The reason for shortening this linesend("The quick brown fox jumps over the lazy dog. ")is to allow for quick termination of the script. Hitting pause will not exit the script until the "Send line" has completed. The same is true of attempting to exit the script via the system tray icon.What is this script for? [size="1"][font="Arial"].[u].[/u][/font][/size]
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