Sign in to follow this  
Followers 0
nilshero

calling Menu-Items in Notepad

7 posts in this topic

I do not get this ... (i tried it in english and german):

;works
Run("notepad.exe "& @ScriptDir & "\document.txt")

;works not - i get 0
Dim $x = WinMenuSelectItem ( "document.txt - Notepad", "", "&File")
MsgBox(0, "AutoIt", $x)

What do i do wrong?

Greetings, Nils

Share this post


Link to post
Share on other sites



MenuSelecectItem initiates a menu item. It only returns a 1. What are you trying to accomplish, there is always more than 1 way to skin a cat. Basically what did you want your message box to say?

Share this post


Link to post
Share on other sites

Welcome to the forum.

try this:

Run("notepad")
WinWaitActive("Untitled")
$x = WinMenuSelectItem("Untitled - ", "", "&File", "Page Set&up...")
MsgBox(0, "AutoIt", $x)
You need to have the script wait for notepad to showup - hence the WinWaitActive line.

[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

Hello :-)

MenuSelecectItem initiates a menu item. It only returns a 1.

0 or 1 afaik and i get 0. im trying to open html/-php...files in notepad and then save them as utf-8.

try this:

Run("notepad")
WinWaitActive("Untitled")
$x = WinMenuSelectItem("Untitled - ", "", "&File", "Page Set&up...")
MsgBox(0, "AutoIt", $x)
sorry, i get still 0 ... any other idea?

Greetings, Nils

Share this post


Link to post
Share on other sites

Does the Page Setup screen appear when you run this code?

Run("notepad")
WinWaitActive("Untitled")
Sleep(1000)
$x = WinMenuSelectItem("Untitled - ", "", "&File", "Page Set&up...")
MsgBox(0, "AutoIt", $x)

What operating system are you running this code on?


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

Does the Page Setup screen appear when you run this code? (...)

It worked :-)

i misunderstood "optional" in the

Tutorial

so i removed the "Page Set&up..." in your Example when i translated it into german version ... with it works.

(code in german:)

Run("notepad "& @ScriptDir & "\textdokument.txt")
WinWaitActive ( "textdokument.txt - Editor")
Dim $x=WinMenuSelectItem ( "textdokument.txt - Editor", "", "&Datei", "Speichern &unter...")
;WinMenuSelectItem("Untitled - ", "", "&File", "Page Set&up..." )
MsgBox(0, "AutoIt", $x)

very nice. Thanks a lot.

Share this post


Link to post
Share on other sites

...Thanks a lot.

Anytime.

You might also find this forum of interest:

http://www.autoit.de/index.php?sid=

-MSP-


[size="1"][font="Arial"].[u].[/u][/font][/size]

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