woodruff1606 Posted November 16, 2008 Share Posted November 16, 2008 Hello, I just started using AutoIt to automate all my wonderful daily tasks. I LOVE AutoIt! But I have a question for the pros. Is there a way to query an opened process to see if it has any BUTTONs then returns the value of the buttons if it does? if so what functions would I use? I'm trying to create a program that lists all programs installed(vista), then uninstalls the chosen ones. I know I got my work cut out for me... any advice? I'm still pretty new to programming/scripting in general. I've been reading up and I've learned alot. is this something that would be to hard to develop? If not what would be beneficial for me to research? Thanks for your time in reading my post Matt W. Link to comment Share on other sites More sharing options...
Glyph Posted November 16, 2008 Share Posted November 16, 2008 (edited) Should be a way to list the installed programs from an array (from WMI a DLL or Registry / not sure.) Then, use a command to uninstall them, based on the program names that are returned. Off the top of my head I don't know how. But, I hope that points you in the right direction! Manually uninstalling the applications from the GUI (for every program) would become pretty ridiculous. Edited November 16, 2008 by Glyph tolle indicium Link to comment Share on other sites More sharing options...
PsaltyDS Posted November 17, 2008 Share Posted November 17, 2008 Processes don't have buttons, windows do: $iPID = Run("Calc.exe") WinWait("Calculator") $sClassList = WinGetClassList("Calculator", "") MsgBox(64, "Text read was:", $sClassList) ProcessClose($iPID) Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
woodruff1606 Posted November 17, 2008 Author Share Posted November 17, 2008 Is there any way to get the text values of the buttons from a window? wingetclasslist() returns a string and not an array from the looks of it.. apologies for my bad terminology. Thanks for the help btw Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 17, 2008 Moderators Share Posted November 17, 2008 ControlGetText() ... Use AutoInfo.exe tool to get the ClassNameNN or ControlID. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
PsaltyDS Posted November 17, 2008 Share Posted November 17, 2008 Is there any way to get the text values of the buttons from a window? wingetclasslist() returns a string and not an array from the looks of it.. apologies for my bad terminology. Thanks for the help btwWinGetClassList() returns a list of classes present in the window. You have to check the string to see if there are "Button" classes present. That allows you to answer the first original question: "...to see if it has any BUTTONs...". Enumerating all the instances of a single class has bee posted before, search the forum. And SmOke_N pointed out how to read the text once you identify the control.This is all a waste of time if you already know exactly what button you are looking for, but that was not the impression I got from the OP. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Juvigy Posted November 17, 2008 Share Posted November 17, 2008 I didnt get why you need some buttons. I thought you need to uninstall some programs? Check this out: Func WMIService($host);Connects to WMI Service $objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $host & "\root\cimv2") If not IsObj($objWMIService) Then return 0 return $objWMIService EndFunc Func WMIQuery($objWMIService,$strWMIQuery);Perform WMI Query with Query String and Data Return Parameters $colItems = $objWMIService.ExecQuery($strWMIQuery) ;Execute query against WMI Service Object For $objItem in $colItems MsgBox(0,"asdasd",$objitem.name) ;$objItem.Uninstall() Next return 1 EndFunc $objWMIService = WMIService("localhost") ;WMIService Object - Establish Connection If $objWMIService = 0 Then Exit $soft2 = WMIQuery($objWMIService,"Select * from Win32_Product Where Name like '%adobe%'") If $objWMIService = 0 Then Exit $objWMIService = 0 ;Termninate WMIService Object This will remove the software you like just replace "adobe" with something else and uncomment the uninstall line... Link to comment Share on other sites More sharing options...
woodruff1606 Posted November 17, 2008 Author Share Posted November 17, 2008 Well its not always the same software. If i went thru and made an automated unistaller for every piece of software I have to uninstall It would take forever. and I would have to create a new one each time a new version of the software came out. I'll quit posting on the forum and figure it out myself. Thanks for the help up to this point tho. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 17, 2008 Moderators Share Posted November 17, 2008 Well its not always the same software. If i went thru and made an automated unistaller for every piece of software I have to uninstall It would take forever. and I would have to create a new one each time a new version of the software came out. I'll quit posting on the forum and figure it out myself. Thanks for the help up to this point tho.All I can say is ... Anyway, if you're writing an "uninstaller" for common applications... Typically they have a silent uninstall that is much faster, and usually just a 1 liner in autoit ... Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. 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