 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
djodjolyon
Joined: 12 May 2008 Posts: 21
|
Posted: Mon May 12, 2008 4:14 pm Post subject: [Solved] Make hotkey to open a file with a specific software |
|
|
Hello everybody,
I'm just beginning with AutoHotkey. So that's why I'm asking you...
I want to open a jpg file in photoshop with a hotkey.
I already made a script but it doesn't really work because when Photoshop try to open the file, most of the time he doesn't find it. Because I don't have the all path name copied in the field but only the file's name. So, if the picture isn't in the folder that photoshop open by default, he can't open it.
I would really appreciate if you can help me.
Perhaps there is an easy way to make that removing all that copy/paste things.
Thank you...
Here is the code :
| Code: | #NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%
SetTitleMatchMode, 2
SetKeyDelay, 100
SetMouseDelay, 200
; hotkey :ctrl+alt+p
^!p::
; renamme file
Send {F2}
; copy
Send ^c
; escape to cancel renamming
Send {Esc}
IfWinExist, Adobe Photoshop CS3 Extended
{
WinActivate, Adobe Photoshop CS3 Extended
}
else
{
Run, C:\Program Files\Adobe\Adobe Photoshop CS3\photoshop.exe
}
; wait until photoshop open
Sleep, 5000
; open a new file
Send ^o
; paste the file name
Send ^v
; open it
Send {Enter}
return |
Last edited by djodjolyon on Tue May 13, 2008 4:47 pm; edited 2 times in total |
|
| Back to top |
|
 |
BoBoĻ Guest
|
Posted: Mon May 12, 2008 11:59 pm Post subject: |
|
|
| Quote: | | Because I don't have the all path name copied in the field but only the file's name | TBH, I don't understand why? If you don't know the files current destination (or are not willing to provide its full path) how should PShop be able open it correctly??  |
|
| Back to top |
|
 |
sinkfaze
Joined: 19 Mar 2008 Posts: 138
|
Posted: Tue May 13, 2008 12:31 am Post subject: |
|
|
I don't think there's an easy way to automate the whole process strictly from AHK, but maybe it's possible to make a droplet that you can run from a command line(which can be run from AHK)? Unfortunately I don't know as I don't use PS that much. _________________ Have trouble searching the site for information? Try Quick Search for Autohotkey. |
|
| Back to top |
|
 |
Superfraggle
Joined: 02 Nov 2004 Posts: 770 Location: London, UK
|
Posted: Tue May 13, 2008 12:44 am Post subject: |
|
|
There is an easy way.
| Code: | #NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%
SetTitleMatchMode, 2
SetKeyDelay, 100
SetMouseDelay, 200
; hotkey :ctrl+alt+p
^!p::
; copy file details to clipboard
Send ^c
IfWinExist, Adobe Photoshop CS3 Extended
{
WinActivate, Adobe Photoshop CS3 Extended
}
else
{
Run, C:\Program Files\Adobe\Adobe Photoshop CS3\photoshop.exe
}
; wait until photoshop open
Sleep, 5000
; open a new file
Send ^o
; paste the file name
Send,{raw}%clipboard%
; open it
Send {Enter}
return |
Just copy the file as a file, AHK will translate the filedetails from the clipboard.
In fact probably better would be. This should hopefully open the file directly in photoshop without key strokes.
| Code: | #NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%
SetTitleMatchMode, 2
SetKeyDelay, 100
SetMouseDelay, 200
; hotkey :ctrl+alt+p
^!p::
; copy file details to clipboard
Send ^c
IfWinExist, Adobe Photoshop CS3 Extended
{
WinActivate, Adobe Photoshop CS3 Extended
; open a new file
Send ^o
; paste the file name
SendInput,{raw}%clipboard%
; open it
Send {Enter}
}
else
{
Run, C:\Program Files\Adobe\Adobe Photoshop CS3\photoshop.exe %clipboard%
}
; wait until photoshop open
Sleep, 5000
return |
It could be done even better than this, but I do not have photoshop to play around with to test it. _________________ Steve F AKA Superfraggle
http://r.yuwie.com/superfraggle |
|
| Back to top |
|
 |
djodjolyon
Joined: 12 May 2008 Posts: 21
|
Posted: Tue May 13, 2008 2:54 am Post subject: |
|
|
Thanks everybody.
And superfraggle. Great. Thanks a lot.
I took the second script you gave me...
It works well except one ore two thing, but not very important. It works most of the time...
I have tried the script about 30 times.
And 5 or 6 times it opens the wrong file. 2 times it opens the file that I just opened before. 2 other times it opens an other file that was in the same folder and an other time it open my jpg file in "camera raw"(serve for raw file, not for jpg)
I don't really understand why?
Can someone help me resolve this little thing?
And do I need the "Sleep 5000" now? I think I don't need it anymore, but not really sure... |
|
| Back to top |
|
 |
Superfraggle
Joined: 02 Nov 2004 Posts: 770 Location: London, UK
|
Posted: Tue May 13, 2008 3:21 am Post subject: |
|
|
No you dont need the sleep 5000 anymore, I left that in by mistake.
| Code: | #NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%
SetTitleMatchMode, 2
SetKeyDelay, 100
SetMouseDelay, 200
; hotkey :ctrl+alt+p
^!p::
ClipOld:=ClipboardAll
clipboard:="" ; Empty Clipboard
Send ^c
Clipwait,2
IfWinExist, Adobe Photoshop CS3 Extended
{
WinActivate, Adobe Photoshop CS3 Extended
; open a new file
Send ^o
; paste the file name
SendInput,{raw}%clipboard%
; open it
Send {Enter}
}
else
{
Run, C:\Program Files\Adobe\Adobe Photoshop CS3\photoshop.exe %clipboard%
}
Clipboard:=ClipOld
return |
That may be more reliable. _________________ Steve F AKA Superfraggle
http://r.yuwie.com/superfraggle |
|
| Back to top |
|
 |
djodjolyon
Joined: 12 May 2008 Posts: 21
|
Posted: Tue May 13, 2008 3:53 pm Post subject: |
|
|
Well,
Superfragger, I can't thank you as musch as I want.... Great job you made for me!
Works perfectly now.
I'm just a little bit disapointed beacause I don't understand everything you put in that code!
I would like to know more. But it's hard stuff!
BIG THANKS again. Have a good day
Jonathan |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|