Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to use python console in QGIS to automate tasks. Is there something like a macro recorder in MS Office to get the python commands?

share|improve this question
As an experienced Mapbasic programmer I find it essential to have the mapbasic immediate window recording actions and writing out the mapbasic script as part of the process of creating a compiled mabasic program. Having similar functionality in QGIS would be really useful to allow non specialist programmers to record their actions. I would support such functionality being developed. I am just beginning to try out QGIS after 15 years using mapinfo and find this one of the main missing elements. – user23045 Oct 18 '13 at 8:12
Welcome to gis.stackexchange! Unfortunately, your post does not provide an answer to the question. The answer section should only be used to answer questions. If you want to leave a comment, you will be able to do so after you have collected a few reputation points. – underdark Oct 18 '13 at 8:49

Unfortunately, there isn't something like that for now. The closest I could think of is this ticket from the QGIS issue tracker regarding Macro Recording.

The general idea is that QGIS would send the the Python code for each action (or just the more common ones) that it preforms. Code could be sent to file or console so that people could copy and paste it into a script and run it later. Of course you wouldn't do this all the time only when a certain trigger is set in the Python console or a config screen.

For example, say the user opens a table from a PostGIS database and sets its style to fill solid red. QGIS would output the needed Python code to open the table, add it to the map canvas and change its color.

MapInfo? does this with MapBasic? and I know it was handy for me to learn how to use the MapBasic? APIs when I first started by just watching what it generated.

I'm not sure how hard this would be or even if anyone else thinks it's worth having but could be handy for people to learn the QGIS python API and help with writing scripts.

Twas opened about two years ago but unfortunately, nobody seems to be working on it right now.

share|improve this answer
Ahh yes my first QGIS ticket :) This still comes to my mind from time to time but most of the time I struggle to find a good/scaleable way to handle it. – Nathan W Dec 7 '12 at 1:05

In cases such as this you may find it easier to take your python code outwith the Quantum console and set up an IDE to write and run your code from. This blog post outlines downloading and configuring Aptana Studio for use with pyqgis.

Such a configuration will allow you to save your commands and scripts as python .py files and to run them whenever you need, in addtion to taking advantage of other python features in a better development environment.

share|improve this answer
From what I understand of this question, you're not answering. The user seems to want to be able to register some GUI actions he's doing in QGIS, which actions would be translated in python. QGIS doesn't offer anything like this, you've got to code actions manually. The PyQGIS Cookbook is a good help for that – RobinC Dec 6 '12 at 9:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.