Sponsored Content
Full Discussion: Campimeter.sh for macOS
Top Forums Programming Campimeter.sh for macOS Post 303043482 by wisecracker on Wednesday 29th of January 2020 12:39:09 PM
Old 01-29-2020
Campimeter.sh for macOS

Hi Neo...
Quote:
I tend to have a low attention span, so when I get a proof-of-concept like this up and running (and prove it works), even if the final results are not "polished", I then want to "call it good enough" and quickly move on to the next project.
This is me too except for the attention span. As soon as I find a solution to something I let others better it.
And as for doing something different I have done some bizarre stuff on here... <wink> /Me awaits the mickey take... ;oD
OT: Here is a small snippet for a terminal window you might like under OSX 10.14.6 on this MBP, solved and going into the Campimeter code.
Code:
#!/bin/bash
# Campimeter.sh

clear

# Set terminal to full screen and default sizes.
set_size()
{
    osascript << "FULL_SCREEN"
        tell application "Terminal" to activate
        tell application "System Events" to keystroke "f" using { command down, control down }
        delay 3
FULL_SCREEN
}

initialise()
{
    clear
    printf "%b" "\033[0;30;47m"
    clear
    SIZE=( $( stty size ) )
    VERT_CENTRE=$(( ${SIZE[0]} / 2 ))
    HORIZ_CENTRE=$(( ${SIZE[1]} / 2 ))
    printf "%b" "\033[${VERT_CENTRE};${HORIZ_CENTRE}f\033[0;30;42m  \033[0;30;47m\033[1;1f"
}

set_size

initialise

printf "\033[33;33f\033[1;31;47m*\033[0;30;47m\033[1;1f"

sleep 3

set_size

Enjoy...

Last edited by wisecracker; 01-30-2020 at 03:29 AM.. Reason: Corrected the "shebang", 30-01-2020. Thanks Ravinder...
These 2 Users Gave Thanks to wisecracker For This Post:
 

6 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

UNIX on MacOS X

I am interested in knowing if anyone out there has been using the BSD UNIX that underlies MacOS X. Is this an "industrial strength" version of UNIX? Can I run X-Windows on such a machine? How about TeXing, pythoning, PERLing or using other useful UNIX goodies near and dear to my shrunken... (1 Reply)
Discussion started by: ncmathsadist
1 Replies

2. UNIX for Dummies Questions & Answers

Vuze/MacOS X: Too many open files

1) How can I stop Vuze from reporting the following error: "Too many open files" ? 2) What directory do I need to be in to effectively utilize this command: sudo bash -c 'ulimit -n 8192; sudo -u username ./azureus' ? 3) Is this the maximum number of files that I can allot to Vuze on OS X... (1 Reply)
Discussion started by: JFraser1
1 Replies

3. UNIX for Beginners Questions & Answers

Memory leak with awk on MacOs

Dear all, I use awk quite a bit for data wrangling ... today I find weird behavior that I cannot wrap my head around. if I execute the following command (simplified to illustrate the behavior ... nothing to do with the real command) bash-3.2$ awk... (3 Replies)
Discussion started by: comm|getline
3 Replies

4. UNIX for Beginners Questions & Answers

Macos is the UNIX?

why,just beacuse that its the bottom layer uses a small amount of bsd code? In my opinion, macos and Unix are completely different. The directories are long directory structures. For example, /application, /system, /user, /volumes, etc. are completely different from the traditional /bin/ /sbin... (5 Replies)
Discussion started by: malaizhichun
5 Replies

5. OS X (Apple)

MacOS 10.15 (Catalina) switches from bash to zsh

Interestingly Apple has decided to switch the default shell for new users from bash to zsh in MacOS Catalina (10.15) Use zsh as the default shell on your Mac - Apple Support Another interesting fact is that Catalina also comes with /bin/dash (5 Replies)
Discussion started by: Scrutinizer
5 Replies

6. OS X (Apple)

My original Python Campimeter code, originall for OSX 10.7.5.

Hi all... This was the original code I created to expand a terminal on the fly using Python 2.6.x to the now 3.8.0 without modification under OSX 10.7.5. I had no idea at the time that the MBP terminal could be full screen until here:... (0 Replies)
Discussion started by: wisecracker
0 Replies
OSASCRIPT(1)						    BSD General Commands Manual 					      OSASCRIPT(1)

NAME
osascript -- execute AppleScripts and other OSA language scripts SYNOPSIS
osascript [-l language] [-s flags] [-e statement | programfile] [argument ...] DESCRIPTION
osascript executes the given script. It was designed for use with AppleScript, but will work with any Open Scripting Architecture (OSA) lan- guage. To get a list of the OSA languages installed on your system, use osalang(1). For documentation on AppleScript itself, see <http://www.apple.com/applescript>. osascript will look for the script in one of the following three places: 1. Specified line by line using -e switches on the command line. 2. Contained in the file specified by the first filename on the command line. This file may be plain text or a compiled script. 3. Passed in using standard input. This works only if there are no filename arguments; to pass arguments to a STDIN-read script, you must explicitly specify ``-'' for the script name. Any arguments following the script will be passed as a list of strings to the direct parameter of the ``run'' handler. For example: a.scpt: on run argv return "hello, " & item 1 of argv & "." end run % osascript a.scpt world hello, world. The options are as follows: -e statement Enter one line of a script. If -e is given, osascript will not look for a filename in the argument list. Multiple -e options may be given to build up a multi-line script. Because most scripts use characters that are special to many shell programs (e.g., AppleScript uses single and double quote marks, ``('', ``)'', and ``*''), the statement will have to be correctly quoted and escaped to get it past the shell intact. -l language Override the language for any plain text files. Normally, plain text files are compiled as AppleScript. -s flags Modify the output style. The flags argument is a string consisting of any of the modifier characters e, h, o, and s. Multiple modi- fiers can be concatenated in the same string, and multiple -s options can be specified. The modifiers come in exclusive pairs; if con- flicting modifiers are specified, the last one takes precedence. The meanings of the modifier characters are as follows: h Print values in human-readable form (default). s Print values in recompilable source form. osascript normally prints its results in human-readable form: strings do not have quotes around them, characters are not escaped, braces for lists and records are omitted, etc. This is generally more useful, but can introduce ambiguities. For example, the lists '{"foo", "bar"}' and '{{"foo", {"bar"}}}' would both be displayed as 'foo, bar'. To see the results in an unambiguous form that could be recompiled into the same value, use the s modifier. e Print script errors to stderr (default). o Print script errors to stdout. osascript normally prints script errors to stderr, so downstream clients only see valid results. When running automated tests, how- ever, using the o modifier lets you distinguish script errors, which you care about matching, from other diagnostic output, which you don't. SEE ALSO
osacompile(1), osalang(1) HISTORY
osascript in Mac OS X 10.0 would translate ' ' characters in the output to ' ' and provided c and r modifiers for the -s option to change this. osascript now always leaves the output alone; pipe through tr(1) if necessary. Prior to Mac OS X 10.4, osascript did not allow passing arguments to the script. Mac OS X June 10, 2003 Mac OS X
All times are GMT -4. The time now is 05:19 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy