2

I would like to have a script to launch one of my application automatically, but due to the setting of the program, the application has to be launched while holding down the Ctrl key (for the entire time until the application fully loaded up) for it to work properly.

Now, I know that in Batch we can do something like this

START "" "C:\Program Files\Microsoft Office\Winword.exe" "D:\Docs\demo.txt"

But, how could I implement a holding Ctrl key?

If you know any other script types that could do this, such as VB or PowerShell, I am willing to try, too.

Thanks

CB4
  • 690
  • 3
  • 13
  • 25

1 Answers1

2

Arguments are picked up with:

My.Application.CommandLineArgs 

Regarding the ctrl key I would strongly recommend you to alter the way your software works because it is rather stupid.

If you absolutely must have the ctrl key pressed down I would suggest looking into things like this: http://tksinghal.blogspot.se/2011/04/how-to-press-and-hold-keyboard-key.html

WozzeC
  • 2,630
  • 1
  • 13
  • 12
  • Thanks, That works! But, is there a way for me to check whether the Application has finished loading? Because I want to launch multiple program sequencially using C# – CB4 Dec 03 '12 at 18:47
  • Also, why does the Press() and Release() have same arguments – CB4 Dec 03 '12 at 19:01
  • Regarding press and release you can clearly see that release has changed a 0 to the constant KEYEVENTF_KEYUP. Regarding the application you probably have to use a cross application event. Here's an SO thread about it: http://stackoverflow.com/questions/17878/listen-for-events-in-another-application – WozzeC Dec 04 '12 at 10:26