AutoHotkey Community

It is currently May 26th, 2012, 8:56 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 9 posts ] 
Author Message
PostPosted: July 10th, 2008, 11:52 am 
Offline

Joined: June 29th, 2008, 1:43 pm
Posts: 40
Basic problem is with Photoshop.
When I click on the photo being edited, Window spy shows: ahk_class Photoshop
But if I click in the tools palette or the history palette or the layers palette, Window spy shows: ahk_class PSFloatC

A super simple example script is:
Code:
#IfWinActive ahk_class Photoshop
F1::^0  ;Ctrl-zero, Fit photo on screen.
F2::!^0 ;Alt-ctrl-zero, View actual pixels.
#IfWinActive


So my problem is that the F1 and F2 hotkeys work fine if the last place I worked was on the photo when those hotkeys are pressed. But if I happened to click on the history palette or other floating palette, the #IfWinActive does not recognize Photoshop anymore.

One way I found to always change the ahk_class PSFloatC back to ahk_class Photoshop is if I press alt-F to select the File menu and then press Escape to get rid of the File menu.

With the above information, can anyone figure out a way to get my Photoshop hotkeys to work even if the last place I clicked was on a floating palette?

Thanks,
Skyglider


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 10th, 2008, 12:22 pm 
Offline

Joined: June 9th, 2008, 2:32 am
Posts: 936
Location: Canada
when u open the program, enter the first few words in the top left corner of the window... Window SPY sometimes dosn't work or you clicked on the actual script you where using because u got "ahk_class".

_________________
Image
I know i have 6 legs. It's cuz I'm special.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 10th, 2008, 2:13 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
Something like following should work:

Code:
SetTitleMatchMode RegEx       

#IfWinActive ahk_class PSFloatC|Photoshop
F1::^0  ;Ctrl-zero, Fit photo on screen.
F2::!^0 ;Alt-ctrl-zero, View actual pixels.
#IfWinActive


:)

_________________
URLGet - Internet Explorer based Downloader
StartEx - Portable Shortcut Link


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 10th, 2008, 8:31 pm 
Offline

Joined: June 29th, 2008, 1:43 pm
Posts: 40
SpiderGames wrote:
when u open the program, enter the first few words in the top left corner of the window... Window SPY sometimes dosn't work or you clicked on the actual script you where using because u got "ahk_class".

I don't know what you mean by your first sentence. When I open Photoshop, it displays the browser window with thumbnails of all of the photos in a folder. Then I double click the photo I want to edit and go from there.

To get the window spy arguments I did this:

- Open window spy. It is blank.
- Click on the photo being edited. It shows the ahk_class Photoshop.
- Click on any floating palette. It shows the ahk_class PSFloatC.

Thanks,
Skyglider


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 10th, 2008, 10:25 pm 
Offline

Joined: June 29th, 2008, 1:43 pm
Posts: 40
SKAN wrote:
Something like following should work:

Code:
SetTitleMatchMode RegEx       

#IfWinActive ahk_class PSFloatC|Photoshop
F1::^0  ;Ctrl-zero, Fit photo on screen.
F2::!^0 ;Alt-ctrl-zero, View actual pixels.
#IfWinActive


:)


Hi SKAN,
I tried your code and it loads without errors but then the F1 and F2 keys don't work at all.
Just in case it makes a difference, I'm using two scripts. The first script is an autohotkeymain.ahk script which includes the photoshop.ahk script as follows:

Code:
;This is the autohotkeymain.ahk script

;===== Setup =====
#InstallKeybdHook
SetTitleMatchMode 2

;===== Function key hotkeys common to all programs =====
F7::Send, ^s    ;Save
F8::Delete        ;Delete key

;===== The #Include causes scripts to behave as if they are in these exact locations =====
#Include InternetExplorer.ahk
#Include OutlookExpress.ahk
#Include Photoshop.ahk


Code:
;This is a simplified Photoshop script.
SetTitleMatchMode RegEx

;===== PHOTOSHOP SCRIPT =====
#IfWinActive ahk_class PSFloatC|Photoshop
F1::^0  ;ctrl+zero - Fit photo on screen
F2::!^0 ;alt-ctrl-zero - view actual pixels
#IfWinActive


Thanks,
Skyglider


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 10th, 2008, 11:22 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
Try photoshop.ahk as standalone. You cannot mix different SetTitleMatchMode, I guess. :)

_________________
URLGet - Internet Explorer based Downloader
StartEx - Portable Shortcut Link


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 10th, 2008, 11:49 pm 
Offline

Joined: June 29th, 2008, 1:43 pm
Posts: 40
SKAN wrote:
Try photoshop.ahk as standalone. You cannot mix different SetTitleMatchMode, I guess. :)


SKAN,

I removed the SetTitleMatchMode 2 from the autohotkeymain.ahk script. But the F1 and F2 keys still don't work in Photoshop.

As a work around, I created two idential Photoshop scripts and named them:
PhotoshopNormal.ahk
-and-
PhotoshopFloat.ahk.

The only difference is the #IfWinActive in in each. One is for Photoshop and the other is for PSFloatC. This allows the F1 and F2 keys to work regardless of whether the focus is on the photo or a floating palette but it requires me to update two scripts if any changes are made to my Photoshop script.

Any other ideas on how to do what I need using only one photoshop script would be great.

Thanks,
Skyglider


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 10th, 2008, 11:56 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
Skyglider wrote:
As a work around, I created two idential Photoshop scripts and named them:


No need for seperate scripts.. put them together. It will work.

Code:
#IfWinActive ahk_class PSFloatC
F1::^0  ;ctrl+zero - Fit photo on screen
F2::!^0 ;alt-ctrl-zero - view actual pixels
#IfWinActive

#IfWinActive ahk_class Photoshop
F1::^0  ;ctrl+zero - Fit photo on screen
F2::!^0 ;alt-ctrl-zero - view actual pixels
#IfWinActive


:)

_________________
URLGet - Internet Explorer based Downloader
StartEx - Portable Shortcut Link


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 11th, 2008, 12:43 am 
Offline

Joined: June 29th, 2008, 1:43 pm
Posts: 40
SKAN wrote:
Skyglider wrote:
As a work around, I created two idential Photoshop scripts and named them:

No need for seperate scripts.. put them together. It will work.

Code:
#IfWinActive ahk_class PSFloatC
F1::^0  ;ctrl+zero - Fit photo on screen
F2::!^0 ;alt-ctrl-zero - view actual pixels
#IfWinActive

#IfWinActive ahk_class Photoshop
F1::^0  ;ctrl+zero - Fit photo on screen
F2::!^0 ;alt-ctrl-zero - view actual pixels
#IfWinActive

:)

Thanks for the help SKAN.

Using the method above, I will still have to duplicate my Photoshop script twice which is what I'm trying to avoid. What I'm trying to accomplish is similar to what you proposed earlier by using an OR function in the #IfWinActive command.

Something like:
#IfWinActive ahk_class Photoshop OR PSFloatC
But this does not work.

I also tried
#IfWinActive ahk_class Photoshop OR #IfWinActive ahk_class PSFloatC
But this did not work either.

Thanks again,
Skyglider


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google [Bot], kkkddd1, poserpro and 71 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