Simple If/Else?

Dustin M

New member
Trying to set up my phone to launch a specific media player if the time of day is in the morning but if it's after 10:00 a.m. then it will launch YouTube music. It's not working of course. The issue I'm running into is I am used to using IF/ELSE conditions but I see End/If being use in the place of an else condition. I'll have to look for the information on what these conditions stand for I guess.
 

Attachments

  • Screenshot_20220314-065053.png
    Screenshot_20220314-065053.png
    155.5 KB · Views: 44

Abalsam

Active member
Trying to set up my phone to launch a specific media player if the time of day is in the morning but if it's after 10:00 a.m. then it will launch YouTube music. It's not working of course. The issue I'm running into is I am used to using IF/ELSE conditions but I see End/If being use in the place of an else condition. I'll have to look for the information on what these conditions stand for I guess.
First what happens when the macro runs? Normally an if block is ended by an end. You can however add else and else if blocks after the if but before the end.

Additionally, in the image you pasted in the else block you have wait 10 seconds and then start playing media. As formulated those actions will only execute if YouTube music is launched. If it is meant to execute regardless of which media app is run, these actions would need to be moved in the macro. Hope that helps.
 

MacroDroidDev

Administrator
Staff member
Sorry but I have no idea what you are talking about with regards to IF and ENDIF. I think what you have is very clear, the launch iheart radio will be run if the time is between 04:00 and 10:00 and the rest of the action with be run at any other time. The ENDIF just signifies the end of the full IF statement so that any subsequent statements are not within the IF condition or any related ELSE clause.

You don't say what trigger you are using, how exactly it's failing and what your system log indicates is happening. Please provide more info to help diagnose what exactly the issue is.
 

Dustin M

New member
HHi the trigger is a time frame
Sorry but I have no idea what you are talking about with regards to IF and ENDIF. I think what you have is very clear, the launch iheart radio will be run if the time is between 04:00 and 10:00 and the rest of the action with be run at any other time. The ENDIF just signifies the end of the full IF statement so that any subsequent statements are not within the IF condition or any related ELSE clause.

You don't say what trigger you are using, how exactly it's failing and what your system log indicates is happening. Please provide more info to help diagnose what exactly the issue is.
 

Dustin M

New member
Thanks, the trigger is when my Bluetooth connects to my head unit in my car. Then it should check what time it is and if it's between 4:00 and 10:00 a.m. then it will launch iheartradio, else launch YouTube music.
 

Abalsam

Active member
Thanks, the trigger is when my Bluetooth connects to my head unit in my car. Then it should check what time it is and if it's between 4:00 and 10:00 a.m. then it will launch iheartradio, else launch YouTube music.
Would it be possible to post a screen shot of the entire macro here so that we can look at it in context? Also, could you provide details on what happens/does work and what does not work as expected? Thanks
 

Dustin M

New member
Also thanks for the explanation of the end/if. The condition by its name actually sounds like the macro is supposed to end IF something else happens. Lol
 

Dustin M

New member
Pretty much all I've done from the advice is I've moved the end/if down to the bottom and I will be testing this out once I get out of work, hence me changing the time frame to 5pm to initiate the else condition hopefully.
 

Attachments

  • Screenshot_20220316-124838.png
    Screenshot_20220316-124838.png
    150.8 KB · Views: 19

Abalsam

Active member
Pretty much all I've done from the advice is I've moved the end/if down to the bottom and I will be testing this out once I get out of work, hence me changing the time frame to 5pm to initiate the else condition hopefully.
When you run it what does it do? For example, does it even launch the right app? Does it launch the app but not start the music? Does it do nothing at all?

In order to troubleshoot the issue we need to know where/how it is stuck.

Thanks
 
Top