Sign in to follow this  
Followers 0
Rewl

Drawing Tool

15 posts in this topic

#1 ·  Posted (edited)

Introduction

I created this Drawing Tool out of curiosity of learning mouse movements and position lines etc. I think it will be use to someone that doesn't want to spend 10 minutes of their own time to make their own haha. This is my second day ever knowing about Auto-It so I think for only 2 days of experience it's not that bad.

Launches

-v1.0 -- Release

-v1.1 -- Made it so you don't have to press "Enter" to drag, It automaticly draws when you move with the arrow keys

What it does

Have you ever wanted to get that precise drawing on your photoshop, gimp or ever paint? Well what you do is run the script and use the arrow keys to be able to move around or draw a straight line without taking too much time! Press Enter to draw

Bugs

-If you hold down an arrow key and let go, the script will keep on going untill the amount of press's is complete

Source

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.6.1
 Author:         Rewl

 Script Function:
    Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here
#include <IE.au3>
HotKeySet("{LEFT}" , "left")
HotKeySet("{RIGHT}" , "right")
HotKeySet("{DOWN}" , "down")
HotKeySet("{UP}" , "up")
HotKeySet("{ESC}" , "close")


While 1 = 1
    Sleep(1000)
WEnd

Func down()
    $pos = MouseGetPos()
    MouseClick("left" ,$pos[0] , $pos[1] + 1 , 1)
EndFunc

Func right()
    $pos = MouseGetPos()
    MouseClick("left" , $pos[0] + 1 , $pos[1] , 1)
EndFunc
Func left()
    $pos = MouseGetPos()
    MouseClick("left" , $pos[0] - 1 , $pos[1] , 1)
EndFunc

Func up()
    $pos = MouseGetPos()
    MouseClick("left" , $pos[0] , $pos[1] - 1 , 1)
EndFunc

Func close()
    $iE = _IECreate()
    $msg = MsgBox(4 , "Rewl Draw Tool v1.1" , "Thank you for using Rewl's Draw Tool. Visit Auto-It Thread?")
    If $msg = 6 Then
    _IENavigate( $iE , "http://www.autoitscript.com/forum/topic/122139-drawing-tool/#entry847803" )
    Exit
    EndIf
If $msg = 7 Then
Exit
EndIf
EndFunc

Drawer.au3

Edited by Rewl

[size="1"]Programs: Draw Tool | [/size]

Share this post


Link to post
Share on other sites



Erm..What does it draw?


[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Share this post


Link to post
Share on other sites

Erm..What does it draw?

Run the script and go to paint or photoshop etc with a pencil tool than press enter adn use arrow keys to move around, just a small drawing tool.


[size="1"]Programs: Draw Tool | [/size]

Share this post


Link to post
Share on other sites

Run the script and go to paint or photoshop etc with a pencil tool than press enter adn use arrow keys to move around, just a small drawing tool.

Not working!

Maybe need a left mouse button or something?


Share this post


Link to post
Share on other sites

You can change all of your MouseMove( to MouseClick("Left", using search and replace, and it will draw as you move the mouse with the arrow keys.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Johanatcent - I don't see how your getting an error? What are you doing to recieve it?

Edited by Rewl

[size="1"]Programs: Draw Tool | [/size]

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

The script, as written, doesn't draw anything. If you hit ENTER, all you get is a single dot on the screen. You need to change all of the MouseMove to MouseClicks as I described above to get it to draw anything.

Edited by BrewManNH

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

It's suppose to do the dots. In later versions I'll probably add it to draw


[size="1"]Programs: Draw Tool | [/size]

Share this post


Link to post
Share on other sites

It is not my intention to cut your enhousiasm or to discourage you to post examples but ...

What your script is doing: it presses the left mouse click when you press "Enter" ... guess I'll stick to mouse click :(

I'm afraid you'll really need to improve your example :graduated:


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites

It is not my intention to cut your enhousiasm or to discourage you to post examples but ...

What your script is doing: it presses the left mouse click when you press "Enter" ... guess I'll stick to mouse click :(

I'm afraid you'll really need to improve your example :graduated:

I'm going to, i made this yetserday and this is my 3rd day knowing about auto-it so i think it's "ok" for only 2 days of experience about 2 hours a day. The next release is going to draw when ever you press something so no more enter button

[size="1"]Programs: Draw Tool | [/size]

Share this post


Link to post
Share on other sites

Sorry for double post :s

v1.1 released Read releases to know what I fixed and if you want to help, look at bugs!


[size="1"]Programs: Draw Tool | [/size]

Share this post


Link to post
Share on other sites

By replacing your while loop with this you get an interesting twist to the drawing experience:

$i = 0
While 1 = 1
    MouseUp("left")
    Sleep(100)
    MouseDown("left")
    $i = $i + 1
    $s = Round(Sin($i / 5) * 5)
    $c = Round(Cos($i / 5) * 5)
    $m = MouseGetPos()
    MouseMove($m[0] - $s, $m[1] + $c, 0)
    $pos = MouseGetPos()
WEnd

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

By replacing your while loop with this you get an interesting twist to the drawing experience:

$i = 0
While 1 = 1
    MouseUp("left")
    Sleep(100)
    MouseDown("left")
    $i = $i + 1
    $s = Round(Sin($i / 5) * 5)
    $c = Round(Cos($i / 5) * 5)
    $m = MouseGetPos()
    MouseMove($m[0] - $s, $m[1] + $c, 0)
    $pos = MouseGetPos()
WEnd

I'll look in the help file what Round(sin) and (cos) does in a little and if i like it i'll keep it :graduated: thanks man

Edit: haha makes a circle thats cool, too bad I don't understand the Round statements :(

Edited by Rewl

[size="1"]Programs: Draw Tool | [/size]

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

Your script + JoHanatCent edit + my mod =

Posted Image

:graduated:

Edited by 1RV34

MsgBox(0x40040, "", "Hello Forum!")

Share this post


Link to post
Share on other sites

I'll look in the help file what Round(sin) and (cos) does in a little and if i like it i'll keep it :) thanks man

Edit: haha makes a circle thats cool, too bad I don't understand the Round statements ;)

Straight out of the Autoit Help

Round - Returns a number rounded to a specified number of decimal places. - Round($value, "decimal places")

Sin - Calculates the sine of a number. (Trig) - Cos("value in radians")

Cos - Calculates the cosine of a number. (Trig) - Sin("value in radians")

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0