AutoHotkey Community

It is currently May 26th, 2012, 11:25 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: November 9th, 2008, 7:40 am 
Offline

Joined: December 13th, 2006, 7:10 am
Posts: 118
FolderEx; open folders the way you really want !

Syntax:
FolderEx.exe [-view icon | list | details | thumbnails | tiles | filmstrip] [-thumbsize n] [-size x,y,w,h | w,h] [-nohidden] [-noext] [-noinfotip] [-folders] [-favorites] [-search] [-wait] "path"

ThumbSize int:
Temporary change the size of displayed thumbnails.

NoHidden, NoExt, NoInfoTip:
Temporary hide hidden files, file extensions or infotip (if they were shown).

Folders, Favorites, Search:
Open the left-side panel (Folders, Favorites or Search).

Wait:
Wait until the explorer window is closed. Usefull to maintain some option active before reseting it to its default value. Only usefull with -thumbsize, -noinfotip, -noext, -nohidden if you plan to navigate through directories or refresh the view.

Size:
Allow you to move/resize the explorer window when it starts.
You can specify only the width and height; in which case, the window will be center on screen. But you can specify x and y, too, to place the window exactly where you want.
For both x, y, w, h, negative values can be use to position/resize the window according to the right/bottom sides instead of the usual left/top ones.
Ex:
FolderEx.exe -size -400,60,-8,600 "C:" ; will place the window 400px from the right side, 60px from the top; the window will be 600px high and 392px wide ( 400-8 ).
FolderEx.exe -size -8,-80 "C:" ; will place the window 8px from both left and right sides and 80px from both top and bottom sides.
I know it could sound tricky but it's usefull.

Path:
Could be a path to a regular folder or an alias to a system folder:
temp,
MyDocuments,
WinDir,
ProgramFiles,
AppData,
AppDataCommon,
Desktop,
DesktopCommon,
StartMenu,
StartMenuCommon,
Startup,
StartupCommon,
Recycler,
NetPlaces,
NetComputers,
NetConnections,
Printers,
Tasks,
ControlPanel

You can combine alias and real folder name when the alias points to an existing folder, like:
FolderEx.exe "WinDir\fonts"
FolderEx.exe "MyDocuments\My music"



FolderEx.ini:
Code:
[Default]
ThumbnailSize=96


FolderEx.ahk:
Code:
#NoEnv
#ErrorStdOut
#NoTrayIcon
#SingleInstance Off
SetBatchLines -1
SetWorkingDir %A_ScriptDir%

IniRead, DefThumbSize, FolderEx.ini, Default, ThumbnailSize
RegRead, show_ext, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, HideFileExt
RegRead, show_hidden, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden
RegRead, show_tip, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, ShowInfoTip


Loop, %0%
{
   if skip {
      skip--
      Continue
   }
   p := %A_Index%
   if ( p = "-thumbsize" ) {
      skip := 1
      msg .= "28717*"
      p := A_Index+1
      p := %p%
      RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer, ThumbnailSize, %p%
   }
   else if (p = "-size" ) {
      skip := 1
      p := A_Index+1
      Size := %p%
      RegExMatch( Size, "([^,]+),([^,]+),?([^,]*),?([^,]*)", Size )
      if Size3 and Size4 {
         x:= Size1
         y := Size2
         w := Size3
         h := Size4
         if ( x < 0 )
            x += A_ScreenWidth
         if ( y < 0 )
            y += A_ScreenHeight
      }
      else {
         w := Size1
         h := Size2
      }
      if ( w < 0 ) {
         if not x
            x := -w
         w := A_ScreenWidth + w - x
      }
      if ( h < 0 ) {
         if not y
            y := -h
         h := A_ScreenHeight + h - y
      }
      if not x
         x := ( A_ScreenWidth - w ) // 2
      if not y
         y := ( A_ScreenHeight - h ) // 2
   }
   else if ( p = "-nohidden" )
      RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden, 2
   else if ( p = "-noext" )
      RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, HideFileExt, 1
   else if ( p = "-noinfotip" )
      RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, ShowInfoTip, 0
   else if ( p = "-view" ) {
      skip := 1
      p := A_Index+1
      p := %p%
      if ( p = "Icon" )
         msg .= "28713*"
      else if ( p = "List" )
         msg .= "28715*"
      else if ( p = "Details" )
         msg .= "28716*"
      else if ( p = "Thumbnails" )
         msg .= "28717*"
      else if ( p = "Tiles" )
         msg .= "28718*"
      else if ( p = "Filmstrip" )
         msg .= "28719*"
   }
   else if ( p = "-folders" )
      msg .= "41525*"
   else if ( p = "-favorites" )
      msg .= "41522*"
   else if ( p = "-search" )
      msg .= "41521*"
   else if ( p = "-wait")
      wait := true

}

; "stole" focus to previously opened explorer windows
WinActivate, Program Manager ahk_class Progman

target := %0%
SplitPath, target,,,,, p
if not p {
   A_Recycler := "::{645ff040-5081-101b-9f08-00aa002f954e}"
   A_NetPlaces := "::{208d2c60-3aea-1069-a2d7-08002b30309d}"
   A_NetComputers := "::{1f4de370-d627-11d1-ba4f-00a0c91eedba}"
   A_NetConnections := "::{7007acc7-3202-11d1-aad2-00805fc1270e}"
   A_Printers := "::{2227a280-3aea-1069-a2de-08002b30309d}"
   A_Tasks := "::{d6277990-4c6a-11cf-8d87-00aa0060f5bf}"
   A_ControlPanel := "control"
   o :=  InStr( target, "`\" )
   if o {
      p := SubStr( target, 1, o - 1 )
      p := A_%p%
      target := p . SubStr( target, o )
   }
   else {
      target := A_%target%
   }
}


Run, %target%
WinWaitActive, ahk_class CabinetWClass,, 10
If ErrorLevel
   Gosub, Restore

if Size
   WinMove,,, %x%, %y%, %w%, %h%

msg .= "28931*41504"
Loop, Parse, msg, *
{
   SendMessage, 0x111, %A_LoopField%
}

Sleep, 2500

if wait
   WinWaitClose

Restore:

   RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, HideFileExt, %show_ext%
   RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden, %show_hidden%
   RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, ShowInfoTip, %show_tip%
   RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer, ThumbnailSize, %DefThumbSize%

Return


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

All times are UTC [ DST ]


Who is online

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