AutoHotkey Community

It is currently May 27th, 2012, 2:55 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: :) -> It looks G00D!
PostPosted: April 19th, 2004, 4:29 am 
Offline

Joined: March 28th, 2004, 3:53 pm
Posts: 1870
just run this script while keeping the file 'artist.txt' in script's folder. u'll like the effect! (just don't move your mouse once its started!!)

Code:
SetTitleMatchMode, 2
SetBatchLines, 10ms
SetDefaultMouseSpeed, 1
SetMouseDelay, 0

RegWrite, REG_SZ, HKCR, Artist_file\shell\open\command,, %a_scriptfullpath% `%1
RegWrite, REG_SZ, HKCR, .art,, Artist_file


ifinstring,1,.art
{
setenv, art, %1%
goto, start
}

ifequal,1,/new, goto, new

MsgBox, 3, New Art?, Do you want to scan a new image?
ifmsgbox,cancel, exitapp
ifmsgbox, yes
{
   ifwinnotexist, - Paint,,run,pbrush
   winwait, - Paint
   goto, new
}

FileSelectFile, art, 1, %a_scriptdir%, Select .Art file, *.art


start:
ifwinnotexist, - Paint,,run,pbrush
winwait, - Paint

MsgBox, Select the color of your choice and press OK.

WinActivate , - Paint

PostMessage, 0x111, 636,,, - Paint  ;selects pencil

;select color here
;WinGetActiveStats, Title, Width, Height, X, Y
;PixelSearch, pixX, pixY, 1, 1, %Width%, %Height%, 4210688
;MouseClick, LEFT, %pixX%, %pixY%


SplashTextOn, 200, 25, Press Win+X to exit, Wait!  Let me draw...
WinMove, Press Win+X to exit,,550

Loop, Read, %art%
{
   StringGetPos, dpos, A_LoopReadLine, -
   StringLeft, x, A_LoopReadLine, %dpos%
   dpos ++
   StringTrimLeft, y, A_LoopReadLine, %dpos%
   MouseClick, LEFT, %X%, %Y%
}

MouseMove, 400, 400
exitapp




new:

FileSelectFile, art,, %a_scriptdir%, Create .Art file, *.art


;========================
;change scanned area here

ex = 300
ey = 300
;========================

sx = 65
sy = 49

cy = %sy%

msgbox,1,Ready?,Press OK to start scanning.
ifmsgbox,cancel, exitapp

FileDelete, %art%
ifwinnotexist, - Paint,,run,pbrush
winwait, - Paint
WinActivate , - Paint

SplashTextOn, 200, 25, Press Win+X to exit, Wait!  I'm Scanning...
WinMove, Press Win+X to exit,,550
Loop
{
   cx = %sx%

   Loop
   {
      PixelGetColor, pix, %cx%, %cy%
      ifequal, pix, 0, FileAppend, %cx%-%cy%`n, %art%
      envadd, cx, 1
      ifequal, cx, %ex%, break
   }
   envadd, cy, 1
   ifequal, cy, %ey%, break
}

exitapp

#x::
exitapp
return



