ADB on Kindles is there a way to receive a notification back when a window opens up or to see the checkbox status? - adb

I'm using adb event codes to setup and navigate thru over 200 kindles
adb -s %%i %*shell input keyevent 61"....
This works great for the first time thru but the second time thru, I could be turning off things that the prior run thru turned on or vice versa. Is there a way with adb commands to read status get feedback or otherwise check to see if a check box on the kindle has been set, or if a window pops up on the launcher screen. I'm not understanding how to query the device to see if things are flagged or otherwise set. Thanks

This is not exactly what you want, as this is enabling Wi-Fi on a phone instead of Parental Controls, but I think you can get some ideas from this example that might be useful.
Instead of blindly clicking on the switch that would toggle Wi-Fi ON and OFF, this only clicks if it is OFF
#! /usr/bin/env python3
from com.dtmilano.android.viewclient import ViewClient
helper = ViewClient(*ViewClient.connectToDeviceOrExit(), useuiautomatorhelper=True).uiAutomatorHelper
obj_ref = helper.ui_device.find_object(body={
'clazz': 'android.widget.Switch',
'pkg': 'com.android.settings',
'desc': 'Wi‑Fi'
})
if helper.ui_object2.dump(oid=obj_ref.oid).text != 'ON':
print('Switching Wi-Fi ON')
helper.ui_object2.click(oid=obj_ref.oid)
else:
print('Wi-Fi already ON')
It's using AndroidViewClient/culebra with CulebraTester2-public back-end.

Related

Yakuake - remap split navigation away from Shift+Tab

