AutoHotkey Community

It is currently May 26th, 2012, 10:33 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: August 11th, 2008, 2:16 am 
Offline

Joined: July 21st, 2006, 12:26 am
Posts: 223
[ Description ] :
It's basically an algorithm of animation to move the chosen window to the top of the screen. It's doesnt really hides the windows, it just moves to offscreen and creates a very natural effect of animation, based on golden number.

Enjoy!

Code:
#NoEnv
#SingleInstance Force
#Persistent

SetBatchLines,-1
SetKeyDelay,-1
SetWinDelay,-1


/*
   conliek v01
     by k3ph
*/
conliek(o,pid,s=30){
  sysget, SM_CYSIZE, 31
  sysget, SM_CYSIZEFRAME, 33
  border := -(SM_CYSIZE + SM_CYSIZEFRAME)
  wingetpos, x, y, w, h, ahk_pid %pid%
  phi := (1+sqrt(5))/2
  n := log((phi+h+(h*phi))/phi) / log(phi)
  rn := round(n)
  loop %rn% {
    wingetpos, x, y, w, h, ahk_pid %pid%
    if (o="hide" || o=1) {
      ryl := round(-h + (phi**(rn-a_index)) - 1)
      if (ryl <= -h) {
         winmove, ahk_pid %pid%, , 0, -%h%
         break
      }
    }
    if (o="unhide" || o=0) {
      ryl := round(-((phi**(rn-a_index))))
      if (ryl >= border) {
         winmove, ahk_pid %pid%, , 0, %border%
         break
      }
    }
    winmove, ahk_pid %pid%, , 0, %ryl%
    sleep % s
  }
}



; a very basic example
  process=cmd.exe
  run, %process%,,,pid
  onexit exit
 
  `:: ; shortcut key
  switch := !switch
  if switch
     conliek(0,pid)
  else
     conliek(1,pid)
  return 
 
  esc::
  exit:
    winclose ahk_pid %pid%
    exitapp


example usage: simply press ` key after loading the script

update: thanks Heresy, we miss you.

_________________
                                  [ profile | ahk.net | ahk.talk ]


Last edited by k3ph on January 10th, 2010, 8:51 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 11th, 2008, 3:54 pm 
Nice! Thx 4 sharing it. :D


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: August 11th, 2008, 4:36 pm 
Offline

Joined: March 11th, 2008, 11:36 pm
Posts: 291
Thanks i like it border can be replaced with following

Code:
SysGet, SM_CYSIZE, 31
SysGet, SM_CYSIZEFRAME, 33
Border := -(SM_CYSIZE + SM_CYSIZEFRAME)

_________________
Easy WinAPI - Dive into Windows API World
Benchmark your AutoHotkey skills at PlayAHK.com


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], Exabot [Bot], Stigg and 7 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