fchelp Posted February 8, 2018 Share Posted February 8, 2018 Hi, i'm new to autoit and am learning to play around with it. I'm trying to make a script that would automatically make program full screen, the keyboard shortcut from the program is CTRL + f, so i wrote this script WinActivate("[CLASS:#32770]", "") Send("^f") WinActivate works perfect, it activates the correct program, but send ctrl+f doesn't work, nothing happens. Thanks in advance. Link to comment Share on other sites More sharing options...
Earthshine Posted February 8, 2018 Share Posted February 8, 2018 gonna need more code than that to test anything. what application are you trying to automate? My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
jdelaney Posted February 8, 2018 Share Posted February 8, 2018 (edited) popups can't become full screen. I take that back, they can be, but applications are generally not only a popup, they have some primary window, which is probably what you really want to be full screen, yes? Edited February 8, 2018 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
fchelp Posted February 8, 2018 Author Share Posted February 8, 2018 Thanks so much for the quick help 1 minute ago, Earthshine said: gonna need more code than that to test anything. what application are you trying to automate? Vivotek Live Client. (it's a CCTV camera viewer) Just now, jdelaney said: popups can't become full screen. It's not a popup, and even more the program has a button and a keyboard shortcut to make it full screen. Link to comment Share on other sites More sharing options...
jdelaney Posted February 8, 2018 Share Posted February 8, 2018 (edited) You are activating a popup...that's what class:32770 is. Use the spy tool, and try again. Also, popups are generally blockers, so when present, you can't send to the main window. You'll need to close them. Edited February 8, 2018 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
Earthshine Posted February 8, 2018 Share Posted February 8, 2018 CLASS 32770 is a Dialog box. They do pop up to tell us things. My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
fchelp Posted February 8, 2018 Author Share Posted February 8, 2018 (edited) On 2/8/2018 at 0:00 PM, jdelaney said: You are activating a popup...that's what class:32770 is. Use the spy tool, and try again. I'm selecting the the header of the program. Thanks! Edited February 12, 2018 by fchelp Link to comment Share on other sites More sharing options...
Earthshine Posted February 8, 2018 Share Posted February 8, 2018 try this WinWait("[CLASS:#32770]", "") Send("^f") fchelp 1 My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
jdelaney Posted February 8, 2018 Share Posted February 8, 2018 (edited) What an odd application. Does the spy tool grab the controls inside it? Maybe change the rate at which the keys are pressed: AutoItSetOption Or, just try to get the window handle, and make it full screen WinSetState ( "title", "text", flag ) Also, that class of window is probably in use by many of your applications...you'll need to do winlist, and loop through the returned array to find the one specific to your application. Probably better just to use the title to grab it. WinGetHandle("LiveClient") Last edit: get the handle returned from your function, and consolewrite it, then compare it against the spy tool's handle. If they are not the same, then you are grabbing the wrong popup. Edited February 8, 2018 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
fchelp Posted February 8, 2018 Author Share Posted February 8, 2018 4 minutes ago, Earthshine said: try this WinWait("[CLASS:#32770]", "") Send("^f") Thanks! but it's doesn't work, it doesn't even pause the script to wait for the program to be active, it just quits. 2 minutes ago, jdelaney said: What an odd application. Does the spy tool grab the controls inside it? Maybe change the rate at which the keys are pressed: AutoItSetOption Or, just try to get the window handle, and make it full screen WinSetState ( "title", "text", flag ) What Should i set the AutoItSetOption? Sorry but how do i use this code? WinSetState ( "title", "text", flag ) Thank in advance Link to comment Share on other sites More sharing options...
jdelaney Posted February 8, 2018 Share Posted February 8, 2018 (edited) $hWindow = WinGetHandle("LiveClient") ConsoleWrite($hWindow & @CRLF) WinSetState($hWindow,"",@SW_MAXIMIZE) Look at the help file for autoitsetoptions...the key send ones. There is one for the break between character sends, and one for the length of the send of each character. When the functions are in codeblocks, you can click them to see the helpfile...or if they are in scite, click them, and press F1 to see the helpfile. Edited February 8, 2018 by jdelaney fchelp and Earthshine 2 IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
fchelp Posted February 8, 2018 Author Share Posted February 8, 2018 15 minutes ago, jdelaney said: What an odd application. Does the spy tool grab the controls inside it? Maybe change the rate at which the keys are pressed: AutoItSetOption Or, just try to get the window handle, and make it full screen WinSetState ( "title", "text", flag ) Also, that class of window is probably in use by many of your applications...you'll need to do winlist, and loop through the returned array to find the one specific to your application. Probably better just to use the title to grab it. WinGetHandle("LiveClient") Last edit: get the handle returned from your function, and consolewrite it, then compare it against the spy tool's handle. If they are not the same, then you are grabbing the wrong popup. Thanks but my issue is not about maximizing the window, it's about running a keyboard shortcut in the program. WinActivate ("[CLASS:#32770]", "") finds the correct program, so no worries there (i see that LiveClient become the active window), my issue is that for some reason the shortcut doesn't run in the program what could be the reason? Thanks Link to comment Share on other sites More sharing options...
jdelaney Posted February 8, 2018 Share Posted February 8, 2018 (edited) Welcome to the world of Send(). It is not reliable. Could be any number of things. Use ControlClick for best results, if possible. Edited February 8, 2018 by jdelaney fchelp 1 IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
Earthshine Posted February 8, 2018 Share Posted February 8, 2018 try pressing that button that makes it go full screen that you pointed out. What does the Info Tool say about that? fchelp 1 My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
fchelp Posted February 8, 2018 Author Share Posted February 8, 2018 2 minutes ago, jdelaney said: Welcome to the world of Send(). It is not reliable. Could be any number of things. Use ControlClick for best results, if possible. I'm going to try using ControlClick again (i tried it before and it didn't work, so i deleted the code, now i have to rewrite it) 1 minute ago, Earthshine said: try pressing that button that makes it go full screen that you pointed out. What does the Info Tool say about that? Thanks! Link to comment Share on other sites More sharing options...
Earthshine Posted February 8, 2018 Share Posted February 8, 2018 does it work? My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
fchelp Posted February 8, 2018 Author Share Posted February 8, 2018 1 minute ago, Earthshine said: does it work? I just tried this WinActivate ("[CLASS:#32770]", "") WinWait("[CLASS:#32770]", "") ControlClick ( "[CLASS:#32770]", "", "[ID:254]" ) And it didn't work Link to comment Share on other sites More sharing options...
jdelaney Posted February 8, 2018 Share Posted February 8, 2018 (edited) Your screenshot is for a different ID...try: $hWindow = WinGetHandle("LiveClient") ConsoleWrite($hWindow & @CRLF) WinSetState($hWindow,"",@SW_MAXIMIZE) $hControl = ControlGetHandle($hWindow,"",134) ConsoleWrite($hControl & @CRLF) ControlClick($hWindow,"",$hControl) Verify the console outputed handles are the proper ones in the spy tool. Note: I am intentionally removing the class as the window identifier, because that's so generic it can grab a ton of windows, which may cause you debugging nightmares later. Edited February 8, 2018 by jdelaney Earthshine and fchelp 2 IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
fchelp Posted February 8, 2018 Author Share Posted February 8, 2018 54 minutes ago, jdelaney said: Your screenshot is for a different ID...try: $hWindow = WinGetHandle("LiveClient") ConsoleWrite($hWindow & @CRLF) WinSetState($hWindow,"",@SW_MAXIMIZE) $hControl = ControlGetHandle($hWindow,"",134) ConsoleWrite($hControl & @CRLF) ControlClick($hWindow,"",$hControl) Verify the console outputed handles are the proper ones in the spy tool. Note: I am intentionally removing the class as the window identifier, because that's so generic it can grab a ton of windows, which may cause you debugging nightmares later. Thanks so so much!! this works! Is there a way to read the value of a variable? (i want to compare the Handle and Control ID the script finds and the spy tool find are the same) Thanks Link to comment Share on other sites More sharing options...
Earthshine Posted February 8, 2018 Share Posted February 8, 2018 (edited) i verify by making sure that the handle i have, there is a control with text that I search for to know I have the right one. not sure if ID is way to go but do try and post back. in your example, you only have ID, no text, but you could also check that the text was an empty string = "" Edited February 8, 2018 by Earthshine My resources are limited. You must ask the right questions 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