Cadhlaureen Posted March 28, 2020 Posted March 28, 2020 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.
TheXman Posted March 29, 2020 Posted March 29, 2020 Maybe the WinList function can provide the information you're looking for. CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman
Cadhlaureen Posted March 29, 2020 Author Posted March 29, 2020 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?
Nine Posted March 29, 2020 Posted March 29, 2020 (edited) 3 hours ago, Cadhlaureen said: Is there a winlist count function? Yes. Open help file, it will explain everything you need to know and even more. Edited March 29, 2020 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
Cadhlaureen Posted March 30, 2020 Author Posted March 30, 2020 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.
Aelc Posted March 30, 2020 Posted March 30, 2020 (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 Edited March 30, 2020 by Aelc why do i get garbage when i buy garbage bags?
Cadhlaureen Posted March 31, 2020 Author Posted March 31, 2020 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 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.
Aelc Posted March 31, 2020 Posted March 31, 2020 (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 March 31, 2020 by Aelc why do i get garbage when i buy garbage bags?
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now