0

I am trying to build a script to automate a VERY time-consuming (and boring) process, here it is:

I have to convert A LOT of files (3000 more or less) from a format to another with a specific program and sadly it looks there is no option to convert them all at once or take some shortcut. Then again while iterating through the process I noticed that there is a sequence of keys that could be pressed to do this process "mouse free" except opening the files but I guess I can get around it somehow.

Now, my aim is to build a python script which could do this by iterating the key sequence:

Step 1) open the file with its appropriate program (a 3d modelling program).

Step 2) alt + f then e, then tab, tab, tab, e, and similar

Step 3) close the file, open another file and back to step 1 (after some minor security checks)

is there a module I can use or some built in commands that I could use?

I am using Python 3.4 on windows and the only module I found (and know a little about) is SendKeys but it is available for Python 2 only! Is there a Python 3 option and/or a better way around it?

TigerhawkT3
  • 48,464
  • 6
  • 60
  • 97
mickkk
  • 1,172
  • 2
  • 17
  • 38
  • Why not just use AutoHotkey or something? – TigerhawkT3 Jun 04 '15 at 22:56
  • I skimmed through the documentation, this seems a good option however I am wondering whether it allows to iterate the sequence over many folders. Making some checking point such as "if the file has been converted then.." should not be a problem since it allows if statements – mickkk Jun 05 '15 at 06:56
  • @TigerhawkT3 can AutoHotkey simulate mouse clicks too? For the iteration part I guess I could call the same AutoHotkey script over and over using python – mickkk Jun 05 '15 at 07:59
  • AHK is great at simulating mouse clicks. It's basically a full language whose built-in types and functions are directed at automation. – TigerhawkT3 Jun 05 '15 at 08:52
  • @TigerhawkT3 I think I'll definitely give it a try, one more question though.. Do you know whether mouse clicks in AHK can be arbitrary on the entire screen (say, for instance, selecting areas of a picture) or are they limited to physical buttons and similar? – mickkk Jun 05 '15 at 11:13
  • Indeed there is! Ok let me try it – mickkk Jun 05 '15 at 13:06
  • Possible duplicate of [Which is the easiest way to simulate keyboard and mouse on Python?](https://stackoverflow.com/questions/2791839/which-is-the-easiest-way-to-simulate-keyboard-and-mouse-on-python) – kenorb Jan 07 '18 at 14:53

1 Answers1

0

This should answer your question, it only uses ctypes which is both in py 2.7 as well as py 3.4.

https://stackoverflow.com/a/11910555/4975656

Community
  • 1
  • 1
Endzior
  • 164
  • 9