• 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: Peng Yu <email@hidden>
  • Date: Mon, 26 Feb 2018 17:44:18 -0600

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: Takaaki Naganoya <email@hidden>
    • Re: How to set green color in Terminal.app to a specific color code?
      • From: 2551phil <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>)

  • Prev by Date: Re: AppleScript-Users Digest, Vol 15, Issue 33
  • 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