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 

create new folder script

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



Joined: 05 Oct 2006
Posts: 423

PostPosted: Sat Mar 22, 2008 12:50 pm    Post subject: create new folder script Reply with quote

hello

this is Titan's script that creates new folder on double click:

Code:
#IfWinActive ahk_class CabinetWClass ; the ahk_class of explorer windows
; hotkeys here will only work when explorer windows are active

~LButton:: ; the left mouse button
SetKeyDelay, , 50 ; seems to be needed for SendEvent to work
MouseGetPos, , , , ctrl ; get the control under the mouse cursor
ControlGet, sel, List, Count Selected, SysListView321, A ; get the number of items selected
If DllCall("GetDoubleClickTime") > A_TimeSincePriorHotkey ; if: this is a double-click,
   and A_ThisHotkey = A_PriorHotkey ; the last hotkey pressed is the same as this one,
   and ctrl = "SysListView321" ; the control under the mouse cursor is the ListView,
   and sel = 0 ; and no items (files or folders) are selected then...
   SendEvent, !fwf ; Send Alt+F > N > F (File > New > Folder) - WinMenuSelectItem doesn't work for me
Return

#IfWinActive


the problem is that it creates new folder when you double click on the title bar of the window of a folder

specificaly, it creates it when you double click there to maximize the window and NOT when you click there to minimize the window

you may wonder why this happens... well it is because when you double click there to maximize the window, just afterwards the cursor is inside the 'listview' and thus it triggers new folder creation

on the other hand, when you double click there to minimize the window, the cursor, just afterwards, is NOT inside the listview, thus it doesn't trigger new folder creation

so what I consider to do is, either to limit the script to work when I double click on 'white' area (as well as when I click in listview area), since the title bar is blue

or there would be a better way?

thanks
Back to top
View user's profile Send private message
user



Joined: 05 Oct 2006
Posts: 423

PostPosted: Fri Mar 28, 2008 2:24 am    Post subject: Reply with quote

anyone?
Back to top
View user's profile Send private message
System Monitor



Joined: 09 Mar 2007
Posts: 392
Location: Unknown

PostPosted: Fri Mar 28, 2008 2:29 am    Post subject: Reply with quote

You could change the hotkey to something like Win-n
_________________
Back to top
View user's profile Send private message Visit poster's website
user



Joined: 05 Oct 2006
Posts: 423

PostPosted: Sat Mar 29, 2008 12:13 am    Post subject: Reply with quote

System Monitor wrote:
You could change the hotkey to something like Win-n


not intended
Back to top
View user's profile Send private message
HuBa



Joined: 24 Feb 2007
Posts: 172
Location: Budapest, Hungary

PostPosted: Sat Mar 29, 2008 2:21 am    Post subject: Reply with quote

Check if the SysListView321 has the focus with ControlGetFocus.

And check if the mouse cursor is within the boundaries of the SysListView321 with MouseGetPos.
Back to top
View user's profile Send private message Visit poster's website
user



Joined: 05 Oct 2006
Posts: 423

PostPosted: Sat Mar 29, 2008 2:56 am    Post subject: Reply with quote

HuBa wrote:
Check if the SysListView321 has the focus with ControlGetFocus.

And check if the mouse cursor is within the boundaries of the SysListView321 with MouseGetPos.


it already does both

what it needs to be done is to check these at the time of the first click AND at the time of the second click, because now it only checks them at the time of the second click
Back to top
View user's profile Send private message
Guest






PostPosted: Thu Apr 03, 2008 3:17 am    Post subject: Reply with quote

move the MouseGetPos line and the ControlGet line after the if statement so they only get called on the first click
Back to top
Display posts from previous:   
Post new topic   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