Skip to content

Instantly share code, notes, and snippets.

@zinking
Created July 22, 2023 14:53
Show Gist options
  • Save zinking/694dd5c97aa9317e44587c8e9b8623fd to your computer and use it in GitHub Desktop.
Save zinking/694dd5c97aa9317e44587c8e9b8623fd to your computer and use it in GitHub Desktop.
apple_script
file=$1
fdir=$(dirname "$file")
fbar=$(basename "$file")
ffoo=$(basename "$fdir")
echo "$fdir $fbar $ffoo"
fdcmd="cd /data/tdwadmin/zhnwang/dataware/$ffoo"
sdcmd="deploy $fbar $fbar -f"
export PUB_FD_CMD="$fdcmd"
export PUB_SD_CMD="$sdcmd"
echo $PUB_FD_CMD
echo $PUB_SD_CMD
export PUB_FILE="$fbar"
export PUB_DIR="$fdir"
export FILE_PATH="$file"
osascript <<'ENDAPP'
tell application "WeTERM" to activate
tell application "System Events"
set fdCmd to system attribute "PUB_FD_CMD"
set sdCmd to system attribute "PUB_SD_CMD"
set filePath to system attribute "FILE_PATH"
set the clipboard to filePath
# send change directory command
keystroke "3" using {option down}
tell application "System Events" to keystroke fdCmd
key code 36
delay 1
tell application "System Events" to keystroke sdCmd
key code 36
delay 1
keystroke "/"
keystroke "v" using {command down}
keystroke return
keystroke return
end tell
# tell application "WeTerm"
# set pfile to system attribute "PUB_FILE"
# set pdir to system attribute "PUB_DIR"
# open pdir
# select pfile
# end tell
ENDAPP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment