Platforms to show: All Mac Windows Linux Cross-Platform

Back to PresskeyMBS class.

PresskeyMBS.clear

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Remote Control MBS ComputerControl Plugin ✅ Yes ✅ Yes ❌ No ❌ No Desktop, Console & Web
Resets this object.

PresskeyMBS.mouseclick(down as boolean)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Remote Control MBS ComputerControl Plugin ✅ Yes ✅ Yes ❌ No ❌ No Desktop, Console & Web
Clicks the mouse button.

Clicks the mouse at current position.
Left button is used.
If you forget the mouseup you may loose control about a Mac with Mac OS X, but if you have enabled external terminal login you can login via SSH and quit Xojo from outside.

The Mac version sets the lasterror property.

See also:

PresskeyMBS.MouseClick(down as boolean, rightdown as boolean)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Remote Control MBS ComputerControl Plugin 8.1 ✅ Yes ✅ Yes ❌ No ❌ No Desktop, Console & Web
Clicks the mouse with the given buttons.

Same as MouseClick, but with an additional rightdown parameter.

See also:

PresskeyMBS.MouseMove(globalx as Integer,globaly as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Remote Control MBS ComputerControl Plugin ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Moves the mouse.
Example
dim x,y as Integer
dim p as PresskeyMBS
p=new PresskeyMBS
x=system.mousex
y=system.mousey+10 // move ten pixels down
p.mousemove x,y

Moves the mouse on screen.
The destination must be specified in global screen coordinates.
Requires Mac OS 8.5 or newer for Mac OS Classic.

PresskeyMBS.MouseMoveClick(globalx as Integer,globaly as Integer,down as boolean)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Remote Control MBS ComputerControl Plugin 2.8 ✅ Yes ✅ Yes ❌ No ❌ No Desktop, Console & Web
Moves the mouse.

Moves the mouse on screen and clicks.
The destination must be specified in global screen coordinates.
Requires Mac OS 8.5 or newer for Mac OS Classic.

The Mac version sets the lasterror property.

Mac OS X only:
Based on the values entered, the appropriate mouse-down, mouse-up, mouse-move, or mouse-drag events are generated, by comparing the new state with the current state.

See also:

Some examples using this method:

PresskeyMBS.MouseMoveClick(globalx as Integer,globaly as Integer,down as boolean, rightdown as boolean)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Remote Control MBS ComputerControl Plugin 8.1 ✅ Yes ✅ Yes ❌ No ❌ No Desktop, Console & Web
Moves the mouse cursor and clicks the mouse with the given buttons.

Same as MouseMoveClick, but with an additional rightdown parameter.

See also:

PresskeyMBS.press

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Remote Control MBS ComputerControl Plugin ✅ Yes ✅ Yes ❌ No ❌ No Desktop, Console & Web
Presses a key.
Example
' example for Mac OS X:
dim p as PresskeyMBS

p=new PresskeyMBS
p.shift=true
p.charcode=asc("H")
p.keycode=4
p.press 'press H
p.shift=false
p.charcode=asc("e")
p.keycode=14
p.press 'press e
p.charcode=asc("l")
p.keycode=37
p.press 'press l
p.press 'press l
p.charcode=asc("o")
p.keycode=31
p.press 'press o

' example for Windows:

editfield1.setfocus 'so we get something in it!

p=new PresskeyMBS
p.shift=true
p.charcode=asc("H")
p.virtualCode=-1 'automatically try to get this code
p.press 'press H
p.shift=false
p.virtualCode=-1 'after a call you find the virtualCode there
p.charcode=asc("e")
p.press 'press e
p.virtualCode=-1
p.charcode=asc("l")
p.press 'press l
p.press 'press l
p.virtualCode=-1
p.charcode=asc("o")
p.press 'press o

Simulates a keypress and handles the Settings for Shift, Control, Command and Option key.
Command shows no reaction in my tests for Mac OS Classic
On Windows, if you set virtualcode=-1 this method will set it to the code matching the charcode property.

The Mac version sets the lasterror property.

PresskeyMBS.pressraw(down as boolean)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Remote Control MBS ComputerControl Plugin ✅ Yes ✅ Yes ❌ No ❌ No Desktop, Console & Web
Presses a key.
Example
' Works perfectly on Mac OS X but Shift can't be done Raw on Mac OS 9:
dim p as PresskeyMBS

p=new PresskeyMBS

p.charcode=0
p.keycode=&h38
p.pressraw true 'shift down

p.charcode=asc("H")
p.keycode=4
p.pressraw true 'press H
p.pressraw false

p.charcode=0
p.keycode=&h38
p.pressraw false 'shift up

p.charcode=asc("e")
p.keycode=14
p.pressraw true 'press e
p.pressraw false
p.charcode=asc("l")
p.keycode=37
p.pressraw true 'press l
p.pressraw false
p.pressraw true 'press l
p.pressraw false
p.charcode=asc("o")
p.keycode=31
p.pressraw true 'press o
p.pressraw false

Simulates a keypress and doesn't handle the Settings for Shift, Control, Command and Option key.
On Windows, if you set virtualcode=-1 this method will set it to the code matching the charcode property.

The Mac version sets the lasterror property.

Some examples using this method:

The items on this page are in the following plugins: MBS ComputerControl Plugin.


The biggest plugin in space...