AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Move desktop icons

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Guest






PostPosted: Thu Jan 07, 2010 5:26 pm    Post subject: Move desktop icons Reply with quote

Hi I was wondering
(1)
how to move/slide the desktop icons to the left and back in given that the following does not work ( am already aware of the different ways of hidding the desktop icons but I wanted to know how to move the icons)
Code:
WinMove, Program Manager,  ,10, 20


(2)
Why the following does not work


Code:

#Persistent
SetWinDelay, -1
SetTimer, WatchCursor, 100
return

WatchCursor:
MouseGetPos, X, Y, id, control
WinGetTitle, title, ahk_id %id%
WinGetClass, class, ahk_id %id%
If (%title% := Program Manager) and ( X < 200 )
   
   x = 0
   
   loop, 200
   {
   x := x + 1
   
   winmove, Program Manager, , %x%
   }
   sleep, 5000

   loop, 200
   {
   x := x - 1
   
   winmove, Program Manager, , %x%
   }
   
return

Back to top
Peter



Joined: 30 Dec 2005
Posts: 448

PostPosted: Fri Jan 08, 2010 3:16 pm    Post subject: Reply with quote

I don't know it will work, but at least some errors in the expression:
Code:
If (title = Program Manager) and ( X < 200 )
Namely:
AHK Help file wrote:
Variable names in an expression are not enclosed in percent signs
Back to top
View user's profile Send private message
Guest






PostPosted: Fri Jan 08, 2010 7:29 pm    Post subject: Reply with quote

Thanks Peter,any ideas why the winmove part does not work?
Back to top
Peter



Joined: 30 Dec 2005
Posts: 448

PostPosted: Sat Jan 09, 2010 6:27 am    Post subject: Reply with quote

I've missed a third error in your if-expression Embarassed .
But I would adapt your code as follows: (I placed Tooltips, safer for my testing)
Code:
   #Persistent
   SetWinDelay, -1
   SetTimer, WatchCursor, 100
return

WatchCursor:
   CoordMode, Mouse, Screen
   MouseGetPos, X, Y, id, control
   WinGetTitle, title, ahk_id %id%
   ; WinGetClass, class, ahk_id %id%
   tooltip %title% %x%
   If (title = "Program Manager") and ( X < 200 ) {
      SetTimer, WatchCursor, off
     
      x = 0
      loop, 200
      {
         x := x + 1
         tooltip WinMove+
         ; winmove, Program Manager, , %x%
      }
      sleep, 5000
   
      loop, 200
      {
         x := x - 1
         tooltip WinMove-
         ; winmove, Program Manager, , %x%
      }
     
      tooltip WinMove End
      SetTimer, WatchCursor, on
   }
return
Back to top
View user's profile Send private message
Guest






PostPosted: Sun Jan 10, 2010 10:58 am    Post subject: Reply with quote

Thanks for the 'if' tip.
However, I still cannot find a way to move the icons as "winmove, Program Manager, , %x%" just does not work.

Any ideas?
Back to top
Peter



Joined: 30 Dec 2005
Posts: 448

PostPosted: Sun Jan 10, 2010 12:05 pm    Post subject: Reply with quote

