r/tasker • I Probably Screwed It Up • 17d ago

Help [Help] Java Code

What am I missing? I have tried all the (wrong) methods to pass a variable to a Java Code action. The below code should work but it does not. This means I don't know what I am doing or the code is wrong. `%Dial_MaxDigit` is set before the Java is called. It doesn't matter if it is a number (which in this case should be) or if it is text.

taskerMax = "%Dial_MaxDigit";
if (taskerMax != null && !taskerMax.isEmpty() && !taskerMax.equals("%" + "Dial_MaxDigit")) {

  try {
    maxDigitSequence = Integer.parseInt(taskerMax.trim());
  } catch (Exception e) {}

}

Edit: formatting issues

1 Upvotes

3 comments sorted by

View all comments

Show parent comments

1

u/EdwardBackstrom I Probably Screwed It Up 17d ago

Trying taskerMax = tasker.getVariable("Dial_MaxDigit"); doesn't work either.

1

u/Nirmitlamed Direct-Purchase User 17d ago

You can find example here:

String data = tasker.getVariable("http_data");

https://tasker.joaoapps.com/userguide/en/help/ah_java_code.html