Take Screenshot of minimized application with Powershell possible? Needed for OCR later - powershell

is there a way to take a screenshot from a minimized application or if another application is opened in front it?
I'm using Powershell currently for a small script which take a screenshot of a specific desktop area where the application is in the foreground. This screenshot is used for an OCR-process in the same Powershell-script to read some values out of it.
It would be great to capture in background or another solution that the computer can be used at same time the script is running. (screenshot like every 30s)

Related

Control on which monitor application starts

I have an computer which runs monitoring application and has 6 monitors displaying various applications monitoring multiple systems. When this computer is restarted (which happens pretty regularly) someone always has to logon to the computer and reposition the application it is running.
Is there a way to start an application on a specific monitor with powershell? Best would be if it is possible to start a application on screen n. 2 f.e. and in maximized mode.
Another module needs to be downloaded, but this seems to handle what you're looking for.
https://superuser.com/questions/769575/set-many-programs-window-size-position

How to capture screenshots using UI automation on a iPhone?

I connected my iPhone 5s running iOS 8.3 to my mac which runs my script using "Automation Instrument" and I want to capture screenshots of UI during this process on my iPhone 5s and save them to my mac's disk at a particular location.
1.printing "target.logElementTree();" displays my elements but what I want is "Screenshot of device in realtime during run of automated script" so can we save the screenshot using this approach ????
2.I don't have the code of the app except the .ipa
Thanks for your time and efforts in going through or answering this question
With this command I am able to view the screenshot in trace log during automation.
UIATarget.localTarget().captureScreenWithName("Prabhu Konchada");
All we need to do is export these results to find them in the your desired folder !!!!

iOS app to run script

I would appreciate help in creating an iOS app to run a specified script at /var/mobile/script.sh. The script I have written opens a number of specified apps "all at once" on my jailbroken 6.1.2 iphone. Currently I run the script by starting MobileTerminal and manually running the script.sh file from the command line. I would like to be able to create an app that I could start via the Springboard which would run /var/mobile/script.sh directly.
I do not have a Mac and so I am unable to compile an app myself. I also do not have much experience of programming so I would appreciate any help on offer. I have seen an answer which is similar: iOS execute shell script from Activator
The answer provided above is VERY close to what I am looking for. However I have two problems with the Script.app as it stands:
1) As the script I have written opens a number of other apps which takes around two minutes to complete, the Script.app is automatically killed by iOS after about 20 seconds. I'm not sure if a flag "didFinishLaunchingWithOptions" needs to be set to allow Script.app to continue running so it can finish running my script? I have installed a package via Cydia called "Background Manager" - [which as I understand it makes all apps effectively think they are running in the foreground].
2) I have previously tested Script.app listed above on iOS 5 and the Script.app did run for around 20 seconds bringing the apps to the foreground as listed in my script.sh. On iOS 6.1.2 the Script.app runs certain commands in script.sh [e.g. killall commands] but when it comes to opening a specified app via the script it won't open any app [there is a blank black screen for 20 seconds and then the Script app closes without having opened any apps via the script.sh file]. However in iOS 6.1.2 if Script.app is started and immediately the home button is pressed to return you to the Springboard the Script.app will open apps via my script.sh for the first 20 seconds, so there appears to be a difference between the way the Script.app runs on iOS5 vs iOS6. I would like if Script.app could open apps via the script.sh without me having to immediately press the home button after Script.app starts on iOS 6
In my script file I use a command line package called "open" to specific which app to open via its CFBundleIdentifier: http://moreinfo.thebigboss.org/moreinfo/depiction.php?file=openData
Thanks for your help
Here's a technique that should work for you. It's not necessarily the way I'd solve it, but the solution is designed to work around you not having a Mac / Xcode.
One problem is that iOS expects normal "apps" to startup quickly, and begin responding to normal UI application events. If you use my original script launcher, it does not actually create a UIApplication, but simply calls system() from the main program. Assuming the call to system() completes quickly, there's no problem. But, if your script takes 20 seconds to run, that's too long, and iOS will kill the app.
You could build a normal UI application, calling UIApplicationMain(), and starting your long-running script after the app finishes startup. But really, you're not building an app. You simply want to use a SpringBoard icon to kick off a script. So, I don't think that solution makes a lot of sense.
What you probably want is a non-graphical daemon to run your long script for you. For this, you could build a Launch Daemon, and that might be how I solved the problem. But, without Xcode, that's tough. Another option is to take advantage of the privileged daemon that SBSettings has. You can use it to run your script. Then, your "app" need only fire off a notification to tell SBSettings to run that script. It can then exit, almost immediately.
Here is a pre-built binary that invokes a script named com.mycompany.script (get version 1.1). Install this app on your iPhone (it can be installed normally, in the sandbox area).
Then, you'll need to put your script at (this exact path and filename):
/var/mobile/Library/SBSettings/Commands/com.mycompany.script
For example, its contents might be:
#!/bin/sh
/usr/bin/open com.mycompany.AppOne
/usr/bin/open com.mycompany.AppTwo
/usr/bin/open com.mycompany.AppThree
exit 0;
where you're passing app bundle IDs to open. You can put whatever you want inside it. Make sure to login to your iPhone and set the right permissions on your script:
cd /var/mobile/Library/SBSettings/Commands/
chmod 755 com.mycompany.script
chown mobile.mobile com.mycompany.script
and then reboot (re-springing might be enough to get SBSettings to recognize your new script).
Note: for those who are coders, the main program of this app basically just contains this code:
#include <notify.h>
int main(int argc, char *argv[])
{
notify_post("com.mycompany.script");
return 0;
}

