I'm working with QGIS 2.8 and windows 10. Is it possible that after open QGIS using the schedule tasks from windows 10, I could open the python console and run a script within QGIS programmatically. How can I automate the following actions after open the QGIS:
- open python console
- open a script
- run a script
I've tried the two ways to open the python console, as suggested by Germán in this post "How to show Python console at QGIS program start" and it works. The problem occurs when I want to run my script. I tried to add my code these code lines as you suggest to define a
startup.py file in my directory (
C:\Users\USER\.qgis2\python), but as soon as I open QGIS I get this error:
"Traceback (most recent call last): File "", line 1, in File "C:/PROGRA~1/QGISWI~1/apps/qgis-ltr/./python\qgis\utils.py", line 478, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:/PROGRA~1/QGISWI~1/apps/qgis-ltr/./python\qgis\user.py", line 38, in execfile(startuppy, locals(), globals()) File "C:/Users/USER/.qgis2//python\startup.py", line 17, in layers =iface.legendInterface().layers() NameError: name 'iface' is not defined"