⚛️ Atom 2 Smart Remote   🚚 FREE FEDEX SHIPPING from 397 USD   🌎 WORLDWIDE SHIPPING for 25 USD

Clavier Bluetooth

À propos de

MagiScript can turn a compatible device like the Atom into a Bluetooth keyboard. This enables the device to send keystrokes to a phone or computer that has been paired with it.

Pour utiliser le clavier et le support média dans MagiScript, vous devez appairer votre appareil avec le téléphone ou l'ordinateur cible. Une fois le processus de couplage terminé, vous pouvez utiliser les fonctions disponibles pour envoyer des frappes ou des commandes multimédia à l'appareil cible.

When Atom is paired with a phone, it automatically connects to Atom when turned on. You can still connect to Atom via Bluetooth from the same host device to develop mini-apps or use Atom. You can even pair another device, but this can start being unreliable. If you experience that you cannot connect to Atom again, or your device cannot pair with it, go to your Bluetooth settings to unpair Atom, and connect to it again.

Type de clavier

Le site keyboard.type() function allows you to type a string of characters on the target device. The function takes a string as its argument, and it types each character of the string sequentially. For example, if you want to type the string "Hello, world!", you can use the following code:

keyboard.type('Hello, world!');

Vous pouvez utiliser plusieurs valeurs, et même des nombres. Atom ajoutera un espace entre les deux :

keyboard.type('Hello', 'World');
keyboard.type('Temperature:', 42);

Tapotement du clavier

Le site keyboard.tap() function allows you to tap a specific key on the target device. The function takes a keyCode as its argument, which represents the key that you want to tap. The available keyCodes are listed below:

  • KBD_UP
  • KBD_DOWN
  • KBD_LEFT
  • KBD_RIGHT
  • KBD_PAGE_UP
  • KBD_PAGE_DOWN
  • KBD_HOME
  • KBD_END
  • KBD_BACKSPACE
  • KBD_TAB
  • KBD_RETURN
  • KBD_ESC
  • KBD_INSERT
  • KBD_PRTSC
  • KBD_DELETE
  • KBD_CAPS_LOCK
  • KBD_F1
  • KBD_F2
  • KBD_F3
  • KBD_F4
  • KBD_F5
  • KBD_F6
  • KBD_F7
  • KBD_F8
  • KBD_F9
  • KBD_F10
  • KBD_F11
  • KBD_F12

Par exemple, si vous souhaitez appuyer sur la touche "Entrée", vous pouvez utiliser le code suivant :

keyboard.tap(KBD_RETURN);

En outre, plusieurs clés peuvent être répertoriées :

keyboard.tap(KBD_UP, KBD_END);

Touche Media

Le site media.tap() function allows you to send media commands to the target device. The function takes a mediaKeyCode as its argument, which represents the media command that you want to send. The available mediaKeyCodes are listed below:

  • MEDIA_PLAY_PAUSE
  • MEDIA_NEXT_TRACK
  • MEDIA_PREVIOUS_TRACK
  • MEDIA_STOP
  • VOLUME_MÉDIA
  • VOLUME_DES_MÉDIAS
  • MEDIA_MUTE

Par exemple, si vous souhaitez lire ou mettre en pause la lecture d'un média sur l'appareil cible, vous pouvez utiliser le code suivant :

media.tap(MEDIA_PLAY_PAUSE);

Keyboard Send

Le site keyboard.send() command serves as the foundation for all other keyboard-related functions. For instance, the Custom Keyboard built-in application utilizes this command to transmit key presses. This allows users to configure the function and media keys in the settings (as strings).

When you pass a simple string, it will act as keyboard.type(). You can use keywords, it will act as a keyboard tap or media key tap.

There are two special keywords, their behaviour can be configure in the settings:

  • #SEPARATOR
  • #SUBMIT (usually an ENTER)

And the available keywords are:

  • #UP
  • #DOWN
  • #LEFT
  • #RIGHT
  • #PAGE_UP
  • #PAGE_DOWN
  • #HOME
  • #END
  • #BACKSPACE /
    #DEL /
    #DELETE
  • #TAB
  • #ENTER /
    #RETURN
  • #INS /
    #INSERT
  • #PRTSC
  • #CAPS_LOCK
  • #F1
  • #F2
  • #F3
  • #F4
  • #F5
  • #F6
  • #F7
  • #F8
  • #F9
  • #F10
  • #F11
  • #F12
  • #PLAY /
    #PAUSE /
    #PLAY_PAUSE
  • #NEXT
  • #PREV /
    #PREVIOUS
  • #STOP
  • #MUTE
  • #VOL_UP /
    #VOLUME_UP
  • #VOL_DOWN /
    #VOLUME_DOWN

Par exemple :

keyboard.send('Hello', '#SEPARATOR', 'World', '#ENTER', '#PLAY');

Note

It's important to note that not all devices support all keyCodes and mediaKeyCodes. Also, some devices may have additional keyCodes or mediaKeyCodes not listed here.

Conclusion

MagiScript offre un moyen simple et pratique de transformer un appareil compatible en clavier Bluetooth et d'envoyer des frappes ou des commandes multimédia à un appareil cible. Grâce aux fonctions disponibles, les développeurs peuvent créer diverses applications qui nécessitent une entrée clavier ou média.

croix