Hi,
I do a fair amount of GUI scripting in windows applications with python using the win32API to get text, click buttons of an application etc. Is it possible to use these with a wine application? if so any example python code would be greatly appreciated.
Cheers.
Using Windows / Win32 API with wine?
- olivierfrdierick
- Level 5
- Posts: 258
- Joined: Thu Sep 13, 2012 12:09 pm
Re: Using Windows / Win32 API with wine?
Hello,
If you can run your python script with a command in Windows, then there is no reason you wouldn't be able to run that command from within Wine. The only limitation is that a windows application can only see other windows application in the same wine instance. So you have to run your python scripting engine in the same prefix as the windows application you want to control. Scripts running outside of Wine (from the OS environment) will not have access to the win32api nor will they be able to see windows applications within Wine.
There is nothing to change in your python code. Running applications from Wine or Windows should be transparent to the windows application.
If you can run your python script with a command in Windows, then there is no reason you wouldn't be able to run that command from within Wine. The only limitation is that a windows application can only see other windows application in the same wine instance. So you have to run your python scripting engine in the same prefix as the windows application you want to control. Scripts running outside of Wine (from the OS environment) will not have access to the win32api nor will they be able to see windows applications within Wine.
There is nothing to change in your python code. Running applications from Wine or Windows should be transparent to the windows application.
Re: Using Windows / Win32 API with wine?
Excellent, my next question is... how do I install python with wine? The application I am using to script the GUI on is already built with wine.
I have my script inside its wine prefix folder but I do not know how to install python and the win32 modules to ensure python can "see" the application. Any guides?
Appreciate the help.
I have my script inside its wine prefix folder but I do not know how to install python and the win32 modules to ensure python can "see" the application. Any guides?
Appreciate the help.
- olivierfrdierick
- Level 5
- Posts: 258
- Joined: Thu Sep 13, 2012 12:09 pm
Re: Using Windows / Win32 API with wine?
I tried to install python myself.
You may read the result of my test in the AppDB [1].
The easiest way to install is by using wine-staging.
Otherwise you'll have to compile a patched version of Wine.
With wine-staging or a patched Wine, you may simply run the python exe installer from inside the wineprefix and it should install.
There is a glitch with the installer that display a blank text when it asks the user how to install. Blindly clicking in the blank text allows for selecting one of the install methods.
[1] : https://appdb.winehq.org/objectManager. ... &iId=34399
You may read the result of my test in the AppDB [1].
The easiest way to install is by using wine-staging.
Otherwise you'll have to compile a patched version of Wine.
With wine-staging or a patched Wine, you may simply run the python exe installer from inside the wineprefix and it should install.
There is a glitch with the installer that display a blank text when it asks the user how to install. Blindly clicking in the blank text allows for selecting one of the install methods.
[1] : https://appdb.winehq.org/objectManager. ... &iId=34399
Re: Using Windows / Win32 API with wine?
This got eveything working for me, Really appreciate it!