coucou Posted February 9, 2010 Share Posted February 9, 2010 Hi, I am attempting to automate Diskeeper installation and running into difficulty during the Activation. I've noticed that the child window "Enter License key" stay always grey (see image here bellow) although my message routine send that it's activated. Consequently, I can't write the serial number into Diskeeper "Enter License key" dialogue. expandcollapse popup$title = "Diskeeper 2010 Pro Premier" $title1 = "Enter License key" ;write serial number into Diskeeper 2010 dialogue $ser1 = "12345" $ser2 = "67890" $ser3 = "abcde" $ser4 = "fghij" $ser5 = "klmno" $ser6 = "pqrs" $pid2 = Run(@ProgramFilesDir & "\Diskeeper Corporation\Diskeeper\AppLauncher.exe") Sleep(1000) If WinWait("Diskeeper Notice", "", 10) Then ControlClick("Diskeeper Notice", "", "Button1") EndIf Sleep(500) If WinExists($title, "Analyze and Defragment Now") Then WinActivate($title, "Analyze and Defragment Now") Send("!a");Action ;Send("{DOWN 9}") Send("{ENTER}");Enter License key EndIf WinActivate("[CLASS:Edit; INSTANCE:1]", "") ;WinActivate($title1, "") ;The following was for testing that the "Enter License key" child window is activated ;$title3 = WinGetTitle("[CLASS:Edit; INSTANCE:1]", "") ;MsgBox(0, "Full title read was:", $title3) WinWaitActive("[CLASS:Edit; INSTANCE:1]", "", 5) Sleep(1500) ControlSend("[CLASS:Edit; INSTANCE:1]", "", "Edit1", $ser1) ControlSend("[CLASS:Edit; INSTANCE:1]", "", "Edit2", $ser2) ControlSend("[CLASS:Edit; INSTANCE:1]", "", "Edit3", $ser3) ControlSend("[CLASS:Edit; INSTANCE:1]", "", "Edit4", $ser4) ControlSend("[CLASS:Edit; INSTANCE:1]", "", "Edit5", $ser5) ControlSend("[CLASS:Edit; INSTANCE:1]", "", "Edit6", $ser6) Sleep(500) ControlClick($title1, "", "Button1") I'll appreciate any help coucou Link to comment Share on other sites More sharing options...
PsaltyDS Posted February 9, 2010 Share Posted February 9, 2010 You are putting the Class/Instance of the control where the window specification belongs. Try "[TITLE:Enter License Key]" for the window title. 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...
coucou Posted February 9, 2010 Author Share Posted February 9, 2010 (edited) Yeah... I forgot to tell that I've tested both "[TITLE:Enter License Key]" and Class/Instance without success. The child window "Enter License key" stay always grey (not selected). Regards Edited February 9, 2010 by coucou Link to comment Share on other sites More sharing options...
coucou Posted February 10, 2010 Author Share Posted February 10, 2010 No more suggestion??? Come on... Help me pleazzzz coucou Link to comment Share on other sites More sharing options...
MHz Posted February 10, 2010 Share Posted February 10, 2010 Some small changes may help to make it work a little better. Some use of Adlib functionality may help to improve the script some but i will not go into that as i am not fully up to date with Adlib changes in the latest AutoIt version yet. The picture does not show grey unless you are referring to the OK button which may highlight to normal when the whole serial has been sent into the edit controls. expandcollapse popup$title = "Diskeeper 2010 Pro Premier" $title1 = "Enter License key" ;write serial number into Diskeeper 2010 dialogue $ser1 = "12345" $ser2 = "67890" $ser3 = "abcde" $ser4 = "fghij" $ser5 = "klmno" $ser6 = "pqrs" $pid2 = Run('"' & @ProgramFilesDir & '\Diskeeper Corporation\Diskeeper\AppLauncher.exe"') Sleep(1000) If WinWait("Diskeeper Notice", "", 10) Then ControlClick("Diskeeper Notice", "", "Button1") EndIf Sleep(500) If WinExists($title, "Analyze and Defragment Now") Then WinActivate($title, "Analyze and Defragment Now") Send("!a");Action ;Send("{DOWN 9}") Send("{ENTER}");Enter License key EndIf ;~ WinActivate("[CLASS:Edit; INSTANCE:1]", "") ;WinActivate($title1, "") ;The following was for testing that the "Enter License key" child window is activated ;$title3 = WinGetTitle("[CLASS:Edit; INSTANCE:1]", "") ;MsgBox(0, "Full title read was:", $title3) WinWait($title1) Sleep(1500) ControlSend($title1, '', 'Edit1', $ser1) ControlSend($title1, '', 'Edit2', $ser2) ControlSend($title1, '', 'Edit3', $ser3) ControlSend($title1, '', 'Edit4', $ser4) ControlSend($title1, '', 'Edit5', $ser5) ControlSend($title1, '', 'Edit6', $ser6) Sleep(500) ControlClick($title1, "", "Button1") Link to comment Share on other sites More sharing options...
coucou Posted February 10, 2010 Author Share Posted February 10, 2010 TNX MHZ The child window "Enter License key" is selected this time, but the script stop at WinWait($title1)$title1 = "Enter License key" ... ... WinWait($title1)yet it is the window's title To solve that problem I modified from $title1 = "Enter License key" to $title1 = "[CLASS:#32770; INSTANCE:1]" I can't exply why but it works. Can you? expandcollapse popup$title = "Diskeeper 2010 Pro Premier" $title1 = "[CLASS:#32770; INSTANCE:1]" ;write serial number into Diskeeper 2010 dialogue $ser1 = "12345" $ser2 = "67890" $ser3 = "abcde" $ser4 = "fghij" $ser5 = "klmno" $ser6 = "pqrs" $pid2 = Run('"' & @ProgramFilesDir & '\Diskeeper Corporation\Diskeeper\AppLauncher.exe"') Sleep(1000) If WinWait("Diskeeper Notice", "", 10) Then ControlClick("Diskeeper Notice", "", "Button1") EndIf Sleep(500) If WinExists($title, "Analyze and Defragment Now") Then WinActivate($title, "Analyze and Defragment Now") Send("!a");Action ;Send("{DOWN 9}") Send("{ENTER}");Enter License key EndIf ;~ WinActivate("[CLASS:Edit; INSTANCE:1]", "") ;WinActivate($title1, "") ;The following was for testing that the "Enter License key" child window is activated ;$title3 = WinGetTitle("[CLASS:Edit; INSTANCE:1]", "") ;MsgBox(0, "Full title read was:", $title3) WinWait($title1) Sleep(1500) ControlSend($title1, '', 'Edit1', $ser1) ControlSend($title1, '', 'Edit2', $ser2) ControlSend($title1, '', 'Edit3', $ser3) ControlSend($title1, '', 'Edit4', $ser4) ControlSend($title1, '', 'Edit5', $ser5) ControlSend($title1, '', 'Edit6', $ser6) Sleep(500) ControlClick($title1, "", "Button1") Regardscoucou Link to comment Share on other sites More sharing options...
MHz Posted February 10, 2010 Share Posted February 10, 2010 To solve that problem I modified from $title1 = "Enter License key" to $title1 = "[CLASS:#32770; INSTANCE:1]" I can't exply why but it works. Can you? Yes, upon another review The original code has a small "k" for "key". $title1 = "Enter License key" but, your picture has a capital "K" for "Key". The title parameter is case sensitive so the incorrect case used caused the WinWait() to not recognize the window. Link to comment Share on other sites More sharing options...
coucou Posted February 10, 2010 Author Share Posted February 10, 2010 Well Done MHZ And to think that I spennt 2 days BTW to test the script, I've to install and Uninstall Doskeeper. Then Sometimes I've the "Enter License Key..." command at the top and sometimes it's 9 steps down 'see image bellow). I couldn't find any direct shrtcut for that command.Sleep(500) If WinExists($title, "Analyze and Defragment Now") Then WinActivate($title, "Analyze and Defragment Now") Send("!a");Action ;Send("{DOWN 9}") Send("{ENTER}");Enter License key EndIfHave any idea how to autoamte that?Regards Link to comment Share on other sites More sharing options...
MHz Posted February 10, 2010 Share Posted February 10, 2010 Something like this may do. I do not see accelerators keys underlined in your picture so I was unable to add "&" to the menu item string as the string "Action" could be "A&ction" or "&Action"... $title = "Diskeeper 2010 Pro Premier" ; scan for window AdlibRegister('_Adlib') ; window may appear here ; some other code here to do something perhaps ; stop scan for window when not needed anymore AdlibUnRegister('_Adlib') Func _Adlib() If WinExists($title, 'Analyze and Defragment Now') Then WinMenuSelectItem($title, 'Analyze and Defragment Now', 'Action', 'Enter Licence Key ...') AdlibUnRegister('_Adlib') EndIf EndFunc If the "Diskeeper Notice" window is the flag for need of registering, then you may want to wrap the code to that condition else you may rerun the script on an already registered program. i am not in a good position to inform on the behavior of Diskeeper with my limited knowledge of it. Link to comment Share on other sites More sharing options...
coucou Posted February 10, 2010 Author Share Posted February 10, 2010 I tested it and got the following error messageAdlibRegister('_Adlib')^ERRORError: Unknown function nameRegards Link to comment Share on other sites More sharing options...
PsaltyDS Posted February 10, 2010 Share Posted February 10, 2010 That tries to register a function called "_Adlib", which is there in MHz's post. Did you create that function in your script or point it to another existing function? 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...
coucou Posted February 10, 2010 Author Share Posted February 10, 2010 NOt for this script. Anyway I didn't use that function the last 3 days.I've some scripts using this function as follow;Check for pop-upAdlibEnable('_Adlib', 1000) Link to comment Share on other sites More sharing options...
MHz Posted February 10, 2010 Share Posted February 10, 2010 (edited) NOt for this script. Anyway I didn't use that function the last 3 days. I've some scripts using this function as follow ;Check for pop-up AdlibEnable('_Adlib', 1000) AdlibRegister('_Adlib') is the latest AutoIt3 version of AdlibEnable('_Adlib') with some small differences. Same with AdlibUnRegister('_Adlib') is the latest AutoIt3 version of AdlibDisable() with some small differences. Use what suits your version of AutoIt3. Edit: Removed parameter from AdlibDisable() as is invalid. Edited February 10, 2010 by MHz Link to comment Share on other sites More sharing options...
Developers Jos Posted February 10, 2010 Developers Share Posted February 10, 2010 Welcome back Michael SciTE4AutoIt3 Full installer Download page  - Beta files    Read before posting   How to post scriptsource   Forum etiquette Forum Rules  Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
coucou Posted February 10, 2010 Author Share Posted February 10, 2010 (edited) I had 3.3.0.0 installed.I installed the latest 3.3.4.0, tested the script: No error, but nothing hapens. It stay at the "Analyze and Defragment Now" window, NO "Action/Enter Licence Key ..." and the script continue runing and stop at WinWait($title1) Edited February 10, 2010 by coucou Link to comment Share on other sites More sharing options...
coucou Posted February 11, 2010 Author Share Posted February 11, 2010 Hi Michael,I've tested with 3.3.4.0 with and without AdlibRegister('_Adlib') ;---- AdlibUnRegister('_Adlib')as well as with and wihout adding accelerators keys "&" to the menu item string "Action" " or "&Action" without success. Diskeeper stay (freeze) at the Main window "Analyze and Defragment Now" and submenu [Action] is NOT selected.Finally i tested a combination of both Send("!a") and WinMenuSelectItemFunc _Adlib() If WinExists($title, 'Analyze and Defragment Now') Then Send("!a");Action WinMenuSelectItem($title, 'Analyze and Defragment Now', 'Action', 'Enter Licence Key ...') AdlibUnRegister('_Adlib') EndIf EndFuncDiskeeper still stay (freeze) at the Main window "Analyze and Defragment Now" but the submenu [Action] is selected. At that time I noticed the existence of accelerators keys for the submenu like [Enter Licence Key ...]. In other words by pressing [ALT]+A then depressing it, I couldn't see the submenus accelerators keys. Moreover, by REpressing the [ALT] key I went back to the Main window "Analyze and Defragment Now". The solution is to stay pressing the [ALT] key. Therefore everything works as follow. Func _Adlib() If WinExists($title, 'Analyze and Defragment Now') Then Send("!ak");Action+Enter Licence Key AdlibUnRegister('_Adlib') EndIf EndFuncSo, everything soung good I'm still cutious to know why WinMenuSelectItem command doesn't works.TNX again Michael 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