AppleScript選擇一個(gè)文件夾,上傳這個(gè)文件夾內(nèi)部的所有ipa到ssh遠(yuǎn)程服務(wù)器

場(chǎng)景:我們用ios-ipa-server發(fā)ipa給測(cè)試時(shí),會(huì)首先把ipa放到ssh遠(yuǎn)程服務(wù)器,如果手動(dòng)操作還是挺麻煩的,會(huì)用到scp命令,還得復(fù)制本地ipa包的地址,還有ssh服務(wù)器放ipa包文件夾的地址,這些死命令,自動(dòng)化些,還是更加人性化的,昨晚花了一晚上,終于出品了




set appName to "Terminal"
set appID to bundle identifier of (info for (path to application appName))
set theFolder to choose folder with prompt "選取ipa所有的文件夾,注意你的ipa名字中不能包含中文"
tell application "Finder"
    set fileList to every file of theFolder whose name extension is "ipa"
    if (count of fileList) < 1 then
        set alertTitle to "當(dāng)前目錄沒(méi)有找到ipa文件"
        set okBtnName to "好的,我再找找"
        display dialog alertTitle buttons {okBtnName} default button okBtnName
    else
        
        repeat with theFile in fileList
            set fileName to name of theFile
            tell application "Terminal"
                if it is not running then
                    activate
                end if
            end tell
            tell application "System Events"
                tell application process "Terminal"
                    tell application "System Events"
                        set visible of process appName to true
                        set frontmost of process appName to true
                    end tell
                    keystroke "1" using command down
                    keystroke "t" using command down
                    delay 0.5
                    set theFilePath to theFile as alias
                    
                    set scpString to "scp "
                    set scpString to scpString & POSIX path of theFilePath
                    set scpString to scpString & " 服務(wù)器上存在ipa的文件夾地址"
                    keystroke scpString
                    keystroke return
                    delay 0.8
                    tell application "System Events"
                        tell process "Terminal"
                            set frontmost to true
                            delay 1
                            keystroke "服務(wù)器ssh密碼"
                            keystroke return
                        end tell
                    end tell
                    --keystroke theFilePath
                    keystroke return
                end tell
            end tell
            
        end repeat
    end if
end tell


最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

推薦閱讀更多精彩內(nèi)容