artist.txt
Code:
92-58
103-58
104-58
105-58
90-59
91-59
92-59
104-59
105-59
106-59
89-60
90-60
91-60
105-60
106-60
107-60
88-61
89-61
90-61
91-61
95-61
96-61
97-61
98-61
99-61
105-61
106-61
107-61
108-61
74-62
88-62
89-62
90-62
91-62
93-62
94-62
95-62
96-62
97-62
98-62
99-62
100-62
101-62
104-62
105-62
106-62
107-62
108-62
74-63
75-63
87-63
88-63
89-63
90-63
91-63
92-63
93-63
94-63
95-63
96-63
97-63
98-63
99-63
100-63
101-63
102-63
103-63
104-63
105-63
106-63
107-63
108-63
109-63
74-64
75-64
76-64
77-64
78-64
87-64
88-64
89-64
90-64
91-64
92-64
93-64
94-64
95-64
96-64
97-64
98-64
99-64
100-64
101-64
102-64
103-64
104-64
105-64
106-64
107-64
108-64
109-64
75-65
76-65
77-65
78-65
79-65
87-65
88-65
89-65
90-65
91-65
92-65
93-65
94-65
95-65
96-65
97-65
98-65
99-65
100-65
101-65
102-65
103-65
104-65
105-65
106-65
107-65
108-65
109-65
73-66
74-66
75-66
76-66
79-66
80-66
87-66
88-66
89-66
90-66
91-66
92-66
93-66
94-66
95-66
96-66
97-66
98-66
99-66
100-66
101-66
102-66
103-66
104-66
105-66
106-66
107-66
108-66
109-66
74-67
76-67
77-67
79-67
80-67
81-67
87-67
88-67
89-67
90-67
91-67
92-67
93-67
94-67
95-67
96-67
97-67
98-67
99-67
100-67
101-67
102-67
103-67
104-67
105-67
106-67
107-67
108-67
109-67
74-68
77-68
78-68
81-68
82-68
88-68
89-68
90-68
91-68
92-68
93-68
94-68
95-68
96-68
97-68
98-68
99-68
100-68
101-68
102-68
103-68
104-68
105-68
106-68
107-68
108-68
109-68
74-69
75-69
77-69
78-69
82-69
88-69
89-69
90-69
91-69
92-69
93-69
94-69
95-69
96-69
97-69
98-69
99-69
100-69
101-69
102-69
103-69
104-69
105-69
106-69
107-69
108-69
74-70
78-70
79-70
81-70
82-70
83-70
88-70
89-70
90-70
91-70
92-70
93-70
94-70
95-70
96-70
97-70
98-70
99-70
100-70
101-70
102-70
103-70
104-70
105-70
106-70
107-70
108-70
74-71
75-71
78-71
79-71
80-71
81-71
82-71
88-71
89-71
90-71
91-71
92-71
93-71
94-71
95-71
96-71
97-71
98-71
99-71
100-71
101-71
102-71
103-71
104-71
105-71
106-71
75-72
76-72
78-72
79-72
80-72
81-72
88-72
89-72
90-72
91-72
92-72
93-72
94-72
95-72
96-72
97-72
98-72
99-72
100-72
101-72
102-72
103-72
104-72
105-72
75-73
76-73
77-73
78-73
79-73
80-73
87-73
88-73
89-73
90-73
91-73
92-73
93-73
94-73
95-73
96-73
97-73
98-73
99-73
100-73
101-73
102-73
103-73
104-73
105-73
77-74
79-74
80-74
81-74
88-74
89-74
90-74
91-74
92-74
93-74
94-74
95-74
96-74
97-74
98-74
99-74
100-74
101-74
102-74
103-74
104-74
80-75
81-75
88-75
89-75
90-75
91-75
92-75
93-75
94-75
95-75
96-75
97-75
98-75
99-75
100-75
101-75
102-75
103-75
104-75
81-76
82-76
90-76
91-76
92-76
93-76
94-76
95-76
96-76
97-76
98-76
99-76
100-76
101-76
102-76
103-76
81-77
82-77
83-77
91-77
92-77
93-77
94-77
95-77
96-77
97-77
98-77
99-77
100-77
101-77
82-78
83-78
93-78
94-78
95-78
96-78
97-78
98-78
99-78
100-78
101-78
82-79
83-79
84-79
85-79
93-79
94-79
95-79
96-79
97-79
98-79
99-79
100-79
101-79
102-79
82-80
83-80
84-80
85-80
86-80
92-80
93-80
94-80
95-80
96-80
97-80
98-80
99-80
100-80
101-80
102-80
103-80
81-81
82-81
83-81
84-81
85-81
86-81
87-81
91-81
92-81
93-81
94-81
95-81
96-81
97-81
98-81
99-81
100-81
101-81
102-81
103-81
104-81
105-81
82-82
83-82
84-82
85-82
86-82
87-82
88-82
89-82
90-82
91-82
92-82
93-82
94-82
95-82
96-82
97-82
98-82
99-82
100-82
101-82
102-82
103-82
104-82
105-82
83-83
84-83
85-83
86-83
87-83
88-83
89-83
90-83
91-83
92-83
93-83
94-83
95-83
96-83
97-83
98-83
99-83
100-83
101-83
103-83
104-83
105-83
85-84
86-84
87-84
89-84
90-84
92-84
93-84
94-84
95-84
96-84
97-84
98-84
99-84
100-84
101-84
102-84
103-84
104-84
86-85
87-85
91-85
92-85
93-85
94-85
95-85
96-85
97-85
98-85
99-85
100-85
101-85
102-85
103-85
104-85
105-85
117-85
86-86
87-86
88-86
92-86
93-86
94-86
95-86
96-86
97-86
98-86
99-86
100-86
101-86
102-86
103-86
104-86
105-86
106-86
117-86
118-86
87-87
88-87
91-87
92-87
93-87
94-87
95-87
96-87
97-87
98-87
99-87
100-87
101-87
102-87
103-87
104-87
105-87
106-87
116-87
117-87
118-87
88-88
92-88
93-88
94-88
95-88
96-88
97-88
98-88
99-88
100-88
101-88
102-88
103-88
104-88
105-88
111-88
112-88
114-88
115-88
116-88
117-88
92-89
93-89
94-89
95-89
96-89
97-89
98-89
99-89
100-89
101-89
102-89
103-89
104-89
112-89
113-89
114-89
115-89
116-89
117-89
93-90
94-90
95-90
96-90
97-90
98-90
99-90
100-90
101-90
102-90
103-90
104-90
105-90
113-90
114-90
115-90
116-90
117-90
93-91
94-91
95-91
96-91
97-91
98-91
99-91
100-91
101-91
102-91
104-91
105-91
106-91
107-91
108-91
109-91
112-91
113-91
114-91
115-91
116-91
93-92
94-92
95-92
99-92
100-92
101-92
102-92
107-92
108-92
109-92
110-92
111-92
113-92
114-92
115-92
94-93
95-93
100-93
101-93
112-93
113-93
114-93
93-94
94-94
95-94
100-94
101-94
102-94
86-95
87-95
88-95
89-95
91-95
92-95
93-95
94-95
95-95
99-95
100-95
101-95
85-96
86-96
87-96
88-96
89-96
90-96
91-96
92-96
93-96
94-96
95-96
96-96
99-96
100-96
101-96
102-96
103-96
84-97
85-97
86-97
87-97
88-97
89-97
90-97
91-97
92-97
93-97
94-97
95-97
96-97
97-97
98-97
99-97
100-97
101-97
102-97
103-97
83-98
84-98
85-98
86-98
87-98
88-98
89-98
90-98
91-98
92-98
93-98
94-98
95-98
96-98
97-98
98-98
99-98
100-98
101-98
102-98
103-98
83-99
84-99
85-99
86-99
87-99
88-99
89-99
90-99
91-99
92-99
93-99
94-99
95-99
96-99
97-99
98-99
99-99
100-99
101-99
102-99
103-99
104-99
84-100
85-100
86-100
87-100
88-100
89-100
90-100
91-100
92-100
93-100
94-100
95-100
96-100
97-100
98-100
99-100
100-100
101-100
102-100
103-100
92-101
93-101
94-101
95-101
96-101
97-101
98-101
99-101
100-101
101-101
102-101
103-101
93-102
94-102
95-102
96-102
97-102
98-102
99-102
100-102
101-102
102-102
97-103
99-103
100-103


