aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2012-04-10 19:27:20 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2012-04-10 19:27:20 +0000
commit7bb6d2a4726e67fd3ad1f2892f58751c6aa0868f (patch)
treebb6aae1d6cff09c6e45a1bfa821c58268f85a332 /scripts
parent2ad1ad00d8164add624718c6c576680ec4b61aa6 (diff)
made script to move a patch's position on the screen, useful for standardizing help patch locations
svn path=/trunk/; revision=16117
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/move-patch-to-xy23
1 files changed, 23 insertions, 0 deletions
diff --git a/scripts/move-patch-to-xy b/scripts/move-patch-to-xy
new file mode 100755
index 00000000..79e71367
--- /dev/null
+++ b/scripts/move-patch-to-xy
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+if [ $# -eq 1 ]; then
+ patch="$1"
+ newx=`expr $RANDOM % 200 + 100`
+ newy=`expr $RANDOM % 100 + 50`
+elif [ $# -eq 3 ]; then
+ patch="$1"
+ newx=$2
+ newy=$3
+else
+ echo "Move a patch to a given (x,y) location on the screen"
+ echo "Usage: $0 patch [x] [y]"
+ exit
+fi
+
+firstline=`head -1 "$patch"`
+x=`echo $firstline | sed 's|^#N canvas \([0-9][0-9]*\) [0-9 ;-]*$|\1|'`
+y=`echo $firstline | sed 's|^#N canvas [0-9][0-9]* \([0-9][0-9]*\) [0-9 ;-]*$|\1|'`
+
+replaceline=`echo $firstline | sed "s|canvas $x $y|canvas $newx $newy|"`
+echo replace first line with: $replaceline
+sed -i "s|$firstline|$replaceline|" $patch