martin Posted February 4, 2011 Posted February 4, 2011 (edited) I have an AutoIt script to run an old dos program in DOSBox because that's the only way I can get it to work in Windows 7. The script starts up DOSBox with the relevant configuration file and it all works ok unless I press Esc. There is nothing in my script to use Esc and in case it made a difference I tried using Opt("GuiCloseOnESc", 0) although the script has no gui. I am not using _IsPressed and there is no hotkey for "{Esc}" The script needs to be kept running because it monitors the DOSBox window and sets it to full screen when needed. When in full screen pressing the Esc key will often cause a temporary switch to the desktop before the script sees that the window is the wrong size and sets it back. If I stop the script this problem is not there, that is if the app is in full screen mode then pressing the Esc key doesn't cause any problem. So I conclude that the AutoIt script somehow is reacting to the Escape key in a way that I don't understand. I assume that it must intercept the Esc key for the "GuiiCloseOnEsc" option, but maybe it then sends the key back to the wrong window. Has anyone got any ideas about this? Edited February 4, 2011 by martin Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Varian Posted February 4, 2011 Posted February 4, 2011 Have you tried to capture the Escape key with a dummy function?
AdmiralAlkex Posted February 4, 2011 Posted February 4, 2011 Does this still happen with a empty script? (just a While and Sleep to keep it up) I will try to reproduce this when I get home. Maybe an hour. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
martin Posted February 4, 2011 Author Posted February 4, 2011 Have you tried to capture the Escape key with a dummy function?Yes, I tried using a hotkeyset to capture the ESc key and call a function which does nothing. The problem still occured. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
guinness Posted February 4, 2011 Posted February 4, 2011 Are you using x64? If you are then have you tried #AutoIt3Wrapper_UseX64=N. I sometimes finds this solves a few problems I may have. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018
martin Posted February 4, 2011 Author Posted February 4, 2011 Does this still happen with a empty script? (just a While and Sleep to keep it up)I will try to reproduce this when I get home. Maybe an hour. Thanks AdmiralAlkex but I douibt you will be able to reproduce the problem as you see below.Strangely it does seem to depend on the script but I can't say I understand why. If I make the script start up the DOSBox and then just idle in a loop then the problem appears to go. I think it has something to do with the fact that the script changes the state of the window. It seems that if the script restores the program from minimized and then maximizes the program then pressing Escape causes some strange effect..The circumstances needed to cause the effect are very difficult for anyone else to reproduce because it only happens when I've chosen certain options in the app, chosen to run another app in another DOSBox, closed the second app and set the first one back to full screen. Then the problem occurs. If I do these things maually with the script running in an idle loop but taking no part in the state of the windows, then there is no problem with the Escape key.I've discovered that pressing Esc actually minimizes the window whereas I had thyought the focus was being shifted to another window. Because my script restores the program if it's minimized I didn't realize it was happening. There is nothing in my script to make anything minimize. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
whim Posted February 4, 2011 Posted February 4, 2011 I think it has something to do with the fact that the script changes the state of the window. It seems that if the script restores the program from minimized and then maximizes the program then pressing Escape causes some strange effect.. Maybe hide the Window, then do the minimised -> maximised stuff, and then Unhide ?
martin Posted February 4, 2011 Author Posted February 4, 2011 Maybe hide the Window, then do the minimised -> maximised stuff, and then Unhide ?Thanks for your suggestion whim.SInce the problem only happens when I have the application in full screen I have decided on another approach.I use the "windowresolution" setting in the DOSBox configuration file to mak ethe windowed version almost full screen and don't worry about setting it to full screen. Now there is no problem.So I don't understand why the Esc caused the problem but I've found a way to get round it. That took me about 6 hours. > Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
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