i coded it just for kicks... don't know if it has some 'real' uses!

for making your own images:
-scan by lauching script with '/new' param. it happens automatically when artist.txt is not found.
-the upper left corner is scanned (change size in script).
-only black is seen when scanning.

_________________
Image


Last edited by Rajat on April 22nd, 2004, 2:09 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 19th, 2004, 1:04 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
That little devil is adorable. Btw, you can speed up the script dramatically by adding these two lines near the top:

SetDefaultMouseSpeed, 1 ; Normal value is 2
SetMouseDelay, 0 ; Normal value is 10


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 19th, 2004, 3:44 pm 
Offline

Joined: March 28th, 2004, 3:53 pm
Posts: 1870
oh that's better! :)

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 21st, 2004, 9:48 pm 
Offline

Joined: April 7th, 2004, 2:43 pm
Posts: 62
Wow (jaw drop).

1) How did you know what parameters for PostMessage, 0x111, 636,,, - Paint ;selects pencil ?



2) I'm a bit confused on how to make my own image. Maybe a *little* more explanation?

Thanks
Payam


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 22nd, 2004, 2:10 am 
Offline

Joined: March 28th, 2004, 3:53 pm
Posts: 1870
Have a look at this topic, http://www.autohotkey.com/forum/viewtopic.php?t=126 this'll explain pencil (or any other tool) selection that works everytime.

i've also update the main script above. much improved version of a technically useless script ;). anyways, with this u'll find it less difficult to do things like scanning etc.

to make your own images do this:
-open an image in an image viewer (preferably, irfanview)
-convert to greyscale (this step improves results, but can be skipped if u so wish)
-decrease color depth to just 2 colors (black & white), this'll make most images look yucky..... but the right ones will look very artistic. u've to do this...even on images that otherwise look black & white!... the black in them isn't pure black.
-start script and answer yes to new image prompt, select a new file name...but don't press 'OK to start scanning'.
-in the paint window paste the image that u've made above (black & white) and press OK to scan.
-the images size should be small... like 150*200 pix or less..

and yeah...as it associates .art files with itself, so compile it and run for best use... then u can also dbl click .art files to launch them.

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 30th, 2004, 11:32 pm 
Offline

Joined: December 29th, 2004, 8:22 pm
Posts: 75
Sweet work as usual, Rajat,...
Where's all the back-pats for this one people!!??

_________________
-buttons, buttons,...
I like to push all the buttons!!!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 1st, 2005, 3:08 pm 
Offline

Joined: May 1st, 2005, 8:40 pm
Posts: 10
Sorry for the bump, but how does this work?

I have copied the code into artist.ahk file and artist.txt into artist.txt file. Having both of them in the same directory, I've run the script and it asked me if I would have like to scan a new image... Umm... What?
No matter what I choose it asks me to open an .art file. Which I do not have.
All my other efforts of making my own image were equally fruitless.

