AutoHotkey Community

It is currently May 25th, 2012, 4:32 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 51 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
 Post subject:
PostPosted: January 24th, 2007, 8:02 pm 
Offline

Joined: November 29th, 2006, 7:54 pm
Posts: 54
Very handy script!

Thanks for sharing


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 20th, 2007, 10:21 pm 
Offline

Joined: July 15th, 2006, 1:30 am
Posts: 48
I love this script, I made a a GUI indicator (which shows which desktop is selected for 1 second) that fades out, so it really looks nice.

I have a major problem with it though.
Sometimes when repeatedly changing desktops, when I switch back some weird shades appear on my screen. I can't really describe it without a picture. But to see what I am saying just press the right button mouse somewhere on the screen to bring the context menu, and while the context menu is visible change to another desktop. When you return to the previous desktop you will see what I am talking about.

The annoying thing is that I can't make them disappear except if I kill the explorer.exe process (via task manager).

This is a picture of google with that weird window shade I get. (it is alwas on top):
Image

_________________
One hotkey to rule them all!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 29th, 2007, 8:20 am 
Offline

Joined: March 21st, 2007, 1:55 pm
Posts: 11
Location: Lyon (France)
Hello,

I really love this script. It's light and do exactely what I want.

I added two functions to go to the next desktop or to the back desktop:

Code:
NextDesktop()
{
   global
   
   if (curDesktop <= 3) {
      SwitchToDesktop(curDesktop+1)
   }

   else {
      SwitchToDesktop(1)
   }
   
}

BackDesktop()
{
   global
   
   if (curDesktop >= 2) {
      SwitchToDesktop(curDesktop-1)
   }

   else {
      SwitchToDesktop(4)
   }
   
}


But I have an issue with one application. I use slickrun to run all my applications. Yes I'm a command line addict user :). I would like to have slickrun on all my desktop and not only the one where it is launched.

:arrow: Do you see how I can do this ?

Regards.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 9th, 2007, 2:48 am 
XavierGr wrote:
I love this script, I made a a GUI indicator (which shows which desktop is selected for 1 second) that fades out, so it really looks nice.


Could you give us that script I think it would be a really useful contribution to this project script.

And a really well done to WileECoyote for developing this script. It is really unique and very useful :D

Thank you for your hard efforts


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 9th, 2007, 4:53 am 
Offline

Joined: June 26th, 2006, 6:14 pm
Posts: 1379
Location: USA
XavierGr:
They are tooltip / window shadows.
8)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 9th, 2007, 5:16 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
XavierGr wrote:
The annoying thing is that I can't make them disappear except if I kill the explorer.exe process (via task manager).

You may close it using this:

Code:
WinClose, ahk_class SysShadow


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 15th, 2007, 2:44 am 
Offline

Joined: July 15th, 2006, 1:30 am
Posts: 48
Sean wrote:
XavierGr wrote:
The annoying thing is that I can't make them disappear except if I kill the explorer.exe process (via task manager).

You may close it using this:

Code:
WinClose, ahk_class SysShadow


Ah! Thank you Sean, once again you are a life saver. :D

Now for the little GUI fading effect, this is my version.

Code:
; DesktopSwitch
;
; AutoHotkey Version: 1.0.40.00 (that's at least the version I'm using)
; Language:       English
; Platform:       Win9x/NT/XP
; Author:         Christian Sch?c_schueler@gmx.at>
; last changes:   22. Nov. 2005
;
; Script Function:
;
; A small tool for switching between multiple virtual desktops.
; Use Alt-<desktop index> (e.g. Alt-2) to switch between desktops and
; Alt-0 to quit the script, showing all windows on all virtual desktops
; at once. Currently, 4 desktops are supported, because more will start
; to confuse me...
;
; Version history:
;
; v1.11, 22. Nov. 2005
; Fixed bug: windows are now corrrectly activated after switching/sending
;
; v1.1, 05. Nov. 2005
; Added feature: pressing Ctrl/Alt-<index> sends the active window to the desktop <index>.
;
; v1.0, 04. Nov. 2005
; It works!
; Switching can be done using Alt-<desktop index>, e.g. Alt-1. Pressing
; Alt-0 will exit the script and show all windows from all virtual desktops
; at once.


; ***** initialization *****

SetBatchLines, -1   ; maximize script speed!
SetWinDelay, -1
OnExit, CleanUp      ; clean up in case of error (otherwise some windows will get lost)

numDesktops := 4   ; maximum number of desktops
curDesktop := 1      ; index number of current desktop

