Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Trigger a script depending on time?
#1
Hi all,
I want to write a Python script that performs a set of GIMP procedures depending on the time elapsed after starting GIMP and was wondering if this kind of script is possible. Thanks in advance.
Reply
#2
(09-14-2017, 11:33 AM)PNGer Wrote: Hi all,
I want to write a Python script that performs a set of GIMP procedures depending on the time elapsed after starting GIMP and was wondering if this kind of script is possible. Thanks in advance.

The best you can do is call Gimp with  a special parameter:

For instance: this script periodically reports the number of opened images:

Code:
#!/usr/bin/python
# -*- coding: iso-8859-15 -*-

import os,glob,sys,time
from gimpfu import *


def run():
    print 'Loaded, starting wait loop'
    while True:
    time.sleep(10)
    print "Total images:",len(gimp.image_list())

if __name__ == "__main__":
    print "Running as __main__ with args: %s" % sys.argv

Then you start Gimp as (assuming it is in a file named "wait.py"):

Linux/OSX version:

Code:
gimp --batch-interpreter python-fu-eval -b 'import sys; sys.path=["."]+sys.path;import wait;wait.run()'

Windows version:

Code:
gimp --batch-interpreter python-fu-eval -b "import sys; sys.path=['.']+sys.path;import wait;wait.run()"
Reply


Forum Jump: