Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Need Help  (Read 2751 times)

0 Members and 1 Guest are viewing this topic.

Soro

  • Guest
Need Help
« on: February 05, 2008, 07:32:43 AM »
I want to create a batch file that starts a program (.exe) and then run some parameters that are in his program integrated, but not as open parameters so everybody can see them... But their linked with hotkeys like Ctrl + F4 or F7 etc.
And now my question: How is it possible to give the command to the batch file that it must press these keys together or separated? Because the keys are on my keyboard and not available for a program that runs inside my computer...

Soro

  • Guest
Re: Need Help
« Reply #1 on: February 06, 2008, 07:28:31 AM »
Is it even possible to create a batch that does this task? If not how about other programming languages?
Thank you for your Replies.

Sidewinder



    Guru

    Thanked: 139
  • Experience: Familiar
  • OS: Windows 10
Re: Need Help
« Reply #2 on: February 06, 2008, 07:49:24 AM »
Doubtful you could do this in batch code. Most any scripting language can send keystrokes. VBScript and JScript (free and already installed on Windows machines) have a sendkeys method where you could send both combo keys (CTL-F4) or single keys (F4).

Need more info: the name of the exe file, the title of the window your exe creates, the key sequence, the window layout, and any timing considerations between keystrokes.

 8)
The true sign of intelligence is not knowledge but imagination.

-- Albert Einstein

Soro

  • Guest
Re: Need Help
« Reply #3 on: February 06, 2008, 08:15:45 AM »
OK here we go:
the exe file is called kernel.exe but i can open the exe file with START <path\kernel.exe>;
the title of the window is T-Online StartCenter 6.0 (a German program);
the key sequences are shift + f4 (these two at the same time) and f4 (2sec after the other hotkeys);
But i just need the codes for the Hotkeys because i have found a solution for the time periods in this forum... If i get the codes for the hotkeys than i could simply add the fragments together ;)
But thank you for your help

What do you mean with window layout?

Sidewinder



    Guru

    Thanked: 139
  • Experience: Familiar
  • OS: Windows 10
Re: Need Help
« Reply #4 on: February 06, 2008, 08:35:00 AM »
If you're using VBScript the F4 key is {F4} and shift+F4 is +{F4}

Quote
What do you mean with window layout?

Many posters need to fill out some sort of form. It helps to know the window layout before blindly sending keystrokes.

Good luck with your project.  8)

The true sign of intelligence is not knowledge but imagination.

-- Albert Einstein

Soro

  • Guest
Re: Need Help
« Reply #5 on: February 07, 2008, 08:52:14 AM »
ah ok thank you a lot :D ;D

Soro

  • Guest
Re: Need Help
« Reply #6 on: February 08, 2008, 04:36:41 PM »
excuse me that bothering again but my program still won't work... I have no idea how the VBScript part could look like, because Im a absolute newbie with batch and VBScript files :'(
Another Question is how can I integrate VBScript in my batch code or have I to write an extra *.vbs and start it with START? Because all I found out yet is how to include VBScript in Html documents...
Im in your debt thank you for your patience

Sidewinder



    Guru

    Thanked: 139
  • Experience: Familiar
  • OS: Windows 10
Re: Need Help
« Reply #7 on: February 08, 2008, 04:55:57 PM »
This little snippet should meet your requirements:

Code: [Select]
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "kernel.exe"
WScript.Sleep 250
WshShell.AppActivate "T-Online StartCenter 6.0"
WScript.Sleep 250
WshShell.SendKeys "+{F4}"
WScript.Sleep 2000
WshShell.SendKeys "{F4}"
WScript.Sleep 250

Add drive and path information to kernel.exe if necessary.

Save the script with a vbs extension and run from the command prompt as cscript scriptname.vbs

Good luck. 8)
The true sign of intelligence is not knowledge but imagination.

-- Albert Einstein

Soro

  • Guest
Re: Need Help
« Reply #8 on: February 08, 2008, 05:57:20 PM »
thank you now it finally works :D ;D