Jump to content

Noob script brings to high CPU usage and large increasing in processes number.


Go to solution Solved by Melba23,

Recommended Posts

Please forgive my poor english (and noob question).

INTRODUCTION
I'm completely untrained in scripting, and i'm following a guide trying to learn something about autoit.

TROUBLES
During an exercise i wrote down the script below.

run("notepad.exe")
winwaitactive("Senza nome - Blocco note");("senza nome - blocco note" is the italian version of "untitled - notepad", yea we use "nameless" instead of "untitled" don't know why).

send("some text here")
winclose("Senza nome - Blocco note")
winwaitactive("Blocco note")
sleep(3000)
send("!N")

As i said, the result is an overwhelming cpu usage (and processes overcrowding (notepad.exe ofc)) that  force me to reboot my pc.

I tryed removing the "sleep(3000)" line, but it didn't improve my result.

All i described happens only on the "compiled script" (script.exe) and not on the .au3 file.
 

Link to comment
Share on other sites

I tryed removing all the lines, one at time, starting from the last one.

    run("notepad.exe")
    winwaitactive("Senza nome - Blocco note")


If i leave only these lines (1st and 2nd), running the script gives me back the same error. (CPU usage over 95% and over 150-200-300... (and so on) processes in the task manager.

With the first line left only

    run("notepad.exe")


I still have the CPU usage "error", but the number of processes remains constant.

Conclusion
Running notepad mess my pc. :thumbsup:

 

 

Try This ...

Run(@WindowsDir & "\Notepad.exe", "")
    WinWaitActive("[CLASS:Notepad]")
    send("some text here")
    sleep(3000)
    send("!N")
 WinClose("[CLASS:Notepad]")

you have to Switch "send("!N")" with the last line, but it works fine.

 

I would like to know why :blink:

Edited by marcoroc
Link to comment
Share on other sites

  • Moderators

What OS are you running? Which version of AutoIt? What process is eating up the CPU in Task Manager? 

I have tried your two lines of code on both XP and WIN7, both 32 and 64bit, and cannot reproduce your CPU issues. It seems to be something local to your machine.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

  • Moderators
  • Solution

marcoroc,

When you compile the file, are you calling it "Notepad.exe" by any chance? ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

marcoroc,

You are not the first - and I am sure you will not be the last either! :D

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

czardas,

 

Melba must have seen this before

Quite a few times - and it is nearly always a Notepad script that is involved. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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