Yakuake (KDE drop-down terminal) would be a very convenient tool for me, except for a single mysterious key mapping: Shift+Tab
What yakuake shortcut settings says it does: Nothing
What it actually does: Switches to previous terminal split
This is unfortunate, since it drowns the mapping from my vimrc to walk backwards up the autocomplete menu.
Does anyone know of a way to remap this elusive mapping? I checked in all the other KDE shortcut settings and found nothing. After all, I have no problems in Konsole...
Steps to reproduce this mysterious behaviour:
Open yakuake
hit Ctrl+( to create a split view
hit Shift+Tab
I am on yakuake 3.0.5+, and the rest of my system can be inspected here
It turns out this was a known bug:
https://bugs.kde.org/show_bug.cgi?id=421632
It should be fixed in the next KDE bugfix release (20.08).

How to get Mouse input inside a C console program on Windows-10?

I need to interact with user's mouse input in my simple C console program. I did some research and found a related Microsoft's docs on their page here. For a start, I copied all of their sample-code and pasted that into my editor. Upon compilation, it gets compiled well, with a nice little '.exe' which when run, tells/prints correctly all 'Key events' and 'resize events', But No Mouse event! How to successfully get mouse input inside C console program? My MCVE is the given sample-code here on Microsoft site, as i used that sample-code verbatim! I'm using Windows 10 Pro (1703), just in case.
EDIT: - It appears to be a problem which is not unique to me. Another StackOverflow user also reported the same problem here on his Windows-10 system. His provided MCVE was also working on Windows-7, but not on Windows-10, just like my quoted-MCVE on Microsoft's site as a sample-code might be working on older Windows-versions, but not on windows-10, where 'Quick Edit Mode' seemingly is enabled in 'Console-Defaults'.
After spending hours i have found the culprit for failure of that quoted-in-my-question Microsoft's official sample code here. And the culprit is the very console itself! Actually it's a 'setting' namely 'Quick Edit Mode' for the 'Console Windows' .
You can access it by:
Opening command-prompt and right-clicking on its title-bar and then clicking 'Defaults'
A Dialog box would appear, titled 'Console Windows Properties'. There in Options tab, under Edit Options sub-heading, you would find 'Quick Edit Mode' checkbox!
I have attached screen-captures below:
The problem was being caused by that 'Quick Edit Mode' option which was enabled(checkbox is checked) by default on my Windows 10. And in this enabled status, this 'Quick Edit Mode' was consuming all the Mouse-Events and wasn't dispatching any to my '.exe' .
When this 'Quick Edit Mode' options' checkbox is unchecked (disabled), then program runs fine as intended/coded in that sample-code here, telling/printing all Mouse events. [ Phew! ]
NOTE: The change in 'Console Properties' requires relaunch of the console, to take effect.
EDIT: IMPROVED 'PORTABLE' SOLUTION!
The solution above is not 'portable'. That's just for the local-machine and of course, it's also 'manual work'. To make that sample-code work without requiring user to disable Quick Edit Mode 'manually' as explained above, we can disable Quick Edit Mode programmatically by adding following lines of code inside that sample-code
/*
Step-1:
Disable 'Quick Edit Mode' option programmatically
*/
fdwMode = ENABLE_EXTENDED_FLAGS;
if (! SetConsoleMode(hStdin, fdwMode) )
ErrorExit("SetConsoleMode");
/*
Step-2:
Enable the window and mouse input events,
after you have already applied that 'ENABLE_EXTENDED_FLAGS'
to disable 'Quick Edit Mode'
*/
fdwMode = ENABLE_WINDOW_INPUT | ENABLE_MOUSE_INPUT;
if (! SetConsoleMode(hStdin, fdwMode) )
ErrorExit("SetConsoleMode");
I found about that 'ENABLE_EXTENDED_FLAGS' option on Microsoft's docs about SetConsoleMode()
After we have applied ENABLE_EXTENDED_FLAGS in SetConsoleMode() function, our program would receive/print all 'Mouse Events' even though the user has 'Quick Edit Mode' option enabled in Console Defaults options. And after our program has finished doing its job (receiving Mouse events in this super simple scenario) user's Console Defaults would be undisturbed because before our program quits, it would restore user's original (saved in the start of our program) Console Mode as follows:
/* Restore original console mode before exit. */
SetConsoleMode(hStdin, fdwSaveOldMode);
As done in that sample-code there, which works well, but fails to print Mouse events if user has 'Quick Edit Mode' enabled in his console. Therefore, to make that sample-code work in scenarios where user's Console Defaults has 'Quick Edit Mode' enabled, we should include/put inside that sample-code the code-snippet (of applying ENABLE_EXTENDED_FLAGS) as shown in this 'EDIT' section above.

how to make a .bat file "activate" when the PC sleeps

Is there a way that I can make a batch program begin when I put my computer to sleep?
I would like to disable a USB port when I put my computer to sleep. Is this possible if so, how would I go a out doing so?
As this has not been marked as closed I am assuming the author has not been able to piece together the answer from the comments. This answer is derived from those comment hints and gives the detail that perhaps the questioner requires....
If you search for information on using the task scheduler to trigger on the sleep event you get to this page at Microsoft, which contains the following:
Input “Task Scheduler” in search box and press Enter
Click “Create task…” on the Task Scheduler---Action
Go to Triggers, create new triggers
On “Begin the task”, select “On an event”
Select Log to “system” , set “Source” to “Kernel-Power” , Event ID
is “42” and click “Ok”
Go to “Actions” and create a new actions
You can select “Start a program”, “Send an e-mail” and “Display a
message” on action as you need.
Save the task scheduler
On conditions tab, check the box “Wake the computer to run this task”. Click OK.
The information about using devcon.exe is on this microsoft page which shows the following command does the trick:
devcon disable *MSLOOP
You can either make a batch-file calling devcon, or have the task scheduler call devcon directly with the appropriate arguments.
Is that enough detail to explain the solution?

How to protect files(docs) form being downloaded

I have some documents on a subdirectory for example www.example.com/documents, inside the document folder i have files(e.g. File1.doc, file2.docx, and So on). I want users to view the files But not to download it.
How can i do this?
In order to view the file the user need to download them... Maybe I don't fully get your point but I think this is not an option
(Programmer's Lore-Keepers) forgive my suggestions here...
This is a bit of a 'grey-area-programming'.
Have you considered perhaps using a technology of your choice javascript/jQuery to capture the "known" ways of copying while on your page?
Positive test : suppose the user clicks enter on a textbox and you're using jQuery to trap the enter command to then set off your trigger that is a default action to a control of your choice.
Think about this as a negative test... if the user uses key combinations such as Ctrl+A or Ctrl+P or Ctrl+S then you intercept it and interrupt their action in theory...
Other factors to consider would be how to capture the mouse drags and perhaps even right-click actions.
Hope this helps.

Issue with configuring conTEXT to compile for Unrealscript

I have been going through Rachel Cordone's Unreal Development Kit Game Programming with UnrealScript Beginner's Guide book and having an issue using the conTEXT text editor.
As per instructed through the book I have followed all the steps to configure it but it won't compile once I press F9 - considering the last step to configure is to set the Enivronment Options/Execute Keys section. Here are the steps the book lays out (just that certain tab):
7) Now we are going to set up the conText to compile code. On the Execute Keys tab, click on Add, then type .uc into the Extensions field that comes up.
8) Once that's done four keys, F9 through F12, will show up in the User Exec Keys window. Let's click on F9 to make it convenient. Once clicked the option on the right become available.
9) For the Execute line, click on the button to the right of the field and navigate to out UDK installation's Binaries\Win64 folder, and select UDK.exe. For Start In, copy the Execute line but leave out UDK.exe.
10) In the Parameters field, type "make" without the quote marks. This tells UDK.exe that we want to compile code instead of opening the game.
11) Change Save to All Files Before Execution.
12) Check Capture Console Output and Scroll Console to the Last Line...
Then all I have to do is press F9 and it will compile - but it doesn't! It gives me:
No user command associated with extension '.uc'
Use 'Environment Options/Execute Keys' dialog to assign commands.
It seems it is not registering the changes no matter what I do (yes I clicked apply before saying okay but even still nothing). Any ideas?
The instructions may be out of date. You'll need to select your ".uc" entry, hit "Edit", and change it to just "uc".
Also, if you use UDK.com instead of UDK.exe the console output will go directly into Context instead of going to a separate popup.

Resources