• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to set green color in Terminal.app to a specific color code?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to set green color in Terminal.app to a specific color code?


  • Subject: Re: How to set green color in Terminal.app to a specific color code?
  • From: Takaaki Naganoya <email@hidden>
  • Date: Tue, 27 Feb 2018 09:42:55 +0900

(1)Communicate via mailing lists, there are “unhappy word wrapping”. After
deleting some return characters, my script runs.

(2)If you try other people’s sample AppleScript, you have to use Script Editor,
first. It is more safer way. Terminal and osascript is more complicated and
harder way. Nobody write AppleScript by thinking of osascript & Terminal.

(3)I wrote whole script on my blog. You can get whole script only by clicking
“★Click Here to Open This Script” link without a loss. Whole script will be
transfered to Script Editor. Run script by Control-R on your Script Editor, you
will get the result.


http://piyocast.com/as/archives/2420


--
Takaaki Naganoya
email@hidden
http://piyocast.com/as/


> 2018/02/27 8:44、Peng Yu <email@hidden>のメール:
> On Tue, Feb 6, 2018 at 12:53 AM, Takaaki Naganoya <email@hidden>
> wrote:
>> How about make a color-name —> color value table by yourself?
>>
>> <AppleScript>
>> use AppleScript version "2.4"
>> use scripting additions
>> use framework "Foundation"
>> use framework "AppKit"
>>
>> set ansiColTable to {{colName:"Green", colVal:{0, 53713, 0}},
>> {colName:"Red", colVal:{38937, 0, 710}}, {colName:"Blue", colVal:{0, 0,
>> 39429}}}
>>
>> set aRes to filterListUsingPredicate(ansiColTable, "colName ==[c] %@",
>> "Blue")
>> if aRes = missing value then return
>>
>> set colList to colVal of aRes
>>
>> tell application "Terminal" to set normal text color of window 1 to colList
>>
>> on filterListUsingPredicate(aList as list, aPredicateStr as string, targStr
>> as string)
>>        set setKey to current application's NSMutableSet's setWithArray:aList
>>        set aPredicate to current application's NSPredicate's
>> predicateWithFormat_(aPredicateStr, targStr)
>>        set aRes to (setKey's filteredSetUsingPredicate:aPredicate)
>>        return (aRes's allObjects()) as list of string or string
>> end filterListUsingPredicate
>> </AppleScript>
>
> I got the following error. Do you know what is wrong with it?
>
> $ cat  ./main.scpt
> #!/usr/bin/env osascript
> # vim: set noexpandtab tabstop=2 shiftwidth=2 softtabstop=-1
> fileencoding=utf-8:
>
> use AppleScript version "2.4"
> use scripting additions
> use framework "Foundation"
> use framework "AppKit"
>
> set ansiColTable to {{colName:"Green", colVal:{0, 53713, 0}},
> {colName:"Red", colVal:{38937, 0, 710}}, {colName:"Blue", colVal:{0,
> 0, 39429}}}
>
> set aRes to filterListUsingPredicate(ansiColTable, "colName ==[c] %@", "Blue")
> if aRes = missing value then return
>
> set colList to colVal of aRes
>
> tell application "Terminal" to set normal text color of window 1 to colList
>
>    on filterListUsingPredicate(aList as list, aPredicateStr as
> string, targStr as string)
>    set setKey to current application's NSMutableSet's setWithArray:aList
>    set aPredicate to current application's NSPredicate's
> predicateWithFormat_(aPredicateStr, targStr)
>    set aRes to (setKey's filteredSetUsingPredicate:aPredicate)
>    return (aRes's allObjects()) as list of string or string
> end filterListUsingPredicate
>
> $  ./main.scpt
> ./main.scpt:913:915: script error: Expected end of line, etc. but
> found “of”. (-2741)
>
>
>
>
> --
> Regards,
> Peng

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: How to set green color in Terminal.app to a specific color code?
      • From: Peng Yu <email@hidden>
References: 
 >How to set green color in Terminal.app to a specific color code? (From: Peng Yu <email@hidden>)
 >Re: How to set green color in Terminal.app to a specific color code? (From: Takaaki Naganoya <email@hidden>)
 >Re: How to set green color in Terminal.app to a specific color code? (From: Peng Yu <email@hidden>)

  • Prev by Date: Re: How to set green color in Terminal.app to a specific color code?
  • Next by Date: Re: How to set green color in Terminal.app to a specific color code?
  • Previous by thread: Re: How to set green color in Terminal.app to a specific color code?
  • Next by thread: Re: How to set green color in Terminal.app to a specific color code?
  • Index(es):
    • Date
    • Thread