Sign in to follow this  
Followers 0
marcoroc

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

12 posts in this topic

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.
 

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

This part >> winwaitactive("Blocco note") << check the title is correct using Window Info tool and also be sure to add the text. See if that fixes it.

Edited by czardas

Share this post


Link to post
Share on other sites

Try This ...

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

..... To Be The Best You Have To Beat The Best .....

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

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.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

marcoroc,

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

M23

3 people like this

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

marcoroc,

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

M23

ahahahahahah

i'm a fucking dumbass.

 

Thanks everybody, problem solved.

Edited by marcoroc
1 person likes this

Share this post


Link to post
Share on other sites

marcoroc,

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

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

No one's perfect! :)

I did something silly like that once (well probably more than once but no picture evidence)

cmdmania.jpg

1 person likes this

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

LOL It had to be something in the name. Melba must have seen this before. I would never have guessed it would be that though.

Edited by czardas

Share this post


Link to post
Share on other sites

czardas,

 

Melba must have seen this before

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

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
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
Sign in to follow this  
Followers 0