WinGet, windows1, List   ; get list of all currently visible windows

; Transparent Banner GUI
Gui, -Caption +ToolWindow +LastFound +AlwaysOnTop
Gui, Add, Picture, x0 y0, C:\Program Files\Autohotkey\Scripts\banner.png
Gui, Add, Text, x15 y5 w70 +BackgroundTrans vString

; ***** hotkeys *****

#MaxThreadsPerHotkey 6
!1::SwitchToDesktop(1)
!2::SwitchToDesktop(2)
!3::SwitchToDesktop(3)
!4::SwitchToDesktop(4)
#MaxThreadsPerHotkey 1

^!1::SendActiveToDesktop(1)
^!2::SendActiveToDesktop(2)
^!3::SendActiveToDesktop(3)
^!4::SendActiveToDesktop(4)

!0::ExitApp


; ***** functions *****

; switch to the desktop with the given index number
SwitchToDesktop(newDesktop)
{
   global

   if (curDesktop <> newDesktop)
   {
      GetCurrentWindows(curDesktop)

      ;WinGet, windows%curDesktop%, List,,, Program Manager   ; get list of all visible windows

      ShowHideWindows(curDesktop, false)
      ShowHideWindows(newDesktop, true)

      curDesktop := newDesktop

      Send, {ALT DOWN}{TAB}{ALT UP}   ; activate the right window
   }
   
   WinClose, ahk_class SysShadow
   ShowBanner("Desktop: " newDesktop)

   return
}

; sends the given window from the current desktop to the given desktop
SendToDesktop(windowID, newDesktop)
{
   global
   RemoveWindowID(curDesktop, windowID)

   ; add window to destination desktop
   windows%newDesktop% += 1
   i := windows%newDesktop%

   windows%newDesktop%%i% := windowID
   
   WinHide, ahk_id %windowID%

   Send, {ALT DOWN}{TAB}{ALT UP}   ; activate the right window
}

; sends the currently active window to the given desktop
SendActiveToDesktop(newDesktop)
{
   WinGet, id, ID, A
   SendToDesktop(id, newDesktop)
}

; removes the given window id from the desktop <desktopIdx>
RemoveWindowID(desktopIdx, ID)
{
   global   
   Loop, % windows%desktopIdx%
   {
      if (windows%desktopIdx%%A_Index% = ID)
      {
         RemoveWindowID_byIndex(desktopIdx, A_Index)
         Break
      }
   }
}

; this removes the window id at index <ID_idx> from desktop number <desktopIdx>
RemoveWindowID_byIndex(desktopIdx, ID_idx)
{
   global
   Loop, % windows%desktopIdx% - ID_idx
   {
      idx1 := % A_Index + ID_idx - 1
      idx2 := % A_Index + ID_idx
      windows%desktopIdx%%idx1% := windows%desktopIdx%%idx2%
   }
   windows%desktopIdx% -= 1
}

; this builds a list of all currently visible windows in stores it in desktop <index>
GetCurrentWindows(index)
{
   global
   WinGet, windows%index%, List,,, Program Manager      ; get list of all visible windows

   ; now remove task bar "window" (is there a simpler way?)
   Loop, % windows%index%
   {
      id := % windows%index%%A_Index%

      WinGetClass, windowClass, ahk_id %id%
      if windowClass = Shell_TrayWnd      ; remove task bar window id
      {
         RemoveWindowID_byIndex(index, A_Index)
         Break
      }
   }
}

; if show=true then shows windows of desktop %index%, otherwise hides them
ShowHideWindows(index, show)
{
   global

   Loop, % windows%index%
   {
      id := % windows%index%%A_Index%

      if show
         WinShow, ahk_id %id%
      else
         WinHide, ahk_id %id%
   }
}

ShowBanner(Text)
{
    global
    Trans := 255
   
    GuiControl, Text, String, % Text
    Gui, Show, x895 y677 h24 w92 NoActivate, MyTransparentBanner
    WinSet, Transparent, %Trans%, MyTransparentBanner
    Sleep 500
   
    Loop
    {
        if(Trans <= 0)
        {
            Trans := 0
            WinSet, Transparent, %Trans%, MyTransparentBanner
            break
        }
               
        WinSet, Transparent, %Trans%, MyTransparentBanner
        Trans := Trans - 5
        Sleep, 10
    }
   
    return
}

; show all windows from all desktops on exit
CleanUp:
Loop, %numDesktops%
   ShowHideWindows(A_Index, true)
ExitApp


The #MaxThreadsPerHotkey is used to enable fast desktop switching because without it you have to wait for the "fade out" to change to a new desktop.

