Sign in to follow this  
Followers 0
jimollerhead

More WinMenuSelectItem grief

5 posts in this topic

I am trying to do a search and replace in notepad using this and nothing happens!

My command is:

WinMenuSelectItem("PVCS_insert.sql", "", "&Edit", "&Replace")

where PVCS_insert.sql is my file name and at the beginning of my window title. I have tried replacing the underscore with {SHIFTDOWN}-{SHIFTUP} but that makes no difference -- it just does nowt. I also originally had the window name as "PVCS_insert.sql - Notepad" but that made no difference either.

I have also tried WinActivate("PVCS_insert.sql") before the line but that doies nothing either.

Has ANYONE out there managed to get this damned function to work???

Regards,

(a soon to be hairless) Jim

Share this post


Link to post
Share on other sites



try...

WinMenuSelectItem("PVCS_insert.sql", "", "&Edit", "&Replace... Ctrl+H")

where the space between &Replace... and Ctrl+H is a TAB

LAr.

Nope still no soap.... I have even tried copying and pasting your example from the help file (see below) and that doesn't work either.....

WinMenuSelectItem("Untitled - ", "", "&File", "Page Set&up... Ctrl+H" )

I will try it at home in case there is something odd about my work PC....

Thanks for the quick response,

Jim.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

OK Lar, after lots of grief and testing I can now get it to work consistently...

The original problem was that "Notepad" was missing from the window title... then it began to work intermittently, sometimes yes, sometimes no... then I added a WinWait command as in the below:

RunWait("Notepad.exe")

WinWait("Untitled - Notepad")

WinMenuSelectItem("Untitled - Notepad", "", "&File", "Page Set&up...")

This seems to work every time.... HOWEVER, as soon as I add a file name to the RunWait command like so:

RunWait("Notepad.exe test.txt")

WinWait("test.txt - Notepad")

WinMenuSelectItem("test.txt - Notepad", "", "&File", "Page Set&up...")

...it stops working again. I am going to try WinMenuSelectItem with &File, &Open to see if it will work that way -- I'll let you know.

BTW the test.txt file is a tiny text file containing the words "test test test"

I won't let the bugger beat me!!

Regards,

Jim.

Edited by jimollerhead

Share this post


Link to post
Share on other sites

Ah ha!!

Changing the WinWait to WinWaitActive seems to work!!

Share this post


Link to post
Share on other sites

Also I think it isn't a good idea to have underscores in the filename so I changed it to a hyphen

Jim.

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