AppleScript

随便写写不专业

查看UUID
system_profiler SPUSBDataType | grep "Serial Number:.*" | sed s#".*Serial Number: "##

Mac虚拟地址修改
//查看所有网卡地址
networksetup -listallhardwareports
//修改 en1 网卡 输入 电脑密码 password
echo 'password' | sudo -S ifconfig en1 ether 00:00:00:00
//查看修改
ifconfig en1 | grep ether
显示隐藏系统文件 没错 AppleScript
//瞎写的 还能用
on run {input, parameters}
    display alert "显示或隐藏系统文件?" buttons {"取消", "显示", "隐藏"}
    set btnResult to button returned of result
    if btnResult is "显示" then
        tell application "Finder" to quit
        tell application "System Events" to do shell script "defaults write com.apple.finder AppleShowAllFiles -bool true"
        delay 1
        tell application "Finder" to launch
    else if btnResult is "隐藏" then
        tell application "Finder" to quit
        tell application "System Events" to do shell script "defaults write com.apple.finder AppleShowAllFiles -bool false"
        delay 1
        tell application "Finder" to launch
    end if
    return input
end run
允许未知来源App
on run {input, parameters}
    set passwordStr to (item 1 of input)
    do shell script "echo " & passwordStr & " | sudo -S spctl --master-disable"
    return input
end run
选中文件夹快捷键打开Xcode项目.支持Pod
on run {input, parameters}
    
    set filelist to input as list
    
    repeat with oneItem in filelist
        set onefile to oneItem as string
        if onefile contains "xcworkspace" then
            tell application "Xcode"
                open onefile
            end tell
            return
        end if
        
    end repeat
    
    repeat with oneItem in filelist
        set onefile to oneItem as string
        if onefile contains "xcodeproj" then
            if onefile does not contain "Pod" then
                tell application "Xcode"
                    open onefile
                     activate
                end tell                
                return
            end if
        end if
    end repeat  
    say "sorry,找不到要打开的项目" using "ting-ting"
end run
App Store自动登录
-- Function for App Store sign in
property loginBtn : "登录"
property logoutBtn : "注销"
-- Launch App Store

tell application "App Store" to activate

tell application "System Events"
    tell process "App Store"
        set frontmost to true
        try
            click menu item loginBtn of menu "商店" of menu bar 1
        on error
            click menu item logoutBtn of menu "商店" of menu bar 1
            delay 2
            click menu item loginBtn of menu "商店" of menu bar 1
        end try
        delay 1
        
        keystroke "account"
        keystroke tab
        keystroke return
        delay 1
        -- Type account password
        keystroke "password"
        -- Press the return key
        keystroke return
    end tell
end tell

你可能感兴趣的:(AppleScript)