nilshero Posted August 14, 2007 Share Posted August 14, 2007 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 Link to comment Share on other sites More sharing options...
boogieoompa Posted August 14, 2007 Share Posted August 14, 2007 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? Link to comment Share on other sites More sharing options...
herewasplato Posted August 14, 2007 Share Posted August 14, 2007 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] Link to comment Share on other sites More sharing options...
nilshero Posted August 14, 2007 Author Share Posted August 14, 2007 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 Link to comment Share on other sites More sharing options...
herewasplato Posted August 14, 2007 Share Posted August 14, 2007 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] Link to comment Share on other sites More sharing options...
nilshero Posted August 15, 2007 Author Share Posted August 15, 2007 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. Link to comment Share on other sites More sharing options...
herewasplato Posted August 15, 2007 Share Posted August 15, 2007 ...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] Link to comment Share on other sites More sharing options...
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