On the GUI initialization, (line 46) change the path to a picture of your choice, the picture I used was captured from Microsoft's Intellitype crappy software.
Image

Also change line 186 to place the little icon where ever you like on the screen.

_________________
One hotkey to rule them all!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 6th, 2007, 2:28 pm 
Offline

Joined: September 6th, 2007, 2:18 pm
Posts: 1
Firstly, awsome script! I have been trying to use the mess that comes with googDesktop and have been suffering. This is fast and efficient!

Really quick though, I actually have a problem where if I (accidentally) send a window to the current desktop I have to switch and switch back in order to see my window. Your code looks like it does a really nice job of keep track of things, so rather than change anything I simply added the same logical gate that is at the top of your SwitchToDesktop function, where:
Code:
if(curDesktop<>newDesktop)
{
   ;code
}


Also I really like to have the added functionality of being able to hold alt and hit the numberpad digits instead of the toprow numbers.

Just my two cents! Thanks again!

-T


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 6th, 2007, 11:23 pm 
Offline

Joined: July 20th, 2007, 10:23 am
Posts: 257
Location: Paris, France
Indeed it's a nice script.
I will think of using it.

Quote:
Also I really like to have the added functionality of being able to hold alt and hit the numberpad digits instead of the toprow numbers.

Put this with the tohers hotkeys:
Code:
!Numpad1::SwitchToDesktop(1)
!Numpad2::SwitchToDesktop(2)
!Numpad3::SwitchToDesktop(3)
!Numpad4::SwitchToDesktop(4)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 7th, 2007, 12:21 am 
Offline

Joined: January 20th, 2007, 1:29 pm
Posts: 96
Location: Melbourne
I use this for onscreen display if im not using any Gui's
Code:
; create visual display
;YOU CAN CLICK THROUGH THIS AS IF IT IS NOT THERE
vkey=This is what im displaying
Progress,x100 y100 zh0 zy1 w300 H300 B c6 CW333333 CT777777 fs24,%vkey%,,Status ;no borders or box or anything but the text %vkey%
WinSet, TransColor,333333,Status ;makes background invisible Ct is the text color setting
;
; the following is used either in a sub replacing %vkey% with normal text, or set as a sub using vkey=text to display   
;and gosub splash
Sleep 2000 ; remove this if inserting into your code, i put this here so you could see the result
ControlSetText,,You can put anything up here,Status ; this updates the txt %vkey%
Sleep 2000 ; remove this if inserting into your code, i put this here so you could see the result
ControlSetText,,I find it very useful for progs without GUI's,Status ; this updates the txt %vkey%
Sleep 5000 ; remove this if inserting into your code, i put this here so you could see the result

splash:  ;this sub changes the txt in the onscreen display
ControlSetText,,%vkey%,Status ; this updates the txt %vkey%
Return


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Pretty usefull!
PostPosted: September 26th, 2007, 2:55 pm 
Offline

Joined: June 14th, 2006, 7:49 am
Posts: 3
Good work.. this is pretty damn usefull. I am gonna use it, thanx!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 9th, 2007, 9:17 pm 
Offline

Joined: October 3rd, 2007, 9:32 pm
Posts: 157
Location: UK
Nice script - just note that detecthiddenwindows, on causes problems with ShowHideWindows function - might be obvious now but it got pretty messy when i did an #include in a script.

Many thanks.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 13th, 2008, 11:02 pm 
I have 2 suggestions:

1) Allow for, as an alternative to keycommands, Alt + Scroll Wheel. I've envisioned (but have been unable to produce) a virtual desktop where you hold alt and start scrolling, and an alt + tab-esque window comes up with the available desktops, then scroll to the right one and release alt. This would be amazing, but if you don't want to implement (even as just a mod, not to replace the original) that's alright.

2) The one feature I would really like in either is the ability to define windows that are global to all desktops. For example, my winamp window stays on my right monitor. It would be cool to keep it visible no matter which virtual desktop I'm on.


Other than that, fantastic script! Thanks!


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 26th, 2008, 9:46 pm 
try this

step 1
if you're in desk 1, send a window to desk 1. (you now have a missing window. if you reload the script, it comes back)

step 2
switch to desk 2 (or desk 3, or desk 4, etc)

step 3
switch back to desk 1 (if you didn't reload in step1. your window is lost forever... and ever...)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 26th, 2008, 10:04 pm 
anyway to make it so that

Send window to desktop X is not possible when one is currently in desktop x


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

All times are UTC [ DST ]


Who is online

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