Chrome Packaged App and Dual Monitors

I am working on a packaged app that will use multiple displays. I need to be able to open windows in specific displays. I've also tried opening windows and then, using javascript, moving them to a monitor. But the app will not move any further than the bounds of the active display.
Any ideas on how to get this to work?
Use chrome.system.display.getInfo with this you can get the display info for each active display.
With displayInfo.workArea you can get the working area of each display, you just have to think of one big display and each display is a workArea. With this information you can move your window with
AppWindow#setBounds to the correct monitor. Be carfull, AppWindow#moveTo is not working.
Use AppWindow#setBounds
E.g.
chrome.app.window.get('mainWindow').setBounds({"height": 200, "left": 2000})
Tested on v34
Boom. Change this to correct answer.
This was not the solution I was hoping for but as one of the comments mentioned there is a bug with Chrome and multiple monitors. In my case this is an internal application so I'm able to install anything i need to make this work.
My solution was to create a console application which launches the chrome app and then moves the windows around using the Windows32 API. Obviously not ideal but it works and the user still just needs one click to launch the app.
You can write a chrome extension to get this done. In the Background script you can listen to chrome.windows.onCreated event and use chrome.windows.update function to move the windows to other monitors

Disabling Microsoft PixelSense (aka Surface) Surface Shell Timeouts

I am writing a game for the Microsoft PixelSense written in Unity, communicating with the table through the SurfaceToTUIO Bridge and the unity3d-tuio Unity Plugin.
I am currently trying to get the game to play nicely with the Microsoft PixelSense launcher. I have been able to get my application to appear in the launcher by mimicking the Surface Bing Application - duplicating a link to an XML file in C:\ProgramData\Microsoft\Surface\v2.0\Programs and creating the corresponding XML in the proper format.
When I go into Surface Mode - either through a dedicated Surface User Account, or through the Surface Shell on the Administrator's Profile, the game appears correctly on the launcher bar with the custom icon I set in the XML. The game launches correctly from the bar, and I can play it without any errors for about two minutes.
At that point, the Launcher closes my game. With a little research, I learned that its the Application's Responsibility to dismiss the Launcher.
Being that this is part of the Microsoft PixelSense SDK and not accessible to Unity, I've tried various methods to get around this:
I tried running the game in Single Application Mode. It turns out there is a different timeout that still waits for the SignalApplicationLoadComplete call.
I tried using the CriticalProcessMonitoring Disable and ApplicationProcessMonitoring Disable keys in the Registry.
I tried setting the LoadingScreenTimeout and SingleAppLoadingScreenTimeout Registry Keys to 0 - below their valid threshold.
What I want is to provide my users with the smoothest experience getting into and out of the Unity game. Currently we have to launch our game from the Windows Desktop, which can frustrate users due to the fact that Windows can't differientiate between a finger touching the screen, and a palm hovering above the screen.
Does anyone have a workaround, an good understanding of how I could spoof a SignalApplicationLoadingCall from Unity, or a suggestion of something to try?
Thanks!
Update: I've found some more things that didn't work:
I found the Microsoft.Surface DLL at C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.Surface\v4.0_2.0.0.0__31bf3856ad364e35. I imported it into my Unity project, but recieved a System.TypeLoadException that appears to be that the DLL is compiled with .NET 4.0, which Unity does not currently support.
I have been unable to find any COM objects that would allow me to communicate with the launcher without needing the DLL.
I cannot use a XNA wrapper program, as System.Diagnostics.Process.Start doesn't work in Surface Mode according to this post.