Re: EXTERNAL: Re: AppleScript UI for timed override code
Re: EXTERNAL: Re: AppleScript UI for timed override code
- Subject: Re: EXTERNAL: Re: AppleScript UI for timed override code
- From: "LaMantia, Brian" <email@hidden>
- Date: Fri, 05 Apr 2019 16:21:51 +0000
- Disclaimersource: eop
- Thread-topic: EXTERNAL: Re: AppleScript UI for timed override code
Okay... This worked.
do shell script "cd /Applications/Bit9/Tools; ./b9cli -timedoverride " &
textResponse
Now how do I get the results from the cli. Success returns the value "Timed
Override set" so I want hat to alet the user that the code was taken and valid.
I could maybe echo it back?
Brian LaMantia
On 4/5/19, 11:12 AM, "LaMantia, Brian" <email@hidden> wrote:
I removed the return. How does textResponse data get passed to the CLI?
The way I have it just passes "textResponse" to the shell. Of course that will
not work. I need the data from the variable passed to the shell. Thank you
Brian LaMantia
On 4/5/19, 10:13 AM, "Takaaki Naganoya" <email@hidden> wrote:
> 2019/04/05 23:51、LaMantia, Brian <email@hidden>のメール:
>
> Thank you Naganoya. I can see I’m going to like applescript. Now any
ideas on how to get the textResponse variable passed to the CLI in terminal?
>
> I added the do shell script and it doesn’t fail but I don’t know if
it failed. Maybe an echo? And can a variable be passed the way I have it in
the image?
https://eur02.safelinks.protection.outlook.com/?url=https://developer.apple.com/library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/reference/ASLR_handlers.html&data=02|01|email@hidden|f2583800e09c4742cef508d6b9d9407b|e3ff91d834c84b15a0b418910a6ac575|0|0|636900740083312575&sdata=m69WS2a11YolstqYV8PQqbY7gqaeSJoCpbbBqB5Hn6k=&reserved=0
“return” is a command to exit AppleScript sub-routine or quit execution
with printing the variable’s value.
My purpose was latter that returns user input value to shell script
(CLI Terminal).
So you have to delete “return textResponse” line.
--
Takaaki Naganoya
email@hidden
https://eur02.safelinks.protection.outlook.com/?url=http://piyocast.com/as/&data=02|01|email@hidden|f2583800e09c4742cef508d6b9d9407b|e3ff91d834c84b15a0b418910a6ac575|0|0|636900740083312575&sdata=KEDmmlZLw5XOw/65/aD2FCQvVDEgrT44WvUu7/F7E20=&reserved=0
> set theResponse to display dialog "Enter code: " default answer ""
with icon stop buttons {"Cancel", "Continue"} default button "Continue" with
hidden answer
>
> set code to button returned of the theResponse
> if code = "Cancel" then return ""
>
> set textResponse to (text returned of theResponse)
>
> display dialog ("Code is: " & textResponse & ".") buttons {"OK"}
default button 1
> return textResponse
>
> do shell script "cd /Applications/Bit9/Tools; ./b9cli -timedoverride
textResponse"
>
>
> Brian LaMantia
>
>
> From: Takaaki Naganoya <email@hidden>
> Date: Friday, April 5, 2019 at 2:07 AM
> To: Applescript Users List <email@hidden>
> Cc: "LaMantia, Brian" <email@hidden>
> Subject: EXTERNAL: Re: AppleScript UI for timed override code
>
> Hi,
>
> Your code dose not return actual result (User given code or canceled
status).
> You’d better to execute AppleScript code with Script Editor
(/Applications/Utilities/Script Editor.app).
> Then the return data will be obvious.
>
> <image001.jpg>
>
>
>> 2019/04/05 9:49、LaMantia, Brian <email@hidden>のメール:
>>
>> Hi all. I need a tool that will prompt a user to enter a code, then
have that code passed to shell, and finally the pass/fail response given to the
user. I don’t have much experience with applescript and I am trying to learn.
It’s confussing trying to workflow this going from applescript to sh. Does
anyone have a workflow that will help get me there?
>>
>> Thank you – Brian
>>
>> Workflow
>> • User given code
>> • User executes script
>> • User asked for token in UI/ user clicks continue
>> • Code is passed as variable to the shell. Something like (do shell
script “cd /Applications/Bit9/Tools; ./b9cli -timedoverride $code”
>> • Pass or fail results echoed back to the use in the UI.
>>
>>
>> CLI command in terminal (example of failure and success)
>>
>> path = /Applications/Bit9/Tools
>>
>> mac:Tools user$ ./b9cli -timedoverride <token>
>> Failed to decode password
>>
>> mac:Tools user$ ./b9cli -timedoverride <token>
>> Timed override set
>>
>>
>> Osascript idea to prompt for code
>>
>> /usr/bin/osascript <<EOT
>>
>>
>> set theResponse to display dialog "What's your code?" default
answer "" with icon stop buttons {"Cancel", "Continue"} default button
"Continue" with hidden answer
>>
>>
>> display dialog "My Secret Code is " & (text returned of theResponse)
& "."
>>
>> EOT
>>
>> The information contained in this message is proprietary and/or
confidential. If you are not the intended recipient, please: (i) delete the
message and all copies; (ii) do not disclose, distribute or use the message in
any manner; and (iii) notify the sender immediately. In addition, please be
aware that any message addressed to our domain is subject to archiving and
review by persons other than the intended recipient. Thank you.
_______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> AppleScript-Users mailing list
(email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>>
https://eur02.safelinks.protection.outlook.com/?url=https://lists.apple.com/mailman/options/applescript-users/maro_ml%40piyocast.com&data=02|01|email@hidden|f2583800e09c4742cef508d6b9d9407b|e3ff91d834c84b15a0b418910a6ac575|0|0|636900740083312575&sdata=Zo+zT0NnVBw3mYZXRyAKTTvcmNDNDkdzZC9FbR5KItE=&reserved=0
>> Archives:
https://eur02.safelinks.protection.outlook.com/?url=http://lists.apple.com/archives/applescript-users&data=02|01|email@hidden|f2583800e09c4742cef508d6b9d9407b|e3ff91d834c84b15a0b418910a6ac575|0|0|636900740083312575&sdata=tG5zkwtS0oyiOX3SmrQtG6hzcro60EaxeyFxsHKzJR4=&reserved=0
>>
>> This email sent to email@hidden
>
> --
> Takaaki Naganoya
> email@hidden
>
https://eur02.safelinks.protection.outlook.com/?url=http://piyocast.com/as/&data=02|01|email@hidden|f2583800e09c4742cef508d6b9d9407b|e3ff91d834c84b15a0b418910a6ac575|0|0|636900740083312575&sdata=KEDmmlZLw5XOw/65/aD2FCQvVDEgrT44WvUu7/F7E20=&reserved=0
>
>
>
>
> The information contained in this message is proprietary and/or
confidential. If you are not the intended recipient, please: (i) delete the
message and all copies; (ii) do not disclose, distribute or use the message in
any manner; and (iii) notify the sender immediately. In addition, please be
aware that any message addressed to our domain is subject to archiving and
review by persons other than the intended recipient. Thank you.
--
Takaaki Naganoya
email@hidden
https://eur02.safelinks.protection.outlook.com/?url=http://piyocast.com/as/&data=02|01|email@hidden|f2583800e09c4742cef508d6b9d9407b|e3ff91d834c84b15a0b418910a6ac575|0|0|636900740083312575&sdata=KEDmmlZLw5XOw/65/aD2FCQvVDEgrT44WvUu7/F7E20=&reserved=0
The information contained in this message is proprietary and/or confidential.
If you are not the intended recipient, please: (i) delete the message and all
copies; (ii) do not disclose, distribute or use the message in any manner; and
(iii) notify the sender immediately. In addition, please be aware that any
message addressed to our domain is subject to archiving and review by persons
other than the intended recipient. Thank you.
_______________________________________________
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