Jump to content

Simple Notepad Automation not working


Recommended Posts

So I am starting with AutoIt. I downloaded and installed the latest, and started doing the tutorials.

However, the notepad one is not completely working. It does open notepad and insert the text, and sends the close command. The do you want to save pops up, and then nothing else happens.

Using the AutoItSetOption ("TrayIconDebug", 1); shows that it is at this line of the tutorial:

WinWaitActive("Notepad", "Do you want to save")

And it gets stuck there.

I'm running Vista 64.

post-64131-0-46123100-1302111152_thumb.j

Link to comment
Share on other sites

  • Moderators

El3ctroded,

Welcome to the AutoIt forum. :)

I am afraid MS have changed the name of the "Do you want to save?" dialog since the tutorial was written. :P

Change the line to:

WinWaitActive("Notepad")

and all should work. :)

The Help file change is already noted for the next release. :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

Bruce, that did not work. I noticed you missed the "?" at the end; I added that to it and it still did not work.

M23, that worked, thanks. However I'm confused...

From looking at the WinZip tutorial, I thought the text in dialog only had to Contain the text used in the AutoIt command; see this piece of code from the WinZip tutorial:

WinWaitActive("WinZip Setup", "into the following folder")

So why is the following also not working for the notepad dialog?

WinWaitActive("Notepad", "want to save")

Thanks

El3ctroded

Link to comment
Share on other sites

Odd, I used the AutoIt Window Info tool and it doesn't see the text... Here's the summary of the window info:

>>>> Window <<<<
Title:  Notepad
Class:  #32770
Position:   449, 288
Size:   366, 138
Style:  0x96C80284
ExStyle:    0x00010101
Handle: 0x0000000000170D02

>>>> Control <<<<
Class:  DirectUIHWND
Instance:   1
ClassnameNN:    DirectUIHWND1
Name:   
Advanced (Class):   [CLASS:DirectUIHWND; INSTANCE:1]
ID: 
Text:   
Position:   0, 0
Size:   350, 102
ControlClick Coords:    205, 31
Style:  0x56000000
ExStyle:    0x00000000
Handle: 0x0000000000430B30

>>>> Mouse <<<<
Position:   662, 347
Cursor ID:  0
Color:  0xFFFFFF

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<
&Save
Do&n't Save
Cancel


>>>> Hidden Text <<<<
Edited by El3ctroded
Link to comment
Share on other sites

  • Moderators

El3ctroded,

The "visible text":

&Save
Do&n't Save
Cancel

actually refer to to the button texts - not that of the window itself. That is why my suggestion works and the other one did not. :)

The "Title" and "Text" parameters are very sensitive - they must be or they would not do their jobs - so you have to be careful that you use the correct values. :)

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