Jump to content


Photo

Old-school Window Art!


  • Please log in to reply
14 replies to this topic

#1 firace

firace
  • Members
  • 53 posts

Posted 20 February 2012 - 05:12 PM

In the pointless-but-fun department, why not use AHK to draw Window Art (like ASCII art but using caption-less Windows as tiles)...

this is just a little example, you can tell my drawing skills are not that great...
but if anyone wants to give it a try... could be fun ;)

and the AHK limit on 100 GUIs can be viewed as an extra challenge to
create interesting effects within this limit...

edit: added some color cycling!


Posted Image




col = 0x878290

XX=250
YY=80

while (XX < A_SCREENWIDTH - 200) && (i<13)
{
 if i < 98
    i ++
    gui, %i%: -caption +border +toolwindow
    col += 16  

   Gui, %i%: Color, %col%
   gui, %i%: show, x%XX% y%YY% w60 h110
   XX += 35
   YY += 11
   sleep 20
}

while (XX > 250) && (YY < A_SCREENHEIGHT-300)
{
     if i < 98 
    i ++
    gui, %i%: -caption +border +toolwindow
        col += 16  

   Gui, %i%: Color, %col%
   gui, %i%: show, x%XX% y%YY% w60 h110
   XX -= 35
   YY += 11
   sleep 20
}

while (XX < A_SCREENWIDTH - 200) && (YY < A_SCREENHEIGHT-150) && (i<40)
{
 if i < 98
    i ++
    gui, %i%: -caption +border +toolwindow
        col += 16  

   Gui, %i%: Color, %col%
   gui, %i%: show, x%XX% y%YY% w60 h110
   XX += 35
   YY += 11
   sleep 20
}

while (XX > 250) && (YY < A_SCREENHEIGHT-300)   && (i<54)
{
     if i < 98 
    i ++
    gui, %i%: -caption +border +toolwindow
        col += 16  

   Gui, %i%: Color, %col%
   gui, %i%: show, x%XX% y%YY% w60 h110
   XX += 35
   YY -= 11
   sleep 20
}

while (XX < A_SCREENWIDTH - 200) && (YY < A_SCREENHEIGHT-150) && (i<67)
{
 if i < 98
    i ++
    gui, %i%: -caption +border +toolwindow
        col += 16  

   Gui, %i%: Color, %col%
   gui, %i%: show, x%XX% y%YY% w60 h110
   XX += 35
   YY += 11
   sleep 20
}


esc::exitapp


#2 Guests

  • Guests

Posted 20 February 2012 - 07:43 PM

Seriously? Have you got NOTHING better to do?
Please delete this thread and leave space for more serious codes.

#3 Uberi

Uberi
  • Fellows
  • 1046 posts

Posted 20 February 2012 - 07:55 PM

Don't delete this, there's plenty of space for everyone :D.

Creative.

#4 tidbit

tidbit
  • Moderators
  • 2283 posts

Posted 20 February 2012 - 08:00 PM

Posted Image

#5 firace

firace
  • Members
  • 53 posts

Posted 21 February 2012 - 10:32 AM

Thanks for your support against the anonymous ranter :)

I've updated the code with some color cycling variations to make it less boring...

#6 just guessting

just guessting
  • Guests

Posted 21 February 2012 - 03:11 PM

Is there a line of code I can change to have the image display longer or until I close the app? Your code works, but the image is displayed for only about 1 second and the script exits without pressing the esc key.

Thanks

#7 geekdude

geekdude
  • Members
  • 323 posts

Posted 21 February 2012 - 05:05 PM

Here is the script I made using the same concept:

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

R := 0xD80000
G := 0x706800
Y := 0xF8AB00

XX = 0
YY = 0
WW = 5

Data :=
(
"   RRRRR
  RRRRRRRRR
  GGGYYGY
 GYGYYYGYYY
 GYGGYYYGYYY
 GGYYYYGGGG
   YYYYYYY
  GGRGGG
 GGGRGGRGGG
GGGGRRRRGGGG
YYGRYRRYRGYY
YYYRRRRRRYYY
YYRRRRRRRRYY
  RRR  RRR
 GGG    GGG
GGGG    GGGG"
)

