Beginner
Date of registration: Sep 15th 2009
Location: Waxahachie TX USA
Occupation: Student
Hobbies: Computer Programming, Computer Hacking.
|
|
Jabaco Source |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
Public Sub Command1_Click() Timer1.Enabled = True Timer1.Interval = Text2.Text End Sub Public Sub Command2_Click() Close End Sub Public Sub Command3_Click() Timer1.Enabled = False End Sub Public Sub Timer1_Timer() SendKeys.Send(Text1.Text) SendKeys.Send "{enter}" End Sub |
This post has been edited 1 times, last edit by "KusaNoKaito" (Sep 17th 2009, 2:43pm)
Date of registration: Jan 1st 2009
Location: Hanover, Germany
Occupation: Software Engineer
Hobbies: Hilbert Curves
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
import java.awt.Robot;
import java.awt.event.KeyEvent;
/**
* @author imran
* Description : Used to toggle the multimonitor display in Win XP.
*/
public class MultiMon {
public static void main(String[] args) {
try {
//Invoke the desktop setting applet, the 3rd tab should be selected
Runtime.getRuntime().exec("control.exe desk.cpl,@0,3");
//Pause for a second....
try {
Thread.sleep(1000);
}catch (InterruptedException ex){
}
//Create a new robot that can do the system interaction for us...
Robot robot = new Robot();
//Activate the "Display" field...
robot.keyPress(KeyEvent.VK_D + KeyEvent.ALT_MASK);
//Choose the second monitor
robot.keyPress(KeyEvent.VK_2);
//goto the "Extend my windows desktop" checkbox...
robot.keyPress(KeyEvent.VK_TAB);robot.keyPress(KeyEvent.VK_TAB);
robot.keyPress(KeyEvent.VK_TAB);robot.keyPress(KeyEvent.VK_TAB);
robot.keyPress(KeyEvent.ALT_MASK);
robot.keyPress(KeyEvent.VK_E );
//toggle the check box...
robot.keyPress(KeyEvent.VK_ENTER);
//clear references...
robot = null;
//exit the application
System.exit(0);
} catch (Exception e) {
// Things did'nt work out....
e.printStackTrace();
}
}
}
|
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 |
java.awt.Robot SendKeysRob;
public void SendKeys(String skey) {
SendKeys(skey, 0);
}
public void SendKeys(String skey, int wait) {
If (SendKeysRob = null) SendKeysRob = new Robot;
int a = Asc(skey);
SendKeysRob.keyPress(a);
If (wait > 0) SendKeysRob.delay(wait);
}
|
|
|
Jabaco Source |
1 2 3 4 5 6 7 |
Dim SendKeysRob As java#awt#Robot Public Sub SendKeys(skey As String, Optional wait) If SendKeysRob Is Nothing Then SendKeysRob = New Robot Dim a As Integer = Asc(skey) SendKeysRob.keyPress(a) If wait > 0 Then SendKeysRob.delay(wait) End Sub |
|
|
Jabaco Source |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
Option Explicit Dim keyInput() As String = ( _ " ", "W", "E", "L", "C", "O", "M", "E", " ", _ "T", "O", " ", "J", "A", "B", "A", "C", "O") Public Sub Command1_Click() Call Shell("notepad.exe", vbNormalFocus) End Sub Public Sub Command2_Click() Timer1.Enabled = True End Sub Private Sub Timer1_Timer() Static i As Integer If i <= UBound(keyInput) Then Call SendKeys(keyInput(i)) i = i + 1 Else Timer1.Enabled = False i = 0 End If End Sub |
thanks for the hint to the missing function