andybodiam Posted March 9, 2018 Share Posted March 9, 2018 Hi Everyone, Very new to this and looking for a solution to what appears to be a simple task. I have a program that is set to start with Windows using the startup folder ( ACDSee 17 ) After about 20 seconds or so, I want to be able to send keystroke Control+S to ACDsee to start the slideshow. Using AutoIt i can start the program by using :- Run ("C:\Program Files (x86)\ACD Systems\ACDSee\17.0\ACDSee17.exe") and I can introduce a delay using Sleep (20000). At this point I want to send Control+S but having no luck, tried Send ^S but no avail. Any assistance gratefully received Andy Link to comment Share on other sites More sharing options...
xcaliber13 Posted March 9, 2018 Share Posted March 9, 2018 Have you tried WinActivate to make sure your send is going to the correct window? Link to comment Share on other sites More sharing options...
Bilgus Posted March 10, 2018 Share Posted March 10, 2018 Rather than using ACDSee checkout XNVIEW https://newsgroup.xnview.com/viewtopic.php?f=35&t=37141 Local $PathXnview = "D:\XnView-win\XnView\xnview.exe" Local $Switches = "-slide" Local $Slideshow= "D:\pix.sld" ; Run If Not(WinExists("[CLASS:SlideClass]")) Then Run(Chr(34) & $PathXnview & Chr(34) & " " & $Switches &" " & Chr(34) & $Slideshow & Chr(34),"") WinWait("[CLASS:SlideClass]","",10) Local $Stat=WinWaitActive("[CLASS:SlideClass]","",10) If $Stat = 0 Then WinActivate("[CLASS:SlideClass]") EndIf Then to close WinClose("[CLASS:SlideClass]") I made a wall hanging photo frame and had nothing but trouble with acdsee and a few other programs till I came across xnview that was the only one that truly worked without fail pix.sld will be made inside the program and it will define the folders to look in you can also set it up to automatically display new pictures Link to comment Share on other sites More sharing options...
Zedna Posted March 10, 2018 Share Posted March 10, 2018 Instead of sending Ctrl+S rather use WinMenuSelectItem() Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
andybodiam Posted March 14, 2018 Author Share Posted March 14, 2018 Apologies for not responding sooner. Thank you for your suggestions and tips. I looked at XNView and that worked fine but its ACDSee I want to stick with. Sorry to say my understanding of this is very low, looking at WinActivate has simply confused me a bit more, I get "Angelina - ACDSee 17" as title and "Afx:00400000:0:00000000:00900015:00121629" as class using WIndow Info and then I'm lost. Tried using WinMenuSelectItem() but that didn't seem to work either, program starts OK but thats all. So not really any further.... Just amazed there is no simple way to send a couple of keystrokes. Thanks anyway Andy Link to comment Share on other sites More sharing options...
Bilgus Posted March 14, 2018 Share Posted March 14, 2018 (edited) Now depending on how stable that title and class are you should be able to match the title pretty easily $hWnd = Winwait("[REGEXPTITLE:(?i)(.*ACDSEE 17.*);REGEXPCLASS:(.*Afx:.*)]") If $hWnd Then ;While Not WinActive(....);You could also do it repeatedly till your desired window shows up ControlSend ($hWnd, "", "", "^s") ;Sleep(100) ;Wend EndIf Alternatively If you run the file directly from inside the script you should get a PID and you can get a list of the windows owned by the process to try and send a command to #include <Array.au3> #include <WinAPIProc.au3> Local $hPID = Run ("C:\Program Files (x86)\ACD Systems\ACDSee\17.0\ACDSee17.exe") Local $hWnd, $sClass if $hPid Then Local $aData = _WinAPI_EnumProcessWindows($hPid, 0) _ArrayDisplay($aData, '_WinAPI_EnumProcessWindows') For $i = 1 to UBOUND($aData, 1); 1 = Rows in array $hWnd = $aData[$i][0] $sClass = $aData[$i][1] If $hWnd Then ;If Stringinstr($sClass, "...") Then ... ControlSend ($hWnd, "", "", "^s") Sleep(100) ;If WinActive(....) Then ExitLoop Endif ;Wend EndIf Next Endif Edited March 14, 2018 by Bilgus ControlSend ( "title", "text", controlID, "string" [, flag = 0] ) Link to comment Share on other sites More sharing options...
Bilgus Posted March 14, 2018 Share Posted March 14, 2018 (edited) Once your desired window has become existent you can then activate it WinActivate($hWnd) ;or WinSetState($hWnd, "", @SW_MAXIMIZE) ;or set it ontop WinSetOnTop($hWnd, "", 1) Edited March 14, 2018 by Bilgus Link to comment Share on other sites More sharing options...
Earthshine Posted March 14, 2018 Share Posted March 14, 2018 Use the info tool and poke around. Post the data from that. That app may not support automation for all we know My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
Bilgus Posted March 14, 2018 Share Posted March 14, 2018 Back When I tried it failed more often than not and I wanted something rocksolid that ended up being xnview since it has a commandline interface but its been years and years ago Link to comment Share on other sites More sharing options...
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