Alert function in java script

53 views
Skip to first unread message

rafi4...@gmail.com

unread,
Sep 26, 2020, 2:44:44 AM9/26/20
to Tasker
Hi joaomgcd 
Can I use alert function in java scriptlet as text dialog action?.
If yes how can I set variables to buttons?

Thanks in advance from record4
Screen shot 1601102273-1.png

Jay M

unread,
Sep 27, 2020, 7:33:04 AM9/27/20
to tas...@googlegroups.com
No, That's Java not JavaScript, Javascript only has 3 dialogs alert/confirm and prompt and as far as I know they can't be customized.

If you need more than 2 choices you could use the prompt dialog to do something like this.

--
You received this message because you are subscribed to the Google Groups "Tasker" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tasker+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tasker/01760047-cb27-421c-b690-67232365cd33n%40googlegroups.com.
Screenshot_20200927-122158_Tasker.png

rafi4...@gmail.com

unread,
Sep 27, 2020, 10:24:58 AM9/27/20
to Tasker
Hi Jay m 
Very interesting share me the script.

Thanks in advance from record4

Jay M

unread,
Sep 27, 2020, 1:22:48 PM9/27/20
to tas...@googlegroups.com
function myDialog()
{
var actions = "What do you want to do? (Enter number)\n\n1. Do this\n2. Do that\n3. Do something else"
var options = parseInt( prompt(actions, 1));
switch (options)
{
case 1:
// do something
break;
case 2:
// do something
break;

case 3:
// do something
break;
default:
// do some default thing
break
 }
 
}

myDialog();

Reply all
Reply to author
Forward
0 new messages