This lib will help you change system settings such as brightness, volume, color- mode, control your mouse,send notification,open windows, outputing available gadgets , connecting to wifi-network, enable/disable bluetooth device, collect data from devises.You can use this utility for your python project.In the github repository local submodules, install them - not need.However code not working - install them, run script
import driver_controller
print(driver_controller.OutputListsDevises().get_list_audio_devises(), driver_controller.OutputListsDevises().get_list_bluetooth_devises())
import driver_controller._mac_engine
channel = driver_controller._mac_engine.MacCmd().Wifi().wifiChannel()# 10
print(channel)
security = driver_controller._mac_engine.MacCmd().Wifi().SecurityType()# wpa2-psk
print(security)
speed = driver_controller._mac_engine.MacCmd().Wifi().get_last_speed_by_current_network()
print(speed) # 59
rssi = driver_controller._mac_engine.MacCmd().Wifi().RssiChannelValue()
print(rssi) # -61
# driver_controller._mac_engine.MacCmd().Wifi().connectToMacAddress() # Connect to wi-fi, which used your devise(Mac).
boolean = driver_controller._mac_engine.MacCmd().Wifi().isUsedProxy()# False
print(boolean)
noise = driver_controller._mac_engine.MacCmd().Wifi().WifiNetworkNoise()
print(noise) # -78
# driver_controller._mac_engine.MacCmd().Wifi().connectTo(wifi_network='Redmi Note 10 Pro', password='a404f46f67a')
print(driver_controller._mac_engine.MacCmd().Wifi().InfoNetwork())
'''[interfaceName=en0, ipv4State={
ARPResolvedHardwareAddress = "##:##:##:##:##:##";
ARPResolvedIPAddress = "192.168.1.1";
AdditionalRoutes = (
{
DestinationAddress = "192.168.1.66";
SubnetMask = "255.255.255.255";
},
{
DestinationAddress = "##########";
SubnetMask = "###########";
}
);
Addresses = (
"192.168.1.66"
);
ConfirmedInterfaceName = en0;
InterfaceName = en0;
}, ipv6GlobalSetup=(null)]'''
Make Lateral message with:
label: Main title on message
subtitle: Subtitle of message
text: Description of message
:param file_icon: Icon in message (Path to image)
(must locate in project-folder), Point out [None]
if you don't want used icon.
import driver_controller
driver_controller.MacCmd().Notifier().send_lateral_message(label='<YOUR_LABEL>',
subtitle='<YOUR_SUBTITLE>',
text='<TEXT>', file_icon='<FILE_ICON>',
sound=driver_controller.CONSTANT_SOUNDS.SOUND_POP_SOUND)
import driver_controller
driver_controller.MacCmd().Notifier().send_lateral_message(label='<YOUR_LABEL>',
subtitle='<YOUR_SUBTITLE>',
text='<TEXT>', file_icon='<FILE_ICON>',
sound=driver_controller.CONSTANT_SOUNDS.SOUND_POP_SOUND)
import driver_controller._mac_engine
br = driver_controller._mac_engine.MacCmd().Brightness()
br.set_birghtness(0.20) # Set birghtness
br.increase_brightness(3) # increase brightness by 3 division
br.decrease_brightness(3) # decrease brightness by 3 division
print(br.get_brightness) # Print brightness percent
br.set_max_brightness()
br.set_min_brightness()
import driver_controller
print(driver_controller.MacCmd().Switching().enable_wifi(),
driver_controller.MacCmd().Switching().unplug_wifi(),
driver_controller.MacCmd().Switching().enable_bluetooth(),
driver_controller.MacCmd().Switching().unplug_bluetooth())
import driver_controller
print(driver_controller.MacCmd().ScreenCapture().screenshot(filename='screenshot', extension='jpg', pause=2))
Method make image trough web-camera cam_index: index where local camera extension: extension of created image filename: name of created file.
import driver_controller
driver_controller.MacCmd().PhotoCapture().capture(cam_index=0,
filename='<NAME_OF_FILE',
extension='<FILE_EXTENSION>')
import driver_controller
driver_controller.MacCmd().PhotoCapture().capture(cam_index=0,
filename='<NAME_OF_FILE',
extension='<FILE_EXTENSION>')
from driver_controller import MacCmd
print(MacCmd(). SystemConfig().get_processor_name, # Intel(R) Core(TM) i7-4850HQ CPU @ 2.30GHz
MacCmd(). SystemConfig().current_connected_wifi_network, # Gavrilova_60_87_2.4ghz
MacCmd(). SystemConfig().screen_size, # ['2880', 'x', '1800']
MacCmd(). SystemConfig().macos_version, # Version your Mac os devise: 10.15.7
MacCmd(). SystemConfig().devise_battery, # Battery percent: 90%
MacCmd(). SystemConfig().mac_address(), # XX:XX:XX:XX:XX:XX
MacCmd(). SystemConfig().mac_location(), # (45.XXXXXXXXXXXXXX, 38.XXXXXXXXXXXXXX)
MacCmd(). SystemConfig().darwin_version, # x86_64-apple-darwin20.6.0
MacCmd(). SystemConfig().sensor_temperature(), # 94
MacCmd(). SystemConfig().get_disk_memory, # 500.3Gb
MacCmd(). SystemConfig().memory_size, # 16.0
MacCmd(). SystemConfig().mac_name, # admin
MacCmd(). SystemConfig().get_video_card_name, # NVIDIA GeForce GT 750M
MacCmd(). SystemConfig().get_mac_serial_number, # <SERIAL-NUMBER>
)
record_time : time of recording(seconds) camera_index: camera index filename: name of created file extensions, maybe mkv, mp4, mpg
from driver_controller import MacCmd
MacCmd().WebCameraCapture.webcam_capture(record_time=20, camera_index=0, filename='Out-Video', extension='mkv')
from driver_controller import MacCmd
Sound.pop_sound(iters=1), MacCmd().Sound.ping_sound(iters=1), MacCmd().Sound.blow_sound(iters=1), MacCmd().Sound.funk_sound(iters=1), MacCmd().Sound.glass_sound(iters=1), MacCmd().Sound.sosumi_sound(iters=1), MacCmd().Sound.submarine_sound(iters=1)
Write code for check clicked determined button in alert.
import driver_controller._mac_engine
choice = driver_controller._mac_engine.MacCmd().Notifier().send_warning_alert(labeltext='Buy new mac?', button1='Yes', button2='No')
if choice == 'Yes':
driver_controller.MacCmd().Notifier().send_text_alert('Thanks!', 'Wow!')
else:
print('Ok!')
import driver_controller._mac_engine
percent = int(input())
driver_controller.MacCmd().Volume().set_volume(percent)
vol = driver_controller._mac_engine.MacCmd().Volume()
print(vol.get_alert_volume,
vol.get_input_volume_percent)
vol.decrease_volume()
vol.increase_volume()
vol.set_min_volume()
vol.set_max_volume()
import driver_controller._mac_engine
driver_controller._mac_engine.MacCmd().Theme().change_color_mode(pause=1)# Change color mode for Mac.
import driver_controller._mac_engine
driver_controller._mac_engine.MacCmd().Open().url('https://github.com/Alexandro1112', 'Safari')
driver_controller._mac_engine.MacCmd().Open().open_spotlight()# Entry menu
channel = driver_controller._mac_engine.MacCmd().Open().application('FaceTime')
import driver_controller._mac_engine
sound = driver_controller._mac_engine.MacCmd().Sound()
sound.playSoundByName(soundfile='yoursound.mp3')# sound name
import driver_controller._mac_engine
mouse = driver_controller._mac_engine.MacCmd().Mouse()
mouse.mouse_click(200, 200) # Click in position x=200, y=200
print(mouse.mouse_position) # Return mouse position (x,y)
mouse.mouse_move(1300, 3
600) # Move mouse in position x=1300, y=300
mouse.move_click(600, 70) # Move, and click in position x=600, y=70
import driver_controller._mac_engine
size = driver_controller._mac_engine.MacCmd().AppConfigure().get_app_size('Yandex')
d = driver_controller._mac_engine.MacCmd().FileConfig().get_date_create_file('/Applications/Yandex.app')
path = driver_controller._mac_engine.MacCmd().AppConfigure().get_full_path_by_app_name('Safari')
print(size, ',', path, ',', d)
# 295M , /Applications/Safari.app , Thu Dec 5 22:30:38 2019
import driver_controller as dr
for i in range(10):
dr.MacCmd().Illumination().increase_illumination()
# Increase illumination from keys.
for i in range(3):
dr.MacCmd().Illumination().decrease_illumination()
# Decrease illumination from keys.
import driver_controller._mac_engine as MD
Addresses = list(MD.MacCmd().BlueTooth().get_all_address())[2] # Connect to third available bluetooth devise by address
MD.MacCmd().BlueTooth().pair_to_devise(Addresses, 20)
import driver_controller as dr
print(dr.MacCmd().Buffer().paste())
dr.MacCmd().Buffer().copyText('Copied text!')
# Command+C -> Copied text!
import driver_controller
MouseInit = driver_controller.MacCmd().Clicker()
MouseInit.press_hot_key('enter') # Print key enter
MouseInit.write('Hello world!!')
import driver_controller
current_img = driver_controller.MacCmd().BackGroundScreen().current_background_image()
print(current_img)
driver_controller.MacCmd().BackGroundScreen().set_backgroud(filename='file:/System/Library/Desktop\ Pictures/Dome.heic',
stretch_img_by_screen_size=False, # Param tied with stretch of image.
image_bg_color='black')
Label Text Icon
import driver_controller
current_img = driver_controller.WindowsCmd().Notifier().send_text_message(
label='New alert!',
text='Thanks for using driver-controller',
icon='stop') # Specify STOP, WARNING, or QUESTION
import driver_controller
driver_controller.WindowsCmd().Brightness().set_brightness(0.4)