AutoHotkey Community

It is currently May 25th, 2012, 10:54 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: January 22nd, 2008, 10:25 am 
Offline

Joined: May 10th, 2007, 2:52 am
Posts: 194
Location: China/ Canada
Code:
#f::msgbox, % ExplorerCheck()
#m::CHDIR("A_MyDocuments", "1")
#p::CHDIR("ProgramFiles","0")
#w::CHDIR("A_WinDir")

CHDIR(PathName = "A_MyDocuments", Option = 0)
{
 static TimeCheck1, TimeCheck2, TimeCheck3, TimeCheck4
 EditDelay = 256 ; adjust it to avoid problem(s)
 TimeCheck3 := TimeCheck2, TimeCheck2 := TimeCheck1, TimeCheck1 := A_TickCount - TimeCheck4, TimeCheck4 := A_TickCount
 If TimeCheck3
  If ((TimeCheck1 + TimeCheck2 + TimeCheck3) / 3 < 1256)
  {
   Msgbox, 48, CHDIR Utility, Key press average too fast`n(Action stops to avoid Internet Explorer loading problem)
   return
  }
 IfNotExist, %PathName%
 {
  IfNotInString, PathName, :\o
   _cd_p_n_c := %PathName%
  IfNotExist, %_cd_p_n_c%
  {
   msgbox, 48, CHDIR Utility, %PathName% could not be used atm
   return
  }
  Else
   PathName := _cd_p_n_c
 }
 WinGet, WindowCheck, List
 Loop, %WindowCheck%
  If WindowCheck%A_Index%
  {
   WindowCheck0 := WindowCheck%A_Index%
   WinGet, WindowCheck, ProcessName, ahk_id %WindowCheck0%
   If WindowCheck = explorer.exe
   {
    WinGet, WindowCheck, Style, ahk_id %WindowCheck0%
    If WindowCheck = 0x14CF0000
    {
     ControlSetText, Edit1, %PathName%, ahk_id %WindowCheck0%
     TimeCheck := A_TickCount
     Loop
     {
      ControlGetText, ControlText, Edit1, ahk_id %WindowCheck0%
      If ControlText = %PathName%
       break
      If (A_TickCount - TimeCheck > 3000)
       break
     }
     Sleep, %EditDelay%
     ControlSend, Edit1, {Enter}, ahk_id %WindowCheck0%
     return
    }
   }
  }
 If Option <> 0
  Run, explorer.exe /e %PathName%, %A_WinDir%
}

ExplorerCheck(WindowName = "List", Option = 0)
{
 global _func_e_c_s, _func_e_c_f, _func_e_c_p
 Loop, Parse, Option
  if A_LoopField is number
   _func_e_c_n0 := _func_e_c_n0 A_LoopField
  Else
   break
 _func_e_c_n := 0
 If WindowName <> List
  WinGet, WindowCheck, List, %WindowName%
 Else if WindowName = List
  WinGet, WindowCheck, List
 Loop, %WindowCheck%
  If WindowCheck%A_Index%
  {
   WindowCheck0 := WindowCheck%A_Index%
   WinGet, WindowCheck, ProcessName, ahk_id %WindowCheck0%
   If WindowCheck = explorer.exe
   {
    WinGet, WindowCheck, Style, ahk_id %WindowCheck0%
    If WindowCheck = 0x14CF0000
    {
     _func_e_c_n += 1
     If (_func_e_c_n - _func_e_c_n0 = 1)
      Goto, _ExplorerCheck_g_info_file_path
    }
   }
  }
 return
 _ExplorerCheck_g_info_file_path:
 ControlGet, _func_e_c_s, List, Selected Col1, SysListView321, ahk_id %WindowCheck0%
 ControlGet, _func_e_c_f, List, Focused Col1, SysListView321, ahk_id %WindowCheck0%
 ControlGetText, _func_e_c_p, Edit1, ahk_id %WindowCheck0%
 If _func_e_c_p
  _func_e_c_msgbox := "Folder:   " _func_e_c_p
 Else
  _func_e_c_msgbox =
 If _func_e_c_f
  _func_e_c_msgbox .= "`nFocus:    " _func_e_c_f
 If _func_e_c_s
  _func_e_c_msgbox .= "`n<Selected Items>`n" _func_e_c_s
 if Option is not digit
  Msgbox, 64, File Check, %_func_e_c_msgbox%
 return _func_e_c_msgbox
}

_________________
Sakurako ^_^


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 22nd, 2008, 12:31 pm 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
Shell_SetPath

Doesn't depend on address bar visibility.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 23rd, 2008, 2:19 am 
Offline

Joined: May 10th, 2007, 2:52 am
Posts: 194
Location: China/ Canada
Code:
#f::MsgBox, 64, Explorer Check, % ExplorerCheck()
#m::CHDIR("A_MyDocuments", "1")
#p::CHDIR("ProgramFiles","0")
#w::CHDIR("A_WinDir")

CHDIR(PathName = "A_MyDocuments", Option = 0)
{
 IfNotExist, %PathName%
 {
  IfNotInString, PathName, :\
   _cd_p_n_c := %PathName%
  IfNotExist, %_cd_p_n_c%
  {
   msgbox, 48, CHDIR Utility, %PathName% could not be used atm
   return
  }
  Else
   PathName := _cd_p_n_c
 }
 IfWinExist, ahk_class CabinetWClass
 {
  ControlSetText, Edit1, %PathName%
  ControlSend, Edit1, {Enter}
 }
 Else if Option <> 0
  Run, explorer.exe /e %PathName%, %A_WinDir%
}

ExplorerCheck(WindowName = "List", Option = 0)
{
 global _func_e_c_s, _func_e_c_f, _func_e_c_p, _func_e_c_msgbox
 Loop, Parse, Option
  if A_LoopField is number
   _func_e_c_n0 := _func_e_c_n0 A_LoopField
  Else
   break
 _func_e_c_n := 0
 If WindowName <> List
  WinGet, WindowCheck, List, %WindowName%
 Else if WindowName = List
  WinGet, WindowCheck, List
 Loop, %WindowCheck%
 {
  WindowCheck0 := WindowCheck%A_Index%
  WinGetClass, WindowCheck, ahk_id %WindowCheck0%
  If WindowCheck = CabinetWClass
  {
   _func_e_c_n += 1
   If (_func_e_c_n - _func_e_c_n0 = 1)
    Goto, _ExplorerCheck_g_info_file_path
  }
 }
 return
 _ExplorerCheck_g_info_file_path:
 ControlGet, _func_e_c_s, List, Selected Col1, SysListView321, ahk_id %WindowCheck0%
 ControlGet, _func_e_c_f, List, Focused Col1, SysListView321, ahk_id %WindowCheck0%
 ControlGetText, _func_e_c_p, Edit1, ahk_id %WindowCheck0%
 If _func_e_c_p
  _func_e_c_msgbox := "Folder:   " _func_e_c_p
 Else
  _func_e_c_msgbox =
 If _func_e_c_f
  _func_e_c_msgbox .= "`nFocus:    " _func_e_c_f
 If _func_e_c_s
  _func_e_c_msgbox .= "`n<Selected Items>`n" _func_e_c_s
 if Option is not digit
  Msgbox, 64, File Check, %_func_e_c_msgbox%
 return _func_e_c_msgbox
}

_________________
Sakurako ^_^


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: ELengefeld and 3 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