Using Windows / Win32 API with wine?

Questions about Wine on macOS.
Locked
aggsyb
Newbie
Newbie
Posts: 4
Joined: Fri Oct 21, 2016 10:25 am

Using Windows / Win32 API with wine?

Post by aggsyb »

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.
User avatar
olivierfrdierick
Level 5
Level 5
Posts: 258
Joined: Thu Sep 13, 2012 12:09 pm

Re: Using Windows / Win32 API with wine?

Post by olivierfrdierick »

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.
aggsyb
Newbie
Newbie
Posts: 4
Joined: Fri Oct 21, 2016 10:25 am

Re: Using Windows / Win32 API with wine?

Post by aggsyb »

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.
User avatar
olivierfrdierick
Level 5
Level 5
Posts: 258
Joined: Thu Sep 13, 2012 12:09 pm

Re: Using Windows / Win32 API with wine?

Post by olivierfrdierick »

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
aggsyb
Newbie
Newbie
Posts: 4
Joined: Fri Oct 21, 2016 10:25 am

Re: Using Windows / Win32 API with wine?

Post by aggsyb »

This got eveything working for me, Really appreciate it!
Locked