I want to monitor android clipboard and display toast from QPython. Actually, I want to check the clipboard for any changes, if the clipboard has a particular string in it that matches a particular regex, I want to process it (the process is really simple, think of its complexity as converting to uppercase, or some similar easy operation) and display the resulting string in a toast. Also, the script should run in background, so that it can monitor the clipboard even if the foreground app is different (e.g. WhatsApp or browser).
I had written a similar native app, but unfortunately the corresponding Java library doesn't work anymore, so I have to rely on a python module that does the same job.
Is it possible to do this using QPython?
You may want to check out the androidhelper module in QPython, and sl4a module in QPython3.
Both have the ability to toast something on the screen, but not sure about clipboard.
I think you can set the clipboard data, and don't know how to get it.
Documentation can be found here
Related
this is my first post here,not sure how things work around here,but hey you gotta start somewhere.
I'm using a package from angular called angular-file-upload to upload images.
Is it possible to use an image from clipboard as input of file-uploader?
This component doesn't support pasting from clipboard.
Please experiment with ClipboardEvent.clipboardData to see how clipboard data is handled.
Also try using the paste event handler to trigger function on user pasting data.
document.addEventListener('paste', my-function);
Lot of security implications are around this event and the browser support is not yet impressive.
But it is a nice ground to do some experiments on.
I have an native mobile application that loads my react application within a child iframe (not sure exactly how it does it), but this application injects some variables into the page as windows.xxxx
So in order to test my application (yes, this sucks a lot) I need to run the app on my phone, have it open up the URL on my development machine (aka http://192.168.10.10:3300).
Then to debug anything I'm forced to alert(var1) .. as you can imagine this is a pretty painful process and I really wish the parent application would provide something better than this.
Normally a simple option would be something like console.log(var1) but I can't see the console on my mobile device and my URL is being loaded withing this native app.
So:
1. Any suggestions on a better debug process would be welcome.
2. One idea that would help is if there was a react component that would simply
print to screen anything any console.log().
3. I guess another option could be some kind of remote logger, so that console.remotelog(debugServerUrl, var1) pushes debug messages to the listener which then displays the debug.
All of this if a pain of course, but hoping someone out there has a clever idea for me.
If you're already using ReactJS, an easy quick-fix might be creating a log file in the phone. This post details a quick and relatively easy way to save a string as a text file, and it would not be hard to put everything you want saved into a string.
Furthermore, This post details an implementation of the remote logging feature you vaguely referenced.
Also, if you want to capture stdout and stderr, check out this npm package
Ultimately, hope this helps, and good luck
I was planning to create a new web app based on extjs, but i need to create a file upload area where i can work on file uploading , i have tried drag and drop method in html 5 but we don't need that, we need a method where a user can copy a file whatever it is(not big than 20 mb)and that file location got copied on the clipboard and when we paste the file in the selected area of the uploader and the file gets uploaded, what is the best way to go about this?
There is no general access to the clipboard from browsers these days. There is a flash object called zeroclipboard that can be used for some clipboard access.
For your particular need (if all the data is exchanged within your page), you may not need to use the actual clipboard and perhaps you can just use some global storage to store things that are copied for later paste (using your own copy/paste instead of clipboard operations).
This Specification to achieve this is: http://dev.w3.org/2006/webapi/clipops/
But seens that it isn't implemented in any browser yet (perhaps IE9)
This could help you : https://stackoverflow.com/a/6338207/230526
If not interested in standard based solution, firefox, because of the plugins API, have a workaround for this, that you can see here: https://developer.mozilla.org/en/Using_the_Clipboard
I also found this piece of code that promises to work on Webkit based browsers: http://forum.maxthon.com/viewthread.php?tid=79469&page=1#pid493997
If you need to have all browsers support, then Zero Clipboard as stated here, is the way to go.
UPDATE: Found this Jquery based script ( http://archive.plugins.jquery.com/project/clipboard ), that uses IE native API to access clipboard and Flash to all others. This could be a start point to merge all the others solutions and fallback to flash whether not available.
For Zero Clipboard, there is this one: http://www.steamdev.com/zclip/
I want to have my app which is minimized to capture data selected in another app's window when the hot key is pressed. My app definitely doesn't have the focus. Additionally when the hot key is pressed I want to present a fading popup (Outlook style) so my app never gets focus.
At a minimum I want to capture the Window name, Process ID and the selected data. The app which has focus is not my application?
I know one option is to sniff the Clipboard, but are there any other solutions.
This is to audit the rate of data-entry in to another system of which I have no control. It is a mainframe emulation client program(attachmate aka java-hosted telnet with 3250 support).
The plan is
complete data entry in Application X.
Select a certain section of the screen in App X which is proof of data entry (transaction ID).
Press the Magic Hotkey, which then 'sends' the selection to my App.
From System.environment or system.Threading I can find the Windows logon.
Similiarly I can also capture the time.
All the data will be logged to SQL.
Once Complete show Outlook style pop up saying the data entry has been logged.
Any thoughts.
Hooking the keyboard/mouse & screen scraping is pretty much the limit of what you can do with an applet. Remember Java is compiled to bytecode and run in the JVM. Because of the nature of the JVM, portability, and security concerns, you don't really have access to anything inside of the applet. All you will probably see from .Net is a "SunAwtFrame" classed window with no children.
The focus thing is doable, just use SendMessage (& other) API's to do what you need in the background and as long as you don't change the focus it will remain as is (ie. running code does not require focus)
As far as the data extraction goes, its going to come down to whether or not you can pull that info from the screen using some (potentially hardcore) image processing. Applets are a sort of no-mans land (from within .Net atleast), there is no JavaWindow.Textbox.GetAStringForMePlease().
For the record, there is an exception, if you physically control the applet. In that case you can make a sort of applet shell to hook the guts of the applet.
It sounds like you need to set up a global keyboard hook to capture the hot key this code project article shows how to do that (in C# but it's not much different):
http://www.codeproject.com/KB/cs/globalhook.aspx
And then you could use the FindWindow API to find the other apps window, then find the control that contains the "transaction ID" and use the WM_GETTEXT message to copy the text from it.
I'm doing a personal, just for fun, project that is using screen scraping to give me a System Tray notification in case another line on an HTML table is added, modified or deleted.
Having done this before I thought: well let's go with the regular expression thing and that's it, but being a curious person, made me think that there could be something else out there that could have another paradigm but be as simple to use.
I know about DOM and X-Path and all the xml'ish approaches. I'm looking for something outside the box, something that can even be defined in a set of rules so you can make a plugin system to aggregate various sites.
See Options for HTML Scraping
Here's an idea: assuming your main use case is getting a notification whenever an HTML file changes, why not use a standard diff tool and then loop through the changed lines, applying your rules?
Also, if this is a situation where you have access to the server and the files you're watching, you might be able to put everything under source control with CVS (or similar) and just watch for commits. If you want to use this approach for random sites on the web, just write a script that periodically downloads the html for the appropriate URLs and then commits it to source control and watch the diffs.
Not very practical, but outside the box.
If you can convert the source into valid XHTML/XML using something like SgmlReader or HtmlTidy then you could use XSLT. Simply create a XSL template for each site you wish to scrape.