Davgop Posted October 21, 2019 Share Posted October 21, 2019 I am trying to use Autoit was based on this website instructions I have installed Autoit added the reference in VBA. But when i run code it gives me an error as "Class Not Registered" I am using office 365 with windows 10. The error occurs in the line where i set the object. Sub autoit() 'Create and initialize an object Dim autoit As AutoItX3 Set autoit = New AutoItX3 'Check autoit installation If IsNull(autoit) Then MsgBox "Autoit Is Not installed on your machine", vbCritical + vbOKOnly, "Verify" Exit Sub End If 'Launch Calculator autoit.Run "calc.exe", "C:\Windows\System32" autoit.Sleep "2000" If autoit.WinExists("Calculator", "") Then 'Click Button "1" and wait for one Second autoit.ControlClick "Calculator", "", "131" autoit.Sleep "1000" 'Click Button "+" and wait for one Second autoit.ControlClick "Calculator", "", "93" autoit.Sleep "1000" 'Click Button "2" and wait for one Second autoit.ControlClick "Calculator", "", "132" autoit.Sleep "1000" 'Click Button "=" and wait for one Second autoit.ControlClick "Calculator", "", "121" autoit.Sleep "1000" 'Close the calculator autoit.WinClose "Calculator", "" End If End Sub Link to comment Share on other sites More sharing options...
Earthshine Posted October 21, 2019 Share Posted October 21, 2019 the calculator in windows 10 cannot be manipulated in this way using Autoit, nor with native commands. See this thread and FAQ 31 about UIAutomation My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
Davgop Posted October 22, 2019 Author Share Posted October 22, 2019 Earthshine - Thank you for your response. I am very new to programming, so basically I am working on an automation project to open a URL, login with the credentials, navigate to the specific page and click the print button. I am using VBA with selenium binding and chrome browser. Now, after I click the print button in the webpage the print option of chrome browser pops-up. All I need to do now is click the print button, but with VBA or Selenium I unable to attain my results. I learnt that using Auotit I can automate click function. so I was trying the example given. It would really helpful if you give any advice or show me the direction. Link to comment Share on other sites More sharing options...
Earthshine Posted October 22, 2019 Share Posted October 22, 2019 (edited) UIAutomation suits your needs well I should think, and will work, if done properly. There is a lot to learn, certainly. You can post your script here for help in develop/debug also read this as well; https://www.autoitscript.com/wiki/FAQ#How_can_I_control_.28click.2C_edit_etc.29_an_external_.28html.29_application.3F between those two links in this thread, that should get you going. post in the support forum with your scripts if you need help @junkew's UDF has samples of automating Notepad, as does @LarsJ's UDF, I believe. Edited October 22, 2019 by Earthshine My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
Davgop Posted October 31, 2019 Author Share Posted October 31, 2019 (edited) @Earthshine I have gone through the Links you provided, however I lack the knowledge of the understanding the concepts. I have to say I am a beginner and I do not have programming/development background. So what I am doing now is, with the code below I am opening up chrome and visiting google.com. what I want to do is use sendkeys option to press "ctrl+P" and then click the "Print" button. Could you please assist me on the same. Here is the code: Sub Test() Dim bot As New WebDriver, keys As New Selenium.keys bot.Start "chrome" bot.Get "https://google.com" 'code needed for "ctrl+P" End Sub I am using VBA and selenium Edited October 31, 2019 by Davgop Link to comment Share on other sites More sharing options...
Earthshine Posted October 31, 2019 Share Posted October 31, 2019 (edited) oh, you may be able to use the AutoItX dll. hang on, there was something about this earlier in the forums. read the help file about AutoItX, you should be able to use that from VBA what are you using to develop in? you need to set a reference in you vb stuff to that AutoItx DLL file to use the stuff it contains. in your case you may just need to have it local to your running script... i don't use it see this thread I am wondering what this is actually for? I seriously hope you have read the forum rules at this point. Edited October 31, 2019 by Earthshine My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
Davgop Posted October 31, 2019 Author Share Posted October 31, 2019 @Earthshine - Here is the code I tried but I am getting an error. Sub Test() Dim bot As New WebDriver, keys As New Selenium.keys bot.Start "chrome" bot.Get "https://google.com" AutoItX.send ("{^p}") 'getting error on this line End Sub Link to comment Share on other sites More sharing options...
Earthshine Posted October 31, 2019 Share Posted October 31, 2019 what is this for? My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
Davgop Posted November 1, 2019 Author Share Posted November 1, 2019 @Earthshine I apologize for not answering your question in the previous comment. So as I stated in my earlier comment I am running a automation project where it will open up a browser and goes to a specific URL (I cannot share this URL as it is against my company rules) and login with the user credentials, navigates to a specific page and clicks on the button which says print. so after this the chrome Print properties option gets displayed and I need to click the Print option. This is manually task we do on daily basis once the document id downloaded we need to upload it in our data base. All these portals are IP restricted and can only be used through company's IP. Also, yes I have gone through the Forum rule. I am not doing anything which is illegal or bypassing the terms and conditions. I have created many automation projects using VBA and selenium and this is first time I am facing this task. I believe that I have answered your question, please do let me know if you need anything else. Link to comment Share on other sites More sharing options...
Earthshine Posted November 1, 2019 Share Posted November 1, 2019 what are you developing in? i don't have old office anymore, and 365 doesn't allow vba My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
Davgop Posted November 1, 2019 Author Share Posted November 1, 2019 (edited) I am also using Office 365 and it does allows VBA in excel Edited November 1, 2019 by Davgop Link to comment Share on other sites More sharing options...
TheXman Posted November 1, 2019 Share Posted November 1, 2019 Have you registered the the appropriate AutoIt3x DLL (x86/x64)? CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
Davgop Posted November 1, 2019 Author Share Posted November 1, 2019 @TheXman - I am afraid I did not do that, could you please let me know how to do it. If you are referring to add the reference in VBA (see screenshot below) yes I did that. Link to comment Share on other sites More sharing options...
TheXman Posted November 1, 2019 Share Posted November 1, 2019 Go to your AutoIt installation directory and then go to the AutoItX folder within it. There you will find the AutoItx.chm help file. Spend some time learning and understanding how to use AutoItX. I would suggest getting the examples, in the AutoItX\Examples\VBScript folder, working before moving forward. Then you will at least know that everything is registered and working properly before trying to move forward with your current issue. The answer to your specific question can be found under the "COM Interface" topic in that help file. CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
Davgop Posted November 1, 2019 Author Share Posted November 1, 2019 @TheXman - Thanks for your help. I have registered using the below guide. It was successful registered. so now I tried the example in the help file but still getting the same error. Sub Test() Set oAutoIt = WScript.CreateObject("AutoItX3.Control") 'getting error on this line oAutoIt.Run ("notepad.exe") End Sub Link to comment Share on other sites More sharing options...
TheXman Posted November 1, 2019 Share Posted November 1, 2019 (edited) You are obviously running a 64bit version of Windows. Therefore, you most likely need to register the 64bit DLL, AutoItX3_x64.dll. Edited November 1, 2019 by TheXman CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
Davgop Posted November 1, 2019 Author Share Posted November 1, 2019 @TheXman - followed your instruction still the same error. Link to comment Share on other sites More sharing options...
TheXman Posted November 1, 2019 Share Posted November 1, 2019 (edited) Now that you have registered the DLLs, what happens when you run either of the vbscript examples in the Examples folder that I referenced? If it is an error in a MsgBox, then show the MsgBox. Edited November 1, 2019 by TheXman CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
Davgop Posted November 1, 2019 Author Share Posted November 1, 2019 @TheXman - Here is the error message. Sub Test() Set oAutoIt = WScript.CreateObject("AutoItX3.Control") 'getting error on this line oAutoIt.Run ("notepad.exe") End Sub Link to comment Share on other sites More sharing options...
TheXman Posted November 1, 2019 Share Posted November 1, 2019 That is NOT one of the examples in the folder. Double-click one of the example vbs files and show me the error. CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman 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