Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- beritahu aplikasi "Terminal"
- get name -- application r/o
- -- "Terminal"
- get version -- r/o
- -- "1.5.1"
- get frontmost -- r/o
- -- false
- --activate
- --get every window -- application contains windows
- get front window -- window noun: A Terminal window
- -- get window 1
- -- window id 285
- copy result to W1
- get name of W1
- -- "Terminal — mksh — ttyp1 — 80x14 — 1"
- get index of W1
- -- 1
- get bounds of W1
- -- "Terminal — mksh — ttyp1 — 80x14 — 1" --
- get has close box of W1 -- window r/o GUI properties
- -- true
- get has title bar of W1
- -- false
- get floating of W1
- -- false
- get miniaturizable of W1
- -- true
- get miniaturized of W1 -- r/w
- -- false
- copy result to save_result
- repeat with Bounce in {true, false, true, false, true, false}
- set miniaturized of W1 to Bounce
- end repeat
- -- that works
- tell application "Script Editor" to activate
- -- was tired of doing that myself
- set miniaturized of W1 to save_result
- get modal of W1 -- r/o GUI property
- -- false
- get resizable of W1
- -- true
- get visible of W1 -- does this mean part of a Hidden Application?
- -- true
- get zoomable of W1
- -- true
- get zoomed of W1
- copy result to save_result
- repeat with StrobeZoom in {true, false, true, false, true, false}
- --get (a reference to zoomed of W1)
- --copy StrobeZoom to result
- --copy StrobeZoom to zoomed of W1
- -- Terminal get an error:NSArgumentWrongScriptError
- -- an app not accepting copy to syntax is typical.
- set zoomed of W1 to StrobeZoom
- delay 0.5
- end repeat
- -- that works
- set zoomed of W1 to save_result
- get position of W1 -- ................ What you should think!
- -- {119, 543}
- copy result to save_result
- tell application "Terminal" to activate -- I want to see this
- repeat with X in {0, 20, 40, 80, 120, 200, 240}
- copy {} to P -- need to make a point { X, Y }
- set P to P & X
- set P to P & (back item of save_result)
- set position of W1 to P
- delay 0.6
- end repeat
- set position of W1 to save_result
- get origin of W1 -- lower left corridinates,relative to L.L. of screen
- -- { 240, 192 }
- copy result to save_result
- repeat with Y in {100, 500, 250, 120, 10, 500}
- copy {} to P -- make a point again
- set P to P & (item 1 of save_result)
- set P to P & Y
- set origin of W1 to P
- delay 0.7
- end repeat
- set origin of W1 to save_result
- get size of W1 -- the width and height of the window
- -- { 863, 364 }
- copy result to save_result
- repeat with W in {800, 400, 1000, 200, 900}
- repeat with H in {300, 600, 400, 200, 500}
- copy {1, 2} to S -- make A Size a 2 item list
- set item 1 of S to W
- set item -1 of S to H
- set size of W1 to S -- don't forget to set Window, Dan!
- delay 0.77
- end repeat
- end repeat -- awesome! if a demo maybe stop here
- set size of W1 to save_result
- get frame of W1 -- the ORIGIN and SIZE of WINDOW
- -- {330, 194, 863, 364}
- -- ......................... Researcher to Teacher:
- -- .......................... Find the confused student, quickly
- copy result to save_result
- repeat with F in {{300, 100, 700, 400}, ¬
- {200, 200, 400, 400}, ¬
- {800, 800, 364, 863}, ¬
- {1, 1, 800, 360}, ¬
- {1000, 1000, 500, 500}}
- --That's COMMA OPTION ENTER 'CEPT LAST LINE
- set frame of W1 to F
- delay 0.55
- end repeat
- set frame of W1 to save_result
- get title displays device name of W1 -- is the ttyp in the title ?
- -- true
- copy result to save_result
- set title displays device name of W1 to false
- set title to name of W1
- --- "Terminal — mksh — 80x14 — 1"
- -- remember it's called the name
- set title displays device name of W1 to save_result
- get title displays shell path of W1 -- is the shellname or path there?
- -- true
- copy result to save_result
- -- get window 1 don't need this, just checking, it's the same
- -- window id 285 of application "Terminal"
- set title displays shell path of W1 to not save_result
- delay 0.8 -- 2.5 cleary, saw update
- set title displays shell path of W1 to save_result
- get title displays window size of W1 -- title has window size r/w!
- -- true
- get title displays file name of W1 -- title has filename boolean r/w!
- -- false
- copy result to save_result
- set title displays file name of W1 to true
- set title2 to name of W1
- delay 0.5 -- 2.5
- set title displays file name of W1 to save_result
- get title2
- -- "Terminal — mksh — ttyp1 — 80x14 — ~/Library/Application Support/Terminal/Steel14V.term — 1"
- -- so filename is gettable after a fashion
- -- so one could copy,and, perhaps modify to add new keybindings,
- -- font, etc.
- set title displays file name of W1 to save_result
- get title displays custom title of W1 -- title has prefix string
- -- true
- get custom title of W1
- -- "Terminal"
- copy result to save_result
- set custom title of W1 to "XXXXXXXXXXXXXXXXXXXX"
- delay 1.8
- set custom title of W1 to save_result
- get contents of W1 -- r/o visible contents of window as string
- copy result to buffer
- -- returning window id instead, not the string
- -- window id 285
- -- NO WORK, maybe try with osascript?
- -- write buffer to POSIX file "/tmp/TerminalAll.contents"
- -- converted to below or similiar on Compile
- -- write buffer to file "Hard Disk:private:tmp:TerminalAll.contents"
- --
- -- write buffer to file POSIX file "/tmp/TerminalAll.contents"
- -- need to touch the file, in order to create it, this way
- get history of W1 -- contents of window history plus on screen r/o
- -- copy result to buffer -- copy here created an issue
- set buffer to history of W1
- --open for access POSIX file "/tmp/TerminalAll.history" write permission yes
- --open for access POSIX file "/tmp/TerminalAll.history" write permission yes
- -- converted to line below on Compile
- open for access POSIX file "/tmp/TerminalAll.history" write permission yes
- copy result to fileno
- write buffer to fileno as string
- close access fileno
- -- then in Terminal, cd /tmp
- -- pbcopy < TerminalAll.history
- get number of rows of W1 -- number of rows in this Terminal window
- copy result to save_result
- repeat result - 1 times
- get (number of rows of W1) - 1
- set number of rows of W1 to result
- delay 0.65
- end repeat
- -- rows less than 4 ** will not do ** and window becomes unusable!
- set number of rows of W1 to save_result
- get number of columns of W1 -- number of columns in this window
- copy result to save_result
- repeat with C from 120 to 20 by -5
- set number of columns of W1 to C
- delay 0.25
- end repeat
- -- won't strink less than about 10 columns
- -- stays typeable, but with to 2 by -1, only 2 characters
- -- show on any given line, rest blank
- set number of columns of W1 to save_result
- get cursor color of W1 -- dictionary claims string
- -- {-19531, -19531, -19531}
- get cursor color of W1 as string
- -- "-19531-19531-19531"
- get cursor color of W1 as list
- -- {-19531, -19531, -19531}
- get normal text color of W1
- -- {-6424, -6424, -6424}
- -- swap text and backgroupd, obviously!
- copy normal text color of W1 to save_result
- set normal text color of W1 to (background color of W1)
- set background color of W1 to save_result
- delay 1.5
- set background color of W1 to normal text color of W1
- set normal text color of W1 to save_result
- delay 1.5
- get bold text color of W1
- -- from webcolor.scpt
- -- copy {65535, 65535, 65535} to default_color -- snow
- -- choose color default_color
- -- don't need those 3 lines above
- copy result to rgb_list
- copy item 1 of rgb_list to red
- copy item 2 of rgb_list to green
- copy item 3 of rgb_list to blue
- -- web format is 8 bit per color value, apple
- -- is returning 16 bit values, divide by 256
- -- solves this -- and rounding down!
- copy (round (red / 256) rounding down) to red
- copy (round (green / 256) rounding down) to green
- copy (round (blue / 256) rounding down) to blue
- -- convert to hex, no way to do this natively
- -- so call printf
- do shell script "printf %X%X%X " & space & red ¬
- & space & green & space & blue
- copy "#" & result as text to pastethis
- set the clipboard to pastethis
- -- "#191919"
- set cmdstring to "tput clear"
- -- tell W1 to do shell script cmdstring in window 1
- --do shell script cmdstring in (window 1 of application "Terminal")
- -- It's not working with in parameter!!!
- set RR to a reference to window 1 of application "Terminal"
- -- do shell script cmdstring in RR
- get busy of W1 --- is the window busy running a process r/o
- -- false
- get processes of W1 -- list of currently running r/o
- -- {"login", "mksh"}
- get busy of W1
- -- false -- sleep 200 -- but that's built in
- -- true -- gdd delay=100 if=/dev/zero of=/dev/null bs=4k
- get processes of W1
- -- {"login", "mksh", "gdd"}
- get busy of W1
- -- false -- bg of gdd
- get processes of W1
- -- {"login", "mksh", "gdd"} -- gdd is bg running
- get busy of W1
- -- false -- bg is running
- get frontmost of W1 --is this window in front of other Terminal windows
- -- true
- copy result to save_result
- repeat with TF in {true, false, true, false, true, false}
- set frontmost of W1 to TF
- delay 0.5
- end repeat
- set frontmost of W1 to save_result
- run -- run Terminal
- -- quit -- quit Terminal
- count windows -- return number of windows -- integer
- -- 2
- end tell
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement