Forum Archive

WiFi Name

DavinE

Hello Guys,

I have a Question, is it Possible That Pythonista can Return the current wifi Name ? Or ssid Nummer to Check wich wifi is connected ?

Thanks for reply ✌️

ccc

https://forum.omz-software.com/topic/3905/wifi-ssid/7

DavinE

@ccc,

I Found this too, but i get the error: "No method found for selector "isKindOfClass:"

The Name of the Wifi Works as well for me

cvp

@DavinE you could launch shortcut action "get wifi network name" and get back from Shortcuts app

cvp

@DavinE try, named a.py (or change in shortcut)

import webbrowser
import sys

if len(sys.argv) == 1:
    webbrowser.open('shortcuts://run-shortcut?name=getwifinetworkname')
else:
    print(sys.argv[1])

With shortcut getwifinetworkname https://www.icloud.com/shortcuts/872a7164f48742dea11e585c209a94a5

cvp

@DavinE still better, without stopping your app

import clipboard
import webbrowser
import time

webbrowser.open('shortcuts://run-shortcut?name=getwifinetworkname')
time.sleep(1)   
t = clipboard.get()
print(t)

The shortcut
- get the wifi name
- copies it in the clipboard
- opens Pythonista without running a new script, only to reset the running script foreground

The best solution should be to make Shortcuts running in background, but no actual way, except for an automation

cvp

And the best solution (if it works):

You could even define a shortcut with an automation "when my iDevice connects to any wifi network" with actions:
- get wifi name
- copy it into a file (in Shortcuts folder)

This shortcut will run in background.

Your script, when it needs this wifi name, should only read this file (in external Shortcuts folder ) and should get the current wifi name.

To be tested, obviously

Édit: automation works, at each network update, not tested with a file but with clipboard