Script to open two applications on start up and snap them with one being 80% screen and the other being 20% in Windows 8.1 Desktop - powershell

I am not a programmer rather a designer but have been trying to write a .bat file for weeks to have two applications, which I specify, open automatically and snap to a scale of 80% left hand side and 20% for the second app on the right hand side. I have looked into multiple options without having any luck. Currently, I can create a script to open two files and automate key strokes to have them snap 50-50%, however I really need the 80-20% screen real estate. Any chance anyone would be able to help me out?
I am currently trying to use PowerShell with WASP (http://wasp.codeplex.com/) but scripting in this is beyond my knowledge. Many thanks!

You should try UI Automation PowerShell Extensions.
It supports testing for Metro Apps. The initial setup is a bit tedious (as described in the link provided) but it is well worth it. You have a UI action recording tool UIAutomationSpy which records all of your actions and generates corresponding PowerShell scripts. You can then run these scripts using the UIARunner tool.
With respect to the current problem, you could simulate the steps for snapping the apps using the recorder. You could then create a task which runs a batch file (executing the concerned script) on startup.

Related

Powershell won't pass keystroke to cli window

I first need to offer the disclaimer that I am barely a novice when it comes to scripting or coding, so I might be doing this all wrong in the first place. I'm running into an issue with a script I had written in powershell a while ago that is used on several hundred computers in my company daily to automate starting a certain app that everyone uses. So far everyone else hasn't had an issue except one machine.
Normally when I run the script, it starts the services and cli for the program which opens in a new window. Then the script, still open behind that, sends all of the key commands to that cli window, pauses for a brief line of user input after which it closes that cli window, does a few other clean up tasks and closes out itself.
The only difference on this one machine that's not working is the script won't pass the keystrokes to the cli window. If I put them in manually including the normal user input, it finishes the rest of the script just fine, but the cli window is just not receiving the keystroke input from the main script.
The only part of the script that send the keystrokes to the cli window is a few lines of this:
[System.Windows.Forms.SendKeys]::SendWait("Text{Enter}")
I have tried using the sleep command before and in between the key commands to make sure it's not going through the keystrokes to early. I've checked and windows had gone through an Update two days ago, but we would've heard about this issue right then if that was it. I'm at a loss for what the issue could be and would apreciate and help, tips, or direction to help figure this one out.
Is the console window the active window when the keys are sent? The documentation for the class you are calling indicates that it sends the keys to the active window. Not only that, but the documentation also seems to indicate that there are some issues that developers have run into when using that class to sends keys. I would try using the autoit powershell module instead. Autoit is its own scripting language which specializes in automating windows processes and being capable of automating interactions with windows forms, but also comes bundled with its own powershell module that I think is exactly what you need, so I would download the portable "zip" package, extract the powershell module from "Autoitx", and that should help you accomplish what you need
PowerShell automation especially when using SendKeys can / is glitchy due to many varying reasons. Can you use SendKeys sure, but you have to know the environment it will be run in and the needed performance details. Hence your futzing/guessing with Sleep.
There are purpose-built tools to help.
Auto HotKey
'PowerShell auto hotkey'
or the UIAutomation tool
'PowerShell automating other applications'

Interactive Perl programming in Sublime 3 (Ubuntu)

Practically all of the exercises in my introductory Perl book have so far required taking input, which is causing me some challenges with Sublime Text 3. I set up the custom build file from this post to run scripts directly and I've also installed REPL on top of that, but I'm still unable to provide input through the bottom console.
Is there a way to enable input for scripts built via Ctrl+B, preferably with the console messages getting a little less in the way? I'm currently stuck with having to fire up the terminal every time, which doesn't make for a particularly smooth learning experience.
This doesn't really help you with your Sublime issue, but you mention firing up a terminal every time isn't helping you learn - here's the way I do it when I'm either learning or rapidly prototyping: Simply setup a folder on your local machine, called sync or something. Create a similar folder on your terminal server.
Now use an app (I use WinSCP and use Keep Remote Directory Up To Date setting) to sync. Every time you press save in your text editor, the new script is automatically uploaded to your terminal server, you can now just alt+tab to your terminal and run the script. Works very well for me and enabled really easy rapid prototyping.

Script that runs itself every now and then

I work in marine systems institute. We have a buoy that sends information about the sea every few hours to a central computer in the institute. It drops it as a .txt file in a certain folder. It would be really great if I could make a script that looks into that folder every 3 hours and checks if there are any new files. If there is a new file, it should upload it to an ftp.
I have no idea where to start. Are there any suggestions what language, where to look, what to search etc.
The computer is running 24/7 and the script can easily be an executable that is active all the time. The script doesn't have to restart itself every time, it can be up and running 24/7 also.
Thanks in advance
EDIT1: My op.sys is windows
If your platform is Windows, I suggest Windows Forms Application. An IDE is available, Visual Studio - it is easy to use and has everything you need for your application. You basically need a timer object that will execute a function (checking the file) in a certain interval. 3 hours is long enough, you can even check it every 5 min.
AutoHotKey can be learned by anyone in a day, and is powerful enough to do what you describe.
A program written in a real language could do exactly what you like with full customization, robustness, portability, and maintainability, but will take quite a bit longer to make.
It might be a little over your head if you never done any programming(Forgive me if you have).
A good solution is to use FileSystemWatcher http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx. Then create a windows service to run it.
But again that takes some experience implementing.
Try using an ftp client such as smartftp which can watch the folder where the files are created, and automatically upload them.

Making and Interfacing with Custom Services

I've been searching for this for awhile now, and I am not sure if I am just not using the correct search terms or if the answer is really that hard to find.
What I am trying to do is to create a new Windows service for a game server from a batch file, and then have a task run another batch file every 30 minutes or more that would run two commands on the game server's command line and do some file work.
Specifically, I am running a Minecraft server using Bukkit for a gaming community I help run, and I want to make sure that the thing is always up unless I specifically tell it to stop (like a service). Bukkit is run directly from a batch file and has it's own command line thing running on it.
I am told that you CAN run this type of thing as a service, but the command line will be hidden from view and/or interaction. This is the second part of my query. I have a handy little backup.bat file that copies all the world files and userdata files into a backup directory, 7zips it, and deletes the directory. The only thing is, is that Minecraft likes to always have the worlds' region files open and writing at all times, meaning that it could cause map corruption if I just run it straight off. To compensate, I need to run the command "save-off" on the server to disable the file hooks temporarily, run the backup, and as soon as it finishes, run "save-on" so that the game can continue without lost data.
What I would like to know about this second one is, is it possible to interface with the game service through a batch file, or do I need to create an application to do that? If the latter, how exactly does one go about doing that? I have moderate C++ knowledge (up through my second OO-C++ course in college), and can possibly learn another language if absolutely necessary.
So, in short, two questions:
1. Is it possible to, and how to run a BAT file as a Windows Service?
2. How to interface with said service via BAT files, and if not possible, what kind of application do I need to write (redirection to or writing a tutorial works for me).
Thank you in advance for any and all help!
Old question, user account doesn't seem active on SO anymore, but hey, if you stumble upon this because you have a similar problem:
Since we are speaking about a Bukkit Minecraft server, turn to the "Essentials" plugin for Bukkit.
It now includes a Backup function that does exactly what the OP asks for, namely stop the save so the files can be manipulated without corruption, launch a script, then starts again.
The script can be a backup one (examples provided in the linked page) but can be used to run any operation on the world's files.

Automate Human Activity software

Anyone know any softwares that can simulate human interaction on desktop browser specifically by clicking or entering some data and run some report and print automatically obviously with some programming behind this. Main, it will be used for reducing business process steps on human interaction day to day activity (possibly testing purpose in the future).
I am appreciated your comment or input.
Thanks
I tried a few different automation tools myself when trying to automate desktop software, one is AutoIt which is one of the most complete in my opinion. It helps to automate small tasks, ie: select a window and press a button to do the rest. It even has a macro recorder to get you started.
Telerik WebUI Test Studio
Watir
Selenium
...to name a few
To keep up with the namedropping, here's 2 APIs for Java:
Robot
Abbot (Built on top Robot)