terminal – How to include variables in the text shown in a osascript display dialog

Spread the love

I’m creating a cool script to bother me by asking to close the app with the name of the variable after the specified minutes. The osascript display dialog is become more complex. Now it’s working thanks to the help got here.

But I’m not being able to get the variable PROCESS_NAME properly:

DIALOG_RESULTS="$(osascript -e 'set {T,B} to {text returned, button returned} of (display dialog "Minutes to remember to close $((PROCESS_NAME))" default answer "1" with icon caution buttons {"Keep Open", "CLOSE APP & take a break"} default button 1)' -e 'return T & "t" & B')" &&MINUTES_UNTIL_ASK_TO_CLOSE="$(echo "$DIALOG_RESULTS" |cut -f 1)" &&BUTTON_RETURNED="$(echo "$DIALOG_RESULTS" |cut -f 2)"

The current (wrong) output is this:

Minutes to remember to close $((PROCESS_NAME))

The desired (correct) output should be:

Minutes to remember to close Telegram

Author: Dhanraj7978

Leave a Reply

Your email address will not be published. Required fields are marked *