Python

Moderators: None (Apply to moderate this forum)
Number of threads: 474
Number of posts: 1166

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
File menu Posted by Bumbler on 20 Jul 2006 at 8:04 AM
How would I programmatically use the file menus at the top of a program? The menus like File, Edit, View, etc. I need to open the File menu.
Report
Re: File menu Posted by infidel on 20 Jul 2006 at 8:48 AM
: How would I programmatically use the file menus at the top of a program? The menus like File, Edit, View, etc. I need to open the File menu.

Do you mean you want a python script to control another program by selecting it's menus? Look up "pywinauto" in Google.

Or do you mean you have a GUI program written in Python (TKinter, wxPython, etc) and you want to make the menu display automatically?


infidel

$ select * from users where clue > 0
no rows returned


Report
Re: File menu Posted by Bumbler on 20 Jul 2006 at 9:22 AM
: : How would I programmatically use the file menus at the top of a program? The menus like File, Edit, View, etc. I need to open the File menu.
:
: Do you mean you want a python script to control another program by selecting it's menus? Look up "pywinauto" in Google.
:
: Or do you mean you have a GUI program written in Python (TKinter, wxPython, etc) and you want to make the menu display automatically?
:
:
: infidel
:
:
: $ select * from users where clue > 0
: no rows returned
: 

:
:
ok, sorry for the dumb question you already answered in my other posting. I can get to there, but I don't know what the program is called by Python so I can do the app.'program'.MenuSelect, do you know a way to find the name? I've already tried all the obvious ones.

Report
Re: File menu Posted by infidel on 21 Jul 2006 at 8:57 AM
: ok, sorry for the dumb question you already answered in my other posting. I can get to there, but I don't know what the program is called by Python so I can do the app.'program'.MenuSelect, do you know a way to find the name? I've already tried all the obvious ones.

I haven't used it much, but don't you use the caption in the title bar of the application as the name?


infidel

$ select * from users where clue > 0
no rows returned


Report
Re: File menu Posted by Bumbler on 24 Jul 2006 at 6:38 AM
: : ok, sorry for the dumb question you already answered in my other posting. I can get to there, but I don't know what the program is called by Python so I can do the app.'program'.MenuSelect, do you know a way to find the name? I've already tried all the obvious ones.
:
: I haven't used it much, but don't you use the caption in the title bar of the application as the name?
:
:
: infidel
:
:
: $ select * from users where clue > 0
: no rows returned
: 

:
:
No, None of the names on the Title Bar are recognized by Python.
Report
Re: File menu Posted by infidel on 24 Jul 2006 at 7:30 AM
: No, None of the names on the Title Bar are recognized by Python.

Can you post some code so I can see what you're trying to do?


infidel

$ select * from users where clue > 0
no rows returned


Report
Re: File menu Posted by Bumbler on 25 Jul 2006 at 7:28 AM
: : No, None of the names on the Title Bar are recognized by Python.
:
: Can you post some code so I can see what you're trying to do?
:
:
: infidel
:
:
: $ select * from users where clue > 0
: no rows returned
: 

:
:
here it is.

import pywinauto.application
app = pywinauto.application.Application()
app.start_('C:\Program Files\AspenTech\Aspen Plus 2004\GUI\Xeq\Tapwn.exe')
app.AspenPlusStartup.RadioButton1.Click()
app.AspenPlusStartup.OK.Click()
This is the line where I would use the menubar that is along the top of the program to run the model I loaded above.
Report
Re: File menu Posted by infidel on 25 Jul 2006 at 8:23 AM
: import pywinauto.application
: app = pywinauto.application.Application()
: app.start_('C:\Program Files\AspenTech\Aspen Plus 2004\GUI\Xeq\Tapwn.exe')
: app.AspenPlusStartup.RadioButton1.Click()
: app.AspenPlusStartup.OK.Click()

And this all works ok?

: This is the line where I would use the menubar that is along the top of the program to run the model I loaded above.

Ok, so what is the exact text of the application's title bar?


infidel

$ select * from users where clue > 0
no rows returned


Report
Re: File menu Posted by Bumbler on 25 Jul 2006 at 10:00 AM
: : import pywinauto.application
: : app = pywinauto.application.Application()
: : app.start_('C:\Program Files\AspenTech\Aspen Plus 2004\GUI\Xeq\Tapwn.exe')
: : app.AspenPlusStartup.RadioButton1.Click()
: : app.AspenPlusStartup.OK.Click()
:
: And this all works ok?
:
: : This is the line where I would use the menubar that is along the top of the program to run the model I loaded above.
:
: Ok, so what is the exact text of the application's title bar?
:
:
: infidel
:
:
: $ select * from users where clue > 0
: no rows returned
: 

:
:
yes, it all works.
The exact text is:

Simulation 1 - Aspen Plus 2004 - aspenONE - [Process Flowsheet Window]
Report
Re: File menu Posted by infidel on 25 Jul 2006 at 11:05 AM
: The exact text is:
:
: Simulation 1 - Aspen Plus 2004 - aspenONE - [Process Flowsheet Window]

I found this FAQ, maybe it will help: http://pywinauto.pbwiki.com/FAQ

Looks like you could maybe do something like:

app['Simulation 1'].MenuSelect('whatever')

Or:

app.top_window_().MenuSelect('whatever')

For the first option, I don't know if you have to have the entire titlebar text or if 'Simulation 1' would be sufficient. Give these a try and see if you get any further.


infidel

$ select * from users where clue > 0
no rows returned


Report
Re: File menu Posted by Bumbler on 26 Jul 2006 at 7:43 AM
: : The exact text is:
: :
: : Simulation 1 - Aspen Plus 2004 - aspenONE - [Process Flowsheet Window]
:
: I found this FAQ, maybe it will help: http://pywinauto.pbwiki.com/FAQ
:
: Looks like you could maybe do something like:
:
: app['Simulation 1'].MenuSelect('whatever')
:
: Or:
:
: app.top_window_().MenuSelect('whatever')
:
: For the first option, I don't know if you have to have the entire titlebar text or if 'Simulation 1' would be sufficient. Give these a try and see if you get any further.
:
:
: infidel
:
:
: $ select * from users where clue > 0
: no rows returned
: 

:
:
Thank you so much for the help. The app.top_window_().MenuSelect() worked. Thanks again.
Report
Re: File menu Posted by digiwox on 6 Dec 2006 at 9:58 PM
I need Aspen Plus 2004 where can I download this software and crack please help me



 

Recent Jobs