bourny Posted May 24, 2004 Share Posted May 24, 2004 I am running an uninstall of sophos and running into difficulty with adlibs. I have 2 windows that are not always present so I am using an adlib to look for them..... they seem to work but i cannot call 2 adlibs - 1 works but the other does not return back to the script I have done a similar thng with autoit v2 and placed all winwaitactive commands in a generic [adlib] section.... this has obviously changed under autoit v3 with functions... what i need answered is how to call more than 1 adlib per function script ***************************************************** func remove_sav() adlibenable("adlib1") *****I have tried declaring adlib inside and outside the adlibenable("adlib2") function SplashTextOn ("", "Anti Virus Uninstall - Do not touch your Keyboard or Mouse", 500, 20, -1 ,-1 ,1 ,"" ,"" ,"600") Run(c:\preogram files\sophos\setup.exe remove) WinActivate ( "SOPHOS Removal", "Sophos removal application") WinWaitActive ( "SOPHOS Removal", "Sophos removal application") Send("{enter}") WinActivate("SOPHOS Removal", "The Sophos removal application will remove all Sophos Anti-Virus components from your system") WinWaitActive("SOPHOS Removal", "The Sophos removal application will remove all Sophos Anti-Virus components from your system") Send("{enter}") SplashOff ( ) endfunc ; ---------------------------------------------------------------------------- Func adlib1() If WinExists("SOPHOS Setup - Active Applications", "Active Applications") Then WinActivate("SOPHOS Setup - Active Applications", "Active Applications") WinWaitActive("SOPHOS Setup - Active Applications", "Active Applications") Send("!c") Endif EndFunc ; ---------------------------------------------------------------------------- func adlib2() If WinExists("SOPHOS Removal - Removal Complete", "Sophos Anti-Virus removal complete") Then WinActivate ( "SOPHOS Removal - Removal Complete", "Sophos Anti-Virus removal complete") WinWaitActive ("SOPHOS Removal - Removal Complete", "Sophos Anti-Virus removal complete") Send("!e") Endif endfunc ; ------------------------------------------------------ any suggestions appreciated Bourny... Link to comment Share on other sites More sharing options...
Administrators Jon Posted May 24, 2004 Administrators Share Posted May 24, 2004 You can only have one adlib function. Although inside that adlib function you can call as many sub-functions as you like. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
Valik Posted May 24, 2004 Share Posted May 24, 2004 I think maybe this should be in the FAQ... I've seen experienced scripters who ought to know how to get multiple concurrent AdLib functions ask this question as well. Link to comment Share on other sites More sharing options...
bourny Posted May 24, 2004 Author Share Posted May 24, 2004 (edited) I have tried that aswell .... I placed them all in 1 adlib but couldnt get that working either. E.G... Within the below i also tried elseif to no avail. can anyone demonstrate the correct way to call sub functions using my example Cheers bourny.. ************************** Func adlib1() If WinExists("SOPHOS Setup - Active Applications", "Active Applications") Then WinActivate("SOPHOS Setup - Active Applications", "Active Applications") WinWaitActive("SOPHOS Setup - Active Applications", "Active Applications") Send("!c") Endif If WinExists("SOPHOS Removal - Removal Complete", "Sophos Anti-Virus removal complete") Then WinActivate ( "SOPHOS Removal - Removal Complete", "Sophos Anti-Virus removal complete") WinWaitActive ("SOPHOS Removal - Removal Complete", "Sophos Anti-Virus removal complete") Send("!e") Endif EndFunc Edited May 24, 2004 by Larry Link to comment Share on other sites More sharing options...
bourny Posted May 24, 2004 Author Share Posted May 24, 2004 Thanks... I will give that a try... I am also working on the idea of child windows as the window i am trying to close pops up on top of a window behind it... even though the window is on top and active do you think this could add to the problem .... bourny.... Link to comment Share on other sites More sharing options...
bourny Posted May 24, 2004 Author Share Posted May 24, 2004 tried that... seems on the sophos setup the control functions are not that cleaver ... I remenber something in the help file about non microsoft functions may not want to be automated. The first button was clicked but the application bombed out as if i had clicked on the cancel button....I also noticed the "next button" was labelled in the spy window as finish....the other buttons however showed the correct text for that control . Wiered but I put this down to the possibility that it was not a m/soft control??? Still trying in the mean time to get this adlib working..I think it is dropping into the adlib as I placed message boxes in to debug.. Still not consistent... obviously something I am doing wrong. Bourny.. 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