Jump to content

Recommended Posts

Posted

What I'm trying to do is have autoit check to see if Photoshop.exe is running, and if it is - to input F3 and F4 into photoshop. So far I have this -

$StartTimer = TimerInit()
$process = "Photoshop.exe"
Checkprocess ()
While 1
    if TimerDiff($StartTimer) > 60000 Then
        Checkprocess()
    Endif
    Sleep(10)
WEnd
Func Checkprocess()
    if ProcessExists("photoshop.exe") Then
        Winactivate("[CLASS:Photoshop]", "")
        Sleep(1)
        Send("{F4}")
        Sleep(1)
        Send("{F3}")
    Endif
EndFunc
Exit

This works, but I'm sure someone else can see - once photoshop is running, it does run the hotkeys I need it to, but it loops the SEND until the script is manually ended.

I believe this is because there is no check to see if the function has performed. Obviously I need it to have a condition to end the function, however this is where I run into problems.

Photoshop has a "welcome" screen of sorts, where you can choose to work on previous files, or start a new one. In this welcome area hotkeys are disabled because there is nothing to apply them to, as a file isn't open yet. If I enter a condition for the SEND to be applied once, it may try to send while on this screen and would do nothing. I could put a timer so that I have time to select something within photoshop, but what I think would be better is if I used a check in Autoit to look for three windows within the Class Photoshop, and if there is - to end the script. The hotkeys I have set up open up a cloned file of the working file, and then split both files into floating windows so that another recording program I'm using can see the secondary window and start recording.

I don't know if this is possible, one of the issues I'm running into is that each active "window" within photoshop will obviously have it's file name, so I can't set it to look for specific windows, I need it to look at the number of windows open in the class.

I'm very new to this, and this is the only use of Autoit I will be using, so I'm trying to learn as I go, but I've hit a wall with my googling.

Posted

Maybe the WinList function can provide the information you're looking for.

Posted

Okay, I don't really understand how it works. So I would need to pull a list of the windows, and then specify a count based on the windows pulled, and then have it end the script. Is there a winlist count function?

Posted

Can someone provide an example maybe of how it would work with windows in a Class?  Both of the examples listed on the help files page are for specifically named windows. I cannot define names of the windows, as each window will have a unique name.

 

I learn better through examples. I have opened the help file, I am not a programmer.

Posted (edited)

i tried to do something with autoit and photoshop too... 

There is like a random name for some windows which arent easy to get.

i dont know what exactly i did but it was a long way ...

i ll look on my laptop where the script should be

but for your problem it could exist another way... 

i mean you could unload the checkprocess when the sends are done until photoshop.exe doesnt exist anymore...

something like

$StartTimer = TimerInit()
$load = True
$process = "Photoshop.exe"
Checkprocess ()
While 1
    if TimerDiff($StartTimer) > 60000 Then
        Checkprocess()
    Endif
    Sleep(10)
WEnd
Func Checkprocess()
    if ProcessExists("photoshop.exe") And $load = True Then
        Winactivate("[CLASS:Photoshop]", "")
        Sleep(1)
        Send("{F4}")
        Sleep(1)
        Send("{F3}")
        $load = False
    Endif
    If Not ProcessExists("photoshop.exe") Then $load = True
EndFunc
Exit

actually i dunno why you got the timerdiff there :D

Edited by Aelc

why do i get garbage when i buy garbage bags? <_<

Posted
20 hours ago, Aelc said:

i tried to do something with autoit and photoshop too... 

There is like a random name for some windows which arent easy to get.

i dont know what exactly i did but it was a long way ...

i ll look on my laptop where the script should be

but for your problem it could exist another way... 

i mean you could unload the checkprocess when the sends are done until photoshop.exe doesnt exist anymore...

something like...

actually i dunno why you got the timerdiff there :D

So this works, and doesn't load a million separate windows, but it only works if the script is run after photoshop starts and I have my file open in photoshop, which kind of defeats the purpose. I have no idea why I had the timerdiff in there honestly, I don't know what I'm doing.

Posted (edited)

well actually i dont know why you have to start it after...

maybe i got something wrong ?

am i right you still want to start photoshop and NOT a document of it?

 

- so you could start photoshop from script

 

- If you want to start a .pho or some other files you could write a bypass to start it with your script and this is starting photoshop with the file where it can wait for the window

 

* wait did you click on the layered window while the timer run? 

Edited by Aelc

why do i get garbage when i buy garbage bags? <_<

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...