Perl GUI script that should work with the application minimzed. How make it stay that way? Focus related problem - perl

I'm trying to develop a Perl script that controls an application in a very simple manner(fills some boxes, presses some keys).
I've implemented everything using Win32::GuiTest.
The goal is to make it work with the app being minimized in tray, allowing me to use the PC at the same time.
I'm using functions like: WMSetText , SelComboItem , SendMessage, PushChildButton.
All of them work fine, except for PushChildButton. Whenever this function is called, I'm losing focus(even though the controlled app stays minimized) from whatever I'm doing.
Application that I'm using before calling PushChildButton: http: // i. imgur.com/7B5kj.png
Application that I'm using after calling PushChildButton: http: // i. imgur.com/VCskW.png
I've tried killing the focus like this, but it did not work:
my $msg_id=0x08;
SendMessage( #_[ 0 ], $msg_id, #_[ 1 ], undef );
#_[ 0 ] - handle to the application
#_[ 1 ] -handle to the "Edit Control" that I think* that takes the focus after pressing the button
*Let me elaborate this a bit. The application still stays minimized, but sometimes that "Edit Control" resource contains strings that are concatenated with the keys that I've pressed while losing the focus.
PS: I'm a beginner with Perl and WinAPI(in fact this is my first project), so I might
have explained things a bit unclear. Please ask me everything that you feel that I
should elaborate.

Most likely this is a windows problem, not perl.
People do this normally with a normal window moved outside
the visible desktop range, e.g. to the left, x=-600.
Use Win32::GUI instead. This will save you many more headaches.

Related

Plotly Dash - Callback triggers sometimes & the same callback doesnt trigger sometime

I am facing issue with callbacks. I have 3 drop downs, one scattermap , one table and one slider on the screen and they all need to work in tandem and i have 5 call backs. When i execute the application all my callbacks associated with these controls execute in random order. After that when i click on scattermap it may or may not work. Say we assume it worked. Then i can navigate all around without any hassle. Then if i execute the application then click on the scattermap then as i mentioned it may or may not work. Say suppose it didn't work this time. If so is the case it will not work at all no matter what i do and simulaneously one specific dropdown also becomes dysfunctional. However if click any of the other two drop downs then evrything will start functioning as normal.
I have digged really deep into this and figured out that this has nothing to do with my code. The underlying issue is that when the click doesn't work the reason the reason behind that is the callback isn't getting triggered. I found out this by applying some debugging techniques and i am 100% sure the callback is not firing. Can anyone help me resolve/understand this please.

Creating user interface for ZORK style game in MATLAB

I'm trying to use MATLAB to create a stand-alone application for an interactive fiction game (where the player is presented with a text prompt and responds by entering text, e.g. "You are being choked by a creepy squid. >> " "Stab squid" "The squid dies, leaving behind an inky pile of gold. >>" etc.).
When I compile the game and install it, everything works smoothly, but there's nowhere for the game's prompts to appear, and nowhere for the user to type in responses.
Who has a good solution for this? Do I use a GUI with text boxes, or is there a way just to have a text scroll with user inputs like this? The latter would be preferable.
Thanks!

How can I make an OS X application unfocusable while still receiving click events?

I'm developing an on screen keyboard application for OS X, similar to the one that's built in to the operating system (Keyboard Viewer). I seem to have hit a wall as I'm not sure how I can accept click events from buttons and not steal focus from the currently activated application. I know this is possible since there are apps that already do this, e.g. AssistiveWere's KeyStrokes.
So my question is this: How can I make my window receive mouse events and handle them without getting activated?
P.S. I'm not very experienced in OS X development and this is my first Swift project, so excuses if this is a trivial problem.
You need to make your window an instance of NSPanel (or a subclass), include NSNonactivatingPanelMask in its styleMask, and set becomesKeyOnlyIfNeeded to true. (The style mask can be controlled in IB.) You probably also want it to be floating so it's always above normal windows, so set floatingPanel to true, too.

Access Pop Up Form Background Garbled/Distorted When Opened via OpenForm Macro Action with Window Mode Normal

I have a database that I work on using Access 2013, though I must maintain compatibility with Access 2010; I am using Windows 7.
I have an input form that is set to Pop Up = Yes, and Modal = No. When opening this input form directly from the Navigation Pane, it functions perfectly normally.
I have a macro in a search form that calls up this input form with the specified record using the "OpenForm" action. When opening the input form with this macro, the form's background is totally garbled (it pulls the background image from whatever was behind it when called, as though it were transparent), and all labels are unreadable.
That said, if I run the macro again by trying to open a different record, the form then appears correctly until it is closed. Also, if I change the "Window Mode" in the "OpenForm" action to "Dialog" rather than "Normal," it appears correctly.
Neither of these are valid solutions, though -- it should work on the first time, and I do not want the form to be modal. All my code seems okay (insomuch as I am not receiving error messages), so I don't understand why it would be doing this... any guidance is very much appreciated.
I have discovered what is causing this problem, though I don't understand why.
The macro I am using came from a sample database, and has some commands I am not fully familiar with. One such command is "Requery."
I experimented with removing various parts of the macro with the window mode as "Normal" for the "OpenForm" command. As soon as I tried removing "Requery" (and nothing else) the window opened in "Normal" mode with no distortion whatsoever.
In short, having "Requery" in the macro was what was causing this error to occur. It seems like an innocuous enough action (all it does is refresh data, from what I understand, as described here: https://msdn.microsoft.com/en-us/library/bb177360(v=office.12).aspx), but since I don't see why its inclusion was necessary anyway (if anyone could shed some light on that, it would be appreciated), it looks like this is essentially solved.
I hope this may help someone else in the future!

On Android or iOS - how to approach the possibility of a service or app going into a broken state

...and this broken state persisting until a device restart, since a naive attempt to restart an app would not work. Many users are not savvy enough to know how to terminate services/backgrounded apps. If the user can't (or doesn't 'need to') close apps, then what about restarting apps which have gone wrong? ( It can happen :) ) If my app goes wrong on someone's phone and they cannot easily restart the app without restarting the phone, that seems like a problem. I am aware that apps and services can be terminated by navigating system menus or double tapping the home button etc. but - many users are not aware of these features. For this reason I am thinking of adding an explicit close button to my app which will kill everything to the best of my ability, such that on a subsequent launch the program runs from the beginning again. I realise this is not the 'recommended' approach. Thoughts?
Thoughts?
Don't do it. Instead you should put a FAQ entry on your apps website that says.
Q: My app does not run anymore. HELP!
A: First you should try to restart the app. If that doesn't work feel
free to contact me.
Here is how you do this on the iPhone,
iPad or iPod.
double press the home button. the
multi tasking bar appears.
[ some screen shots ]
long press the app icon and press the
little x that appears on the icon.
[ more screenshots ]
If you want to put buttons for functions that are not obvious for many users you end up with a button for everything. And I (as somebody who knows every function) don't want a button cluttered user interface.
You would be surprised how many emails I get about "how can I zoom?" (A: Pinch your fingers) or "how do I delete an entry (in a tableview)" (A: Swipe your finger over the entry from left to right, and press the red delete button).
If I get an email about this I just point them to the faq which has some nice screenshots.
Btw, if the "broken state" happens so often that you would consider adding a special button I would check my code for bugs again.