AutoHotkey Community

It is currently May 25th, 2012, 3:55 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: September 14th, 2007, 4:38 pm 
Offline

Joined: July 20th, 2007, 5:49 am
Posts: 27
A few questions. I want to be copy path+filename text to the clipboard so I can paste it. But I'd like to do this only in an explorer shell.

Can anyone tell me why the first snippet doesn't work (but falls into the if), and the second one does?

Also is the test for an explorer shell a good way to test?

Code:
#^c::
WinGetActiveTitle, h_Title
WinGetClass, h_Class, %h_title%
WinGet, h_Application, ProcessName, %h_title%
If ( ( h_Application = "explorer.exe" ) and ( h_Class = "CabinetWClass" ) )
{
   Send, ^c
   ClipWait
   Sort, clipboard  ; This also converts to text (full path and name of each file).
   ;msgbox, yes %h_Class%`n%h_Application%`n%h_Title%
}
return


Code:
#^c::
   Send, ^c
   ClipWait
   Sort, clipboard  ; This also converts to text (full path and name of each file).
return


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 14th, 2007, 5:31 pm 
Offline

Joined: June 6th, 2006, 3:19 pm
Posts: 1654
Location: Denmark
On my PC i works with the class ExploreWClass

_________________
RegEx Powered Dynamic Hotstrings
COM
AutoHotkey 2


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 14th, 2007, 5:36 pm 
Offline

Joined: July 20th, 2007, 5:49 am
Posts: 27
So when you Ctrl-V in a text editor after running the hotkey, it outputs the copied text for you with that change?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 14th, 2007, 5:40 pm 
Offline

Joined: June 6th, 2006, 3:19 pm
Posts: 1654
Location: Denmark
Yes, tested with:
Code:
#^c::
WinGetActiveTitle, h_Title
WinGetClass, h_Class, %h_title%
WinGet, h_Application, ProcessName, %h_title%
If ( ( h_Application = "explorer.exe" ) and ( h_Class = "ExploreWClass" ) )
{
   Send, ^c
   ClipWait
   Sort, clipboard  ; This also converts to text (full path and name of each file).
   msgbox, yes %h_Class%`n%h_Application%`n%h_Title%
}
return

_________________
RegEx Powered Dynamic Hotstrings
COM
AutoHotkey 2


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

Joined: July 20th, 2007, 5:49 am
Posts: 27
I added the case for for correctness.

I've noticed that it works sometimes.

If I contually press the hotkey several times, it will work. Usually though, for a single press, the clipboard will not contain the text.

I tried a couple different hotkey combos with no luck, thought it might be the windows key messing something up.

The cursor always turns briefly to the hourglass, so it looks like its doing something even when it does't end up working.

Code:
^8::
WinGetActiveTitle, h_Title
WinGetClass, h_Class, %h_title%
WinGet, h_Application, ProcessName, %h_title%
If ( ( h_Application = "explorer.exe" ) and (( h_Class = "CabinetWClass" ) or ( h_Class = "ExploreWClass" )))
{
   Send, ^c
   ClipWait
   Sort, clipboard  ; This also converts to text (full path and name of each file).
   ;msgbox, yes %h_Class%`n%h_Application%`n%h_Title%
}
return


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

Joined: July 20th, 2007, 5:49 am
Posts: 27
Figured it out. It always worked the second time.

Had to ad a line:

Code:
clipboard = ; clear clipboard


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

Joined: June 6th, 2006, 3:19 pm
Posts: 1654
Location: Denmark
Forgot that, this is the example from the help file:
Code:
clipboard =  ; Start off empty to allow ClipWait to detect when the text has arrived.
Send ^c
ClipWait  ; Wait for the clipboard to contain text.
MsgBox Control-C copied the following contents to the clipboard:`n`n%clipboard%

_________________
RegEx Powered Dynamic Hotstrings
COM
AutoHotkey 2


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey, engunneer, ogrish, Pulover, rbrtryn, sarevok9, vsub, Zaelia and 26 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