I wouldn't even bother if not for all the awsome/wow/sweet/nifty/dandy comments and so by now my curiosity is eating, nay, devouring me and all I get is a big flipoff...

Help plz plz plz


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 1st, 2005, 3:54 pm 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
Hi Jajo,
There is a mistake in the post. You have to name the file "artist.art" or something with ".art".
Then, on the command line you have to specify that file as a parameter for the script (e.g. artist.ahk).

_________________
Ciao
toralf
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 1st, 2005, 5:18 pm 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
Here is another version of the script
http://www.angelfire.com/ultra2/rajat/artist.html

_________________
Ciao
toralf
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 1st, 2005, 5:34 pm 
Offline

Joined: September 7th, 2004, 9:20 pm
Posts: 275
Location: France
Superb !!! Do you think there is a possibility to do the same on screen (Like a n animated splash screen...) ?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 1st, 2005, 5:36 pm 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
Hi Nemroth,
I do not understand.

I have modified Rajats script, it now has a GUI and you can drag and drop files on it. Plus it is only 83 lines long :)
Code:
SetTitleMatchMode, 2
SetBatchLines, -1
SetDefaultMouseSpeed, 1
SetMouseDelay, 0

Gui, 1:Add, Text,,Drag a file with ".art" on this Gui to draw it.`n`nDrag a picture on this GUI to scan it and create`na new ".art" file.
Gui, 1:Add, Text,Section, ScanArea X
Gui, 1:Add, Edit,ys-4 vex Number Limit4, 300
Gui, 1:Add, Text,ys, ScanArea Y
Gui, 1:Add, Edit,ys-4 vey Number Limit4, 300
Gui, 1:Show, ,Rajat Copy Art
return

GuiDropFiles:
  Loop, parse, A_GuiControlEvent, `n
    {
      FirstFile = %A_LoopField%
      Break
    }
  ifinstring,FirstFile,.art, GoSub, start
  Else
       GoSub, new
  Gui, 1:Show
Return

GuiClose:
GuiEscape:
  ExitApp
Return

start:
  ifwinnotexist, - Paint,,run,pbrush
  winwait, - Paint
 
  MsgBox, Select the color of your choice and press OK.

  BlockInput, On
  WinActivate , - Paint
 
  PostMessage, 0x111, 636,,, - Paint  ;selects pencil
 
  Loop, Read, %FirstFile%
   {
     StringSplit, pos, A_LoopReadLine, -
     MouseClick, LEFT, %pos1%, %pos2%
   }
  BlockInput, Off
return

new:
  Gui, 1:Submit
 
  sx = 65
  sy = 49
 
  ifwinnotexist, - Paint,,run, pbrush.exe "%FirstFile%", C:\
  winwait, - Paint

  msgbox,1,Ready?,Press OK to start scanning.
  ifmsgbox,cancel, exitapp
 
  BlockInput,On
  WinActivate , - Paint

  cy = %sy%
  Loop, %ey%
  {
     cx = %sx%
     Loop, %ex%
     {
        PixelGetColor, pix, %cx%, %cy%
        if ( pix = 0 )
          String = %String%%cx%-%cy%`n
        cx++
     }
     cy++
  }
  BlockInput,Off
 
  FileSelectFile, art,, %a_scriptdir%, Create .Art file, *.art
  FileDelete, %art%
  FileAppend, %String%, %art%
return

_________________
Ciao
toralf
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 1st, 2005, 5:47 pm 
Offline

Joined: September 7th, 2004, 9:20 pm
Posts: 275
Location: France
toralf wrote:
Hi Nemroth,
I do not understand.

I just wanted to know if it would be possible to make the drawing directly on the screen, whatever the window witch is bvelow, or in a window on the screen but not in Paint. Like a splash screen.

I understand that the prog use the pencil of Paint, but perhaps is it possible directly on screen ? I have a dream...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 1st, 2005, 7:32 pm 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
MLK wrote:
I had a dream..
You could maybe do it with a transparent gui on which you place small pictures (e.g. a black 2by2 pixel image). But i doubt that it will be fast.

_________________
Ciao
toralf
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 1st, 2005, 8:22 pm 
Offline

Joined: September 7th, 2004, 9:20 pm
Posts: 275
Location: France
Yes. I thought about that. But the picture will be displayed, not drawn like in the prog...
Well, it's only a dream. This one is a little one...
Perhaps in the future the ability to support an animated picture or a flash animation in the GUI ?
Wait and see...
Wait and hope...
toralf and Rajat, bravo for the superb work !!!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 5th, 2005, 9:01 am 
Offline

Joined: March 28th, 2004, 3:53 pm
Posts: 1870
didn't someone post some screen writing script on this forum using dllcall or something? maybe painting just a pixel on the screen is easy too. that'd be good as then this script will run standalone instead of requiring paint.

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google Feedfetcher, Kirtman and 13 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group