osx - Bash output as Applescript list problems -
It's just driving me crazy. I'm trying to read a file in Bash, delete duplicate, sort , And then display the "List Options" window by CelestScript.
My $ DATALOG file is formatted like this:
field1 field2
area 1 field 3
field1 field4
etc ...
AppsScript = awk '{print $ 2}' $ DATALOG | Awk '! X [$ 0] ++ '| Sort-u | Tr "_" "" | Sed 's / ^ / \ "/' | sed 's / $ / \" /' | Tr "\ n" "," | Sed 's /.$//'/code>
Now, this line works great. In the $ applet, I get an output like this:
"Field 2", "Field 3", "Field 4"
I need to
Now, I take that output, and add a backslash before quotes, and seplescript parts.
Applescript = 'Repeat' application to return "system events" (choose from the list {$ Applescript}) "| Sed 's / \" / \\\ "/ g '
And this gives me what I need:
Tell the application \ "System Events \" (Select from the list {\ " Field 2 \ ", \" Field3 \ ", \" Field 4 \ "})
Now, I command the Osspath:
osascript -e $ Appletcript
and I get an error:
4: 4: Syntax Error: expected expression but end of script found (-2741)
Then, I add quotation:
osascript -e "$ Applescript
And I get an error:
17:18: Syntax error: Expected expression, property or key form etc. But unknown token found. (-2741)
I can not tell what hell is going on here, so I decide to make an echo copy of the $ airport And I decide to use it as a variable.
airport = enter "system events" to apply back (choose from the list {\ "field2 \", \ "field3 \", \ "field 4 \" })
And it works without any modification.
So ....
I need to know how to do this without having to set its variable permanently
P> Do not try to make it even more complex than it is necessary to create a shell word for the Osascript -e argument, the benefit of two string bidding characters of the shell Raise:
Applescript = $ (awk '{print $ 2}' $ DATALOG | awk '! X [$ 0] ++' | sort -u | tr "_" "" sed 'S / ^ / \ "/' | sed 's / $ / \" /' | tr "\ n" ", | | Sed 's /.$//') osascript -e 'to return' system Tell event "(list Also, choose from {{"" $ Applescript "}}
In addition, it is a good idea to avoid using backlit to replace the command; $ ( Command)
form is preferred because it is very easy to create the right commands even when dealing with complex settlements.
Comments
Post a Comment