boogieoompa Posted January 21, 2008 Posted January 21, 2008 Normally this has never been an issue before but I am having some segments of code check for window properties such as state and whether or not it exsists. However with my current code snipit the $size=wingetpos is notactually triping the error if statement. It is instead triggered witht he MsgBox. Basically I need to know what segements of my code errored otu by setting properies so if someone could be so kind as to explain what function willl check for errors without doing anything else other than perhaps set a variable Thank you $size = 0 Opt("WinTitleMatchMode", 2) $size = WinGetPos(".P343") if @error Then MsgBox(0,"","Please remove the appbar from docking mode" & @error); $position = 0 Else $position = 1 endif MsgBox(0, "Active window stats (x,y,width,height):", $size[0] & " " & $size[1] & " " & $size[2] & " " & $size[3] & " " & $position)
martin Posted January 21, 2008 Posted January 21, 2008 (edited) If the window is minimized then that could explain your problem. Then you would need this perhaps (not tested) $size = 0 Opt("WinTitleMatchMode", 2) $size = WinGetPos(".P343") if @error Or $size < 0 Then; might be better to have Or not IsArray($size) Then MsgBox(0,"","Please remove the appbar from docking mode" & @error); $position = 0 Else $position = 1 MsgBox(0, "Active window stats (x,y,width,height):", $size[0] & " " & $size[1] & " " & $size[2] & " " & $size[3] & " " & $position) endif EDIT:added option for If. Edited January 21, 2008 by martin Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
boogieoompa Posted January 22, 2008 Author Posted January 22, 2008 Thank you very much for your reply. That seemed to be it except i changed it from if @error Or $size < 0 to if @error Or $size = 0 since i set it to 0 just before and the wingetpos was not returning anything (which is what it is supposed to catch in this segment of code). Thank you
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