-1
我一直在尝试通过编写几行简单的代码来探索AppleScript。我试着写了一小段,让我可以访问可用的Wi-Fi列表,并将密码输入到所述的Wi-Fi。AppleScript Wi-Fi连接器
到目前为止,我已经到了可以识别Wi-Fi的地步,但不允许我将Wi-Fi制作成字符串。我已经编写了从列表中选择Wi-Fi的代码,但我无法弄清楚如何将Wi-Fi列入清单。
任何人都可以帮助我解决这个问题吗?
display dialog "Wifi Selector © Afnaan Qureshi"
set main to display dialog " ." buttons {"Quit", "Enter Password"}
if main = {button returned:"Enter Password"} or trueaftermain = "1" then
set results to paragraphs 2 thru -1 of (do shell script "/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -s | sed -nE 's/[ ]*(.*) [a-z0-9]{2}:[a-z0-9]{2}:.+/\\1/p'")
set my_list to results
set AppleScript's text item delimiters to ", "
set list_2_string to my_list as text
set main to display dialog my_list
set wpass to choose from list {my_list} with title "Pick The Wifi" with prompt "Choose WPA2" OK button name "Choose" cancel button name "Cancel" default items {"quit"}
end if
当我试图调试不适合你的代码时,我建议你看看[如何创建一个最小,完整和可验证的示例](https://stackoverflow.com/help/mcve)。 – user3439894