This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
user:bh011695:start:automated_drawing [2010/02/19 05:32] – bh011695 | user:bh011695:start:automated_drawing [2010/03/09 21:23] (current) – bh011695 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | <file bash autodraw2.sh> | ||
+ | # | ||
+ | # | ||
+ | pkill xpaint | ||
+ | #Moves the mouse cursor to the top left corner. This will make Xpaint open here. | ||
+ | xwit -root -warp 1 1 | ||
+ | #Grabs desktop dimensions | ||
+ | desktopHeight=`xwininfo -root | grep ' | ||
+ | desktopWidth=`xwininfo -root | grep ' | ||
+ | #Dimensions of the XPaint Window. These never change | ||
+ | XPAINT_WIDTH=124 | ||
+ | XPAINT_HEIGHT=406 | ||
+ | #These dimensions are used to get the canvas to snap to the xpaint window and also fill the screen. | ||
+ | canvasWidth=$(($desktopWidth-$XPAINT_WIDTH-10)) | ||
+ | #Open XPaint in the background desired size | ||
+ | xpaint -popped -size ${canvasWidth}x${desktopHeight} & | ||
+ | sleep 3s | ||
+ | #Grabs the XPaint widget Window ID | ||
+ | xpaintWinID=`xwit -print -all | grep ' | ||
+ | #Grabs the canvas Window ID | ||
+ | canvasWinID=`xwit -print -all | grep ' | ||
+ | desktopSize=`xwininfo -root | grep ' | ||
+ | #This is where I want the canvas Window to move to | ||
+ | canvasXPosition=$(($XPAINT_WIDTH+1)) | ||
+ | canvasYPosition=1 | ||
+ | #Snaps Xpaint Widget to the edge of the screen | ||
+ | xwit -id $xpaintWinID -move 1 1 | ||
+ | #Moves the canvas window so that it snaps to the XPaint window | ||
+ | xwit -id $canvasWinID -move 125 1 | ||
+ | sleep 0.5 | ||
+ | xte ' | ||
+ | #sleep 3s | ||
+ | #These are the first drawable pixels on the canvas | ||
+ | x=132 | ||
+ | y=86 | ||
+ | #Draws a series of diamonds on the canvas | ||
+ | xwit -root -warp $x $y | ||
+ | while [ $y -lt $(($desktopHeight-25)) ]; do | ||
+ | while [ $x -lt $(($canvasWidth-25)) ]; do | ||
+ | xte ' | ||
+ | let x=$x+100 | ||
+ | let y=$y+100 | ||
+ | xwit -root -warp $x $y | ||
+ | let x=$x+100 | ||
+ | let y=$y-100 | ||
+ | xwit -root -warp $x $y | ||
+ | xte ' | ||
+ | done | ||
+ | let y=$y+200 | ||
+ | xwit -root -warp $x $y | ||
+ | while [ $x -gt $canvasXPosition ]; do | ||
+ | xte ' | ||
+ | let x=$x-100 | ||
+ | let y=$y-100 | ||
+ | xwit -root -warp $x $y | ||
+ | let x=$x-100 | ||
+ | let y=$y+100 | ||
+ | xwit -root -warp $x $y | ||
+ | xte ' | ||
+ | done | ||
+ | xwit -root -warp $x $y | ||
+ | done | ||
+ | #Selects the fill tool | ||
+ | FILL_X=63 | ||
+ | FILL_Y=420 | ||
+ | xwit -root -warp $FILL_X $FILL_Y | ||
+ | xte ' | ||
+ | sleep 3s; xte ' | ||
+ | #Selects colors and fills the diamonds row by row. It starts with grey and move | ||
+ | #one color to the right row by row. | ||
+ | function fill_function { | ||
+ | colorX=190 #These are the start X and Y for changing color | ||
+ | colorY=65 | ||
+ | xwit -root -warp $colorX $colorY | ||
+ | xte ' | ||
+ | sleep 3s; xte ' | ||
+ | x=150 | ||
+ | y=200 | ||
+ | while [ $y -lt $(($desktopHeight-24)) ]; do | ||
+ | while [ $x -lt $(($canvasWidth-24)) ]; do | ||
+ | xwit -root -warp $x $y | ||
+ | xte ' | ||
+ | sleep 0.5s; xte ' | ||
+ | let x=$x+200 | ||
+ | done | ||
+ | let colorX=$colorX+10 | ||
+ | xwit -root -warp $colorX $colorY | ||
+ | xte ' | ||
+ | sleep 3s; xte ' | ||
+ | let x=$x-100 | ||
+ | let y=$y+100 | ||
+ | xwit -root -warp $x $y | ||
+ | while [ $x -gt $canvasXPosition ]; do | ||
+ | xte ' | ||
+ | sleep 0.5s; xte ' | ||
+ | let x=$x-200 | ||
+ | xwit -root -warp $x $y | ||
+ | done | ||
+ | let colorX=$colorX+10 | ||
+ | xwit -root -warp $colorX $colorY | ||
+ | xte ' | ||
+ | sleep 3s; xte ' | ||
+ | let x=$x+100 | ||
+ | let y=$y+100 | ||
+ | done | ||
+ | } | ||
+ | fill_function | ||
+ | </ |