Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Trigger a script depending on time?
#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


Messages In This Thread
Trigger a script depending on time? - by PNGer - 09-14-2017, 11:33 AM
RE: Trigger a script depending on time? - by Ofnuts - 09-14-2017, 01:07 PM

Forum Jump: