Hi.
I have a straightforward issue:
I launch Hotkeyz.exe with a dos .bat script (Start /MIN Hotkeyz.exe) and have configured the program to go "Hidden" when I click on the close button or Press Alt+F4 on it. Therefore it doesn't close, but goes hidden, which is what I want. The problem is that it launches but it is still just minimized and not closed. The issue is that a user can then ALT+TAB to it and perform unwanted actions. Therefore I need only the following:
I need a simple vbscript which would bring into focus the Hotkeyz.exe application (Which will be minimized) and send it an Alt+F4. After this the vbscript must just close. This would then effectively tell the program to go "Hidden" and avoid the users from Alt+Tab'ing to it and potentially editing and breaking the Hotkeyz.exe app settings. (Intentionally or unintentionally) I would prefer if this script can be compatible with Windows XP and above. Please let me know if any further information is required.
Rob Sampson's VBScript should work fine for what you need, but just for your additional information it is possible to create a step-by-step script and wrap it up into one program Exe using great little free applications like:
http://www.autohotkey.com/
http://www.autoitscript.com/site/autoit/
If you use little scripts quite a lot to perform repetitive tasks it might be worthwhile having a look. basically you run through the actions in a similar way to manually recording a Macro in MS Word, except that you use the program to discover things like the Window Title and the names of the buttons, check boxes, text fields, etc, and compile your script which can then be saved as a single executable. In other words, you could have a program launcher that opens Hotkeyz.exe and then hides it all in one go.
There are also a couple of simpler programs by the same author that wrap up BAT/CMD or VBS files into a single executable:
VBS to EXE: http://www.f2ko.de/programs.php?lang=en&pid=v2e
(Online version to test: http://www.f2ko.de/programs.php?lang=en&pid=ov2e)
BAT to EXE: http://www.f2ko.de/programs.php?lang=en&pid=b2e
(Online version to test: http://www.f2ko.de/programs.php?lang=en&pid=ob2e)
Various useful command line tools: http://www.f2ko.de/programs.php?lang=en&pid=cmd
Remember, this is just for your additional info in future. Rob has answered your question with a script that should work fine for you.
Bill