StringSplit, Line, Data, `n

Loop % Line0 ; %
{
	Line := Line%A_Index%
	WW = 5
	Loop % StrLen(Line) ; %
	{
		Col1 := SubStr(Line, A_Index, 1)
		XX += 5
		If (Col1 != " ") {
			Col2 := SubStr(Line, A_Index + 1, 1)
			If (Col1 = Col2) {
				WW += 5
			} Else {
				i ++
				Gui, %i%: -caption +border +toolwindow
				Gui, %i%: Color, % %Col1%
				Gui, %i%: show, % "x" XX - WW " y" YY " w" WW " h5" ; %
				WW = 5
			}
		}
	}
	XX = 0
	YY += 5
}
Return

Esc::ExitApp


#8 firace

firace
  • Members
  • 53 posts

Posted 21 February 2012 - 05:18 PM

geekdude, lol that was awesome! - i'm a big fan of retro video games (of course)

#9 Anigav

Anigav
  • Guests

Posted 21 February 2012 - 07:37 PM

Got inspired

#NoEnv
#Persistent
#SingleInstance force
SetWorkingDir %A_ScriptDir%
WorkingDir %A_ScriptDir%

R := 0xD80000
G := 0x706800
Y := 0xF8AB00
W := 0xFFFFFF

XX = 0
YY = 0
WW = 5

Data :=
(
"                                   Y
  RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRYYRRR
  RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRYYRRRR
  RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRYYRRRRR
  RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRYYRRRRR   WW
  RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRYYRRRRR     WW
  RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRYYRRRR         WW
  RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRYYRRRR             WW
  RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRYYRRR
  RRRRRR                           Y
  RRRRRRR
  RRRRRRRR
  RRRRRRRRR
  RRRRRRRRR
  RRRRRRRR
  RRRRRRR
  RRRRR
  RRR
"
)

StringSplit, Line, Data, `n

Loop % Line0 ; %
{
   Line := Line%A_Index%
   WW = 5
   Loop % StrLen(Line) ; %
   {
      Col1 := SubStr(Line, A_Index, 1)
      XX += 5
      If (Col1 != " ") {
         Col2 := SubStr(Line, A_Index + 1, 1)
         If (Col1 = Col2) {
            WW += 5
         } Else {
            i ++
            Gui, %i%: -caption +border +toolwindow
            Gui, %i%: Color, % %Col1%
            Gui, %i%: show, % "x" XX - WW " y" YY " w" WW " h5" ; %
            WW = 5
         }
      }
   }
   XX = 0
   YY += 5
}
Return

Esc::ExitApp


#10 emmanuel d

emmanuel d
  • Members
  • 494 posts

Posted 21 February 2012 - 08:04 PM

differend loop:
#Persistent

#SingleInstance force

R := 0xD80000

G := 0x706800

Y := 0xF8AB00

w := "white"

b := "black"

XX = 0

YY = 0

WW = 5

Data :=

(

"   RRRRR

  RRRRRRRRR

  GGGYYGY

 GYGYYYGYYY

 GYGGYYYGYYY

 GGYYYYGGGG

   YYYYYYY

  GGRGGR

 GGGRGGRGGG

GGGGRRRRGGGG

YYGRYRRYRGYY

YYYRRRRRRYYY

YYRRRRRRRRYY

  RRR  RRR

 GGG    GGG

BGGG    GGGB"

)

Loop, parse, Data, `n, `r   ; Specifying `n prior to `r allows both Windows and Unix files to be parsed.

	{

	line:=A_LoopField

	Loop, parse, A_LoopField  

		{

		XX += 5

		If (A_LoopField != " ") {

			If (A_LoopField = SubStr(Line, A_Index + 1, 1)) {

				WW += 5

			} Else { 

				i ++

				Gui, %i%: -caption +border +toolwindow

				Gui, %i%: Color, % %A_LoopField%

				Gui, %i%: show, % "x" XX - WW " y" YY " w" WW " h4" ; %

				WW = 5

				}

			}

		}

	XX := 0 , YY += 5

	}

Return

Esc::ExitApp


#11 Uberi

Uberi
  • Fellows
  • 1046 posts

Posted 21 February 2012 - 11:48 PM

and the AHK limit on 100 GUIs can be viewed as an extra challenge to
create interesting effects within this limit...


Actually with the advent of named GUIs, we can have potentially unlimited windows... 8)

#12 geekdude

geekdude
  • Members
  • 323 posts

Posted 22 February 2012 - 02:32 PM

Hey Uberi! I took your Idea into consideration, and found it feasible.
Also, thanks emanuel d

