malicioussoap Posted July 14, 2020 Share Posted July 14, 2020 It's not so much a problem since Send("2*4*8*16=") Probably is specifically compatible with a different version of calculator.exe (it's Calculator 10.2005.23.0 right now). The specific issue is that running the script only leads to opening the calculator. There is no indication of input or output. Calculator.exe doesn't close after 20 minutes. I'm just wondering if it's working for anyone else. no big deal if it doesn't work, just curious here's the whole script for anyone too lazy to check the code expandcollapse popup#include <Constants.au3> ; ; AutoIt Version: 3.0 ; Language: English ; Platform: Win9x/NT ; Author: Jonathan Bennett (jon at autoitscript dot com) ; ; Script Function: ; Plays with the calculator. ; ; Prompt the user to run the script - use a Yes/No prompt with the flag parameter set at 4 (see the help file for more details) Local $iAnswer = MsgBox(BitOR($MB_YESNO, $MB_SYSTEMMODAL), "AutoIt Example", "This script will run the calculator and type in 2 x 4 x 8 x 16 and then quit. Do you want to run it?") ; Check the user's answer to the prompt (see the help file for MsgBox return values) ; If "No" was clicked (7) then exit the script If $iAnswer = 7 Then MsgBox($MB_SYSTEMMODAL, "AutoIt", "OK. Bye!") Exit EndIf ; Run the calculator Run("calc.exe") ; Wait for the calculator to become active. The classname "CalcFrame" is monitored instead of the window title WinWaitActive("[CLASS:CalcFrame]") ; Now that the calculator window is active type the values 2 x 4 x 8 x 16 ; Use AutoItSetOption to slow down the typing speed so we can see it AutoItSetOption("SendKeyDelay", 400) Send("2*4*8*16=") Sleep(2000) ; Now quit by sending a "close" request to the calculator window using the classname WinClose("[CLASS:CalcFrame]") ; Now wait for the calculator to close before continuing WinWaitClose("[CLASS:CalcFrame]") ; Finished! (The rest of the script is probably coloured as strings or comments but line 15 has code that doesn't stay in just one line but there's no such thing in the editor) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 14, 2020 Moderators Share Posted July 14, 2020 Moved to the appropriate forum, as the Developer General Discussion forum very clearly states: Quote General development and scripting discussions. Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums. Moderation Team Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Sidley Posted July 14, 2020 Share Posted July 14, 2020 (edited) Looks like they've done some changes to the Calculator class name. This works: expandcollapse popup#include <Constants.au3> ; ; AutoIt Version: 3.0 ; Language: English ; Platform: Win9x/NT ; Author: Jonathan Bennett (jon at autoitscript dot com) ; ; Script Function: ; Plays with the calculator. ; ; Prompt the user to run the script - use a Yes/No prompt with the flag parameter set at 4 (see the help file for more details) Local $iAnswer = MsgBox(BitOR($MB_YESNO, $MB_SYSTEMMODAL), "AutoIt Example", "This script will run the calculator and type in 2 x 4 x 8 x 16 and then quit. Do you want to run it?") ; Check the user's answer to the prompt (see the help file for MsgBox return values) ; If "No" was clicked (7) then exit the script If $iAnswer = 7 Then MsgBox($MB_SYSTEMMODAL, "AutoIt", "OK. Bye!") Exit EndIf ; Run the calculator Run("calc.exe") ; Wait for the calculator to become active. The classname "CalcFrame" is monitored instead of the window title Local $returnValue = WinWaitActive("Calculator", "", 2) ; Now that the calculator window is active type the values 2 x 4 x 8 x 16 ; Use AutoItSetOption to slow down the typing speed so we can see it if($returnValue <> 0) Then AutoItSetOption("SendKeyDelay", 400) Send("2*4*8*16=", 1) Sleep(2000) Else ConsoleWrite("Start timed out") EndIf ; Now quit by sending a "close" request to the calculator window using the classname WinClose("Calculator") ; Now wait for the calculator to close before continuing WinWaitClose("Calculator") ; Finished! Edited July 14, 2020 by Sidley Grammar correction malicioussoap 1 Link to comment Share on other sites More sharing options...
malicioussoap Posted July 15, 2020 Author Share Posted July 15, 2020 On 7/14/2020 at 12:39 AM, Melba23 said: Moved to the appropriate forum, as the Developer General Discussion forum very clearly states: Moderation Team ah sorry! 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