I was wondering before also, is your 1-line code working? (I didn't try, because it maybe messes up my desktop.)
Code:
WinMove, Program Manager,  ,10, 20
Just to be sure Smile .
Back to top
View user's profile Send private message
Guest






PostPosted: Sun Jan 10, 2010 9:48 pm    Post subject: Reply with quote

i have tried both
Code:
WinMove, Program Manager,,10, 20
and
Code:
WinMove, Program Manager,  ,10, 20
but neither work!
Back to top
Peter



Joined: 30 Dec 2005
Posts: 448

PostPosted: Mon Jan 11, 2010 1:07 am    Post subject: Reply with quote

Very funny Rolling Eyes Smile
Guest wrote:
(2)
Why the following does not work
Why on earth do you ask this, if (1) is not working Question
So your problem/question is
Quote:
How to move Desktop window?
I don't know, probably protect Windows it from being moved.
Back to top
View user's profile Send private message
Guest






PostPosted: Tue Jan 12, 2010 9:57 pm    Post subject: Reply with quote

Am I doing something wrong with the exit command?

if I remove the last 3 lines everything works fine!
Code:
   #Persistent
#singleinstance, force
   SetWinDelay, -1
PostMessage, 0x111, 29698,,, ahk_class Progman ; SHOW DESKTOP ICONS (TOGGLE)
   SetTimer, WatchCursor, 100
return
WatchCursor:
   CoordMode, Mouse, Screen
   MouseGetPos, X, Y, id, control
   WinGetTitle, title, ahk_id %id%
   ; WinGetClass, class, ahk_id %id%
   ;tooltip %title% %x%
   If (title = "Program Manager") and ( X < 200 ) {
      SetTimer, WatchCursor, off
     
      x = 1
      ;loop, 254
      loop, 1
      {
         x := x + 1
         ;tooltip WinMove+
         ; winmove, Program Manager, , %x%
    ;WinSet, Transparent, %x%, Program Manager
    PostMessage, 0x111, 29698,,, ahk_class Progman ; SHOW DESKTOP ICONS (TOGGLE)
      }
      sleep, 3000
   
      ;loop, 254
      loop, 1
      {
         x := x - 1
         ;tooltip WinMove-
         ; winmove, Program Manager, , %x%
    ;WinSet, Transparent, %x%, Program Manager
    PostMessage, 0x111, 29698,,, ahk_class Progman ; SHOW DESKTOP ICONS (TOGGLE)
      }
     
      ;tooltip WinMove End
      SetTimer, WatchCursor, on
   }
return

EXIT:
PostMessage, 0x111, 29698,,, ahk_class Progman ; SHOW DESKTOP ICONS (TOGGLE)
ExitApp
Back to top
Peter



Joined: 30 Dec 2005
Posts: 448

PostPosted: Wed Jan 13, 2010 8:41 am    Post subject: Reply with quote

Guest wrote:
Am I doing something wrong with the exit command? if I remove the last 3 lines everything works fine!
1. What's not working fine if you don't remove them?I can't see a problem.
2. Exit: is a label. You want to jump there on exit of script I guess, so add the Onexit command:
Code:
   #Persistent
#singleinstance, force
   SetWinDelay, -1
   PostMessage, 0x111, 29698,,, ahk_class Progman ; SHOW DESKTOP ICONS (TOGGLE)
   OnExit Exit
   SetTimer, WatchCursor, 100
return
Back to top
View user's profile Send private message
Guest






PostPosted: Wed Jan 13, 2010 11:20 am    Post subject: Reply with quote

u c, when the program starts it hides the desktop icons.
upon hover, it shows them and then hides them.
the problem is that upon exit, the icons stay hidden.So I was trying on exit command to make the icons appear again.

When I remove the last 3 lines in my previous post the program works fine but on exit does not make the icons appear again.Been messing around with on exit command but no luck

Code:
#Persistent
#singleinstance, force
SetWinDelay, -1
;PostMessage, 0x111, 29698,,, ahk_class Progman ; SHOW DESKTOP ICONS (TOGGLE)
;PostMessage, 0x111, 29698,,, ahk_class Progman ; SHOW DESKTOP ICONS (TOGGLE)
OnExit Exit
SetTimer, WatchCursor, 100
return
WatchCursor:
   CoordMode, Mouse, Screen
   MouseGetPos, X, Y, id, control
   WinGetTitle, title, ahk_id %id%
   ; WinGetClass, class, ahk_id %id%
   ;tooltip %title% %x%
   If (title = "Program Manager") and ( X < 200 ) {
      SetTimer, WatchCursor, off
     
      x = 1
      ;loop, 254
      loop, 1
      {
         x := x + 1
         ;tooltip WinMove+
         ; winmove, Program Manager, , %x%
    ;WinSet, Transparent, %x%, Program Manager
    PostMessage, 0x111, 29698,,, ahk_class Progman ; SHOW DESKTOP ICONS (TOGGLE)
      }
      sleep, 3000
   
      ;loop, 254
      loop, 1
      {
         x := x - 1
         ;tooltip WinMove-
         ; winmove, Program Manager, , %x%
    ;WinSet, Transparent, %x%, Program Manager
    PostMessage, 0x111, 29698,,, ahk_class Progman ; SHOW DESKTOP ICONS (TOGGLE)
      }
     
      ;tooltip WinMove End
      SetTimer, WatchCursor, on
   }
return

EXIT:
PostMessage, 0x111, 29698,,, ahk_class Progman ; SHOW DESKTOP ICONS (TOGGLE)
ExitApp
Back to top
Peter



Joined: 30 Dec 2005
Posts: 448

PostPosted: Wed Jan 13, 2010 11:57 am    Post subject: Reply with quote

guest wrote:
u c, when the program starts it hides the desktop icons.
Not anymore, because you made it comment. I uncommented it for testing.
guest wrote:
the problem is that upon exit, the icons stay hidden
I don't have that problem.
But the problem with that hide trick is, that you must exit the script when the icons are hidden, because it toggles the desktop icons.
To test whether you enter OnExit routine, place a MsgBox in it.
And you can clean up your code, especially for posting, 50% of it isn't necessary (from WinMove).

PS: I have the problem that minimizing all windows doesn't show the desktop completely, only when forced a show-desktop. In short, it gives redraw problems of the desktop, also after exit the script. That's why I was afraid to run it at first.
Back to top
View user's profile Send private message
Guest






PostPosted: Wed Jan 13, 2010 2:26 pm    Post subject: Reply with quote

U are right works perfect now.

Thanks a lot Peter.Really appreciate your help. Smile
Back to top
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group