Smolenaars Posted December 16, 2016 Share Posted December 16, 2016 Hello people, I have a problem with making the FreeOCR wizard unattended. so that's why i am asking for you help. this is the code i am using (theoretically it should work but it doesn't). Run("freeocr541.exe") WinWaitActive("Setup - FreeOCR") Send("!N") Send("!a") Send("!N") Send("!N") Send("!I") Hoping anyone can help me. -Smolenaars Link to comment Share on other sites More sharing options...
Smolenaars Posted December 16, 2016 Author Share Posted December 16, 2016 the FreeOCR software I used is found at http://www.paperfile.net/ if anyone is wondering Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted December 16, 2016 Moderators Share Posted December 16, 2016 Moved to the appropriate forum. Please pay attention to where you post in the future "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Developers Jos Posted December 16, 2016 Developers Share Posted December 16, 2016 You aren't telling us yet what is going wrong, but likely you send the keystrokes too fast. Jos 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...
Smolenaars Posted December 16, 2016 Author Share Posted December 16, 2016 ow sorry, it starts without a problem but then doesnt go to the next wizard page. i tested a sleep 10000 but that didnt change anything. any ideas of how i could solve it. Link to comment Share on other sites More sharing options...
aa2zz6 Posted December 16, 2016 Share Posted December 16, 2016 (edited) I installed it on my vm win10. I'll take a look at it in a minute Edit: Are you using the send command to install it? If so I think there's a better way. Edited December 16, 2016 by aa2zz6 Link to comment Share on other sites More sharing options...
Smolenaars Posted December 16, 2016 Author Share Posted December 16, 2016 i am using the send command to click on the next button yes. Link to comment Share on other sites More sharing options...
aa2zz6 Posted December 16, 2016 Share Posted December 16, 2016 A super easy way would be to use the ControlClick feature. All you have to do is get the control ID of the button. Use the AutoIt Window Info tool found in the autoit folder in your start menu. ControlClick ( "title", "text", controlID [, button = "left" [, clicks = 1 [, x [, y]]]] ) https://www.autoitscript.com/autoit3/docs/functions/ControlClick.htm Link to comment Share on other sites More sharing options...
Smolenaars Posted December 20, 2016 Author Share Posted December 20, 2016 Thanks for the help but that didn't quite fix my problem. the new problem is that it gives an error when i try to run it. it also starts up the Setup twice. the script i am using is the following: Run("freeocr541.exe") Local $iPID = WinWait("[CLASS:TWizardForm]", "", 10) ControlClick ($iPID "Setup - FreeOCR", "Welcome to the FreeOCR Setup Wizard", controlID [, button = "left" [, clicks = 1[, 260 [, 170]]]]) It gives the following error: ControlClick ($iPID "Setup - FreeOCR", "Welcome to the FreeOCR Setup Wizard", controlID [, button = "left" [, clicks = 1[, 260 [, 170]]]]) ControlClick (^ERROR Error: Error in expression. Link to comment Share on other sites More sharing options...
Developers Jos Posted December 20, 2016 Developers Share Posted December 20, 2016 Those [] shouldn't be in there and are just an indicator in the helpfile that these parameters are optional. Have you tried building a sleep() between the send() commands to ensure you aren't sending them too fast? Jos 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...
Smolenaars Posted December 21, 2016 Author Share Posted December 21, 2016 Removed the [] and inplemented the Sleep(), my problem is still the same though. It still gives the same Error: Error in expression. Any other ideas what might cause this? Link to comment Share on other sites More sharing options...
kylomas Posted December 21, 2016 Share Posted December 21, 2016 Smolenaars, Post the script that issues the error and the run log. Are you using the full version of SCITE? kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
Smolenaars Posted December 21, 2016 Author Share Posted December 21, 2016 I am using this script, it works with other setups but it doesn't work with the FreeOCR setup. Run("freeocr541.exe") WinWait("Setup - FreeOCR") controlSend("Setup - FreeOCR", "", "[CLASS:TNewButton; INSTANCE:1]", "&Next >") I also tried it with the controlclick but that didn't work just like this one doesn't. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted December 21, 2016 Moderators Share Posted December 21, 2016 freeocr is very resistant to ControlClicks; I have run into it myself when packaging this application. Even though the controls show up on the Window Info Tool, you cannot interact with them. My suggestion would be either A: look at the IUIAutomation thread in the Examples forum, or B (more reliable): use Wix or some other open source tool to create an MSI from the installer, which you then can install silently. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
aa2zz6 Posted December 21, 2016 Share Posted December 21, 2016 (edited) Here you go buddy. Works on win7 Edit: The ID changes when the application is opened.. does someone know why the ID changes? #RequireAdmin ; must include when installing Example() Func Example() Local $hWnd = WinWait("[CLASS:TWizardForm]", "", 10) ; use AutoIt v3 Window Info tool ; located in the AutoIt folder. WinActivate($hWnd) ; WinActivate sets Setup - FreeOCR as an active screen ;Notes: ;ControlClick("title", "text", controlID[, button = "left"[, clicks = 1[, x[, y]]]]) ; title =>> $hWnd = WinWait("[CLASS:TWizardForm] ; "text" =>> "&Next >" ; controlID =>> 329210 ControlClick($hWnd, "&Next >", 329210) ; EndFunc ;==>Example Edited December 21, 2016 by aa2zz6 One last final thought :| Link to comment Share on other sites More sharing options...
abberration Posted December 22, 2016 Share Posted December 22, 2016 Or... You could use a silent switch. Example: Run(@ScriptDir & "\freeocr541.exe /silent") The above shows the install progress screens. To make it completely silent, use "/verysilent" instead of "/silent". Easy MP3 | Software Installer | Password Manager 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