Using letters, I Can now have up to 676 (26^2) GUIs.
Add a third character and I will be able to have 17576 (26^3) GUIs!!!

I only used two characters in this example though...

Alph = abcdefghijklmnopqrstuvwxyz
R := 0xD80000
G := 0x706800
Y := 0xF8AB00
XX = 0
YY = 0
WW = 5
i1 = 1
i2 = 1
Data :=
(
"WWWWWWWWWWWWWW
WWWWRRRRRWWWWW
WWWRRRRRRRRRWW
WWWGGGYYGYWWWW
WWGYGYYYGYYYWW
WWGYGGYYYGYYYW
WWGGYYYYGGGGWW
WWWWYYYYYYYWWW
WWWGGRGGRWWWWW
WWGGGRGGRGGGWW
WGGGGRRRRGGGGW
WYYGRYRRYRGYYW
WYYYRRRRRRYYYW
WYYRRRRRRRRYYW
WWWRRRWWRRRWWW
WWGGGWWWWGGGWW
WGGGGWWWWGGGGW
WWWWWWWWWWWWWW"
)
Loop, parse, Data, `n, `r
	{
	Loop, parse, A_LoopField
		{
		XX += 5
		If (i2 > 26) {
			i1 ++
			i2 = 1
		}
		i := SubStr(alph, i1, 1) . SubStr(alph, i2, 1)
		Gui, %i%: -caption +border +toolwindow
		Gui, %i%: Color, % %A_LoopField% ;%
		Gui, %i%: show, % "x" XX - WW " y" YY " w" WW " h4" ; %
		WW = 5
		i2 ++
	}
	XX := 0
	YY += 5
}
Return
Esc::ExitApp


#13 JSLover

JSLover
  • Members
  • 920 posts

Posted 22 February 2012 - 05:19 PM

Actually with the advent of named GUIs, we can have potentially unlimited windows... 8)

...I was gonna reply before, but I didn't...

Just below the text linked above...

[v1.1.04+]: Any number of unnamed GUI windows can be created using Gui, New.

...therefore, you don't need any tricks to "get more windows" by "using more chars"...just Gui, New -- with no name -- to get unlimited Gui's...(save an hwnd if you need to refer to the Gui again).

#14 geekdude

geekdude
  • Members
  • 323 posts

Posted 23 February 2012 - 05:31 AM

YOSHI


R := 0xFF0000
G := 0x00FF00
O := 0xFFAA00
W := "White"
B := "Black"
XX = 0
YY = 0
WW = 1
Data :=
(
"
                BB
               BGGB
              BGGWW
              BGWWB
            BBBWWWB BBB
           BOOBWWWWBGGGBB
           BOOBGWWGGGGWWGB
            BBBGGGGGGGGBWB
           BOBGGGGGGGGGGGGB
           BOBGGGGGGGGGGGGB
            BBBGGGGWBGGGGGB
            BOBGGGGWBGGGGGB
            BOBGGGWBBGGGGGB
            BBGGGWWWWBGGGB 
           BOBGGGWBWWWBBB  
            BBGGWB BBB     
   BB BBBB BBGGWB
 BBBWBROOWBWBGWWB
 BGBWBRRROBWBWWWB
  BWBWBBBBWBWWWWB
  BWBWWWWWBBBWWWB
  BWWBBBBBBOBBBB
   BWBWGGGBOOBOOB
   BWBBBBBBBOOOOB
   BWBRRRRRBBOOBB
    BBRRRRRWBBBB
     BRRRRRRB
     BBBBBBBB
"
)
Gui, New
Gui, -caption +toolwindow
Gui, Color, White
Gui, Show, x0 y0 w28 h30
Loop, parse, Data, `n, `r
	{
	Loop, parse, A_LoopField
		{
		XX += 1
		If (A_LoopField = " ")
			Continue
		Gui, New
		Gui, -caption -border +toolwindow
		Gui, Color, % %A_LoopField% ;%
		Gui, show, % "x" XX - WW " y" YY " w" WW " h1" ; %
		WW = 1
	}
	XX := 0
	YY += 1
}
Return
Esc::ExitApp


#15 Guests

  • Guests

Posted 23 February 2012 - 10:48 AM

Seriously? Have you got NOTHING better to do?
Please delete this thread and leave space for more serious codes.

What are you really. I don't understand why mods allow such an offensive post.