場景:我們用ios-ipa-server發(fā)ipa給測試時剑令,會首先把ipa放到ssh遠(yuǎn)程服務(wù)器,如果手動操作還是挺麻煩的拄查,會用到scp
命令吁津,還得復(fù)制本地ipa包的地址,還有ssh服務(wù)器放ipa包文件夾的地址堕扶,這些死命令碍脏,自動化些,還是更加人性化的稍算,昨晚花了一晚上典尾,終于出品了
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)前目錄沒有找到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