|
| 1 | +#!/usr/bin/env python |
| 2 | +# |
| 3 | +# runxdotool.py |
| 4 | +# |
| 5 | +# Copyright 2010 esbat <esbat@esbat-laptop> |
| 6 | +# |
| 7 | +# This program is free software; you can redistribute it and/or modify |
| 8 | +# it under the terms of the GNU General Public License as published by |
| 9 | +# the Free Software Foundation; either version 2 of the License, or |
| 10 | +# (at your option) any later version. |
| 11 | +# |
| 12 | +# This program is distributed in the hope that it will be useful, |
| 13 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | +# GNU General Public License for more details. |
| 16 | +# |
| 17 | +# You should have received a copy of the GNU General Public License |
| 18 | +# along with this program; if not, write to the Free Software |
| 19 | +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
| 20 | +# MA 02110-1301, USA. |
| 21 | +import gtk, subprocess, time, string |
| 22 | +def AddCommandToRun(CommandPath): |
| 23 | + print CommandPath |
| 24 | + afile = open(CommandPath) |
| 25 | + ParamsForCommand = afile.read().split("\n") |
| 26 | + for s in ParamsForCommand: |
| 27 | + EachCommand = s.split(" ") |
| 28 | + if EachCommand[0] == 'move': |
| 29 | + subprocess.check_call(["xdotool","mousemove",EachCommand[3],EachCommand[4]]) |
| 30 | + if EachCommand[0] == 'delay': |
| 31 | + time.sleep(string.atof(EachCommand[1])) |
| 32 | + if EachCommand[0] == 'click': |
| 33 | + if EachCommand[2] == 'left': |
| 34 | + for i in EachCommand[5]: |
| 35 | + subprocess.check_call(["xdotool","click","1"]) |
| 36 | + time.sleep(string.atof(EachCommand[9])) |
| 37 | + if EachCommand[2] == 'middle': |
| 38 | + for i in EachCommand[5]: |
| 39 | + subprocess.check_call(["xdotool","click","2"]) |
| 40 | + time.sleep(string.atof(EachCommand[9])) |
| 41 | + if EachCommand[2] == 'right': |
| 42 | + for i in EachCommand[5]: |
| 43 | + subprocess.check_call(["xdotool","click","3"]) |
| 44 | + time.sleep(string.atof(EachCommand[9])) |
| 45 | + if EachCommand[0] == 'type': |
| 46 | + for i in EachCommand[5]: |
| 47 | + subprocess.check_call(["xdotool","key",EachCommand[3]]) |
| 48 | + time.sleep(string.atof(EachCommand[9])) |
| 49 | + return 0 |
| 50 | + |
| 51 | + |
| 52 | +def main(): |
| 53 | + |
| 54 | + return 0 |
| 55 | + |
| 56 | +if __name__ == '__main__': main() |
0 commit comments