Help with Opening Spotify and start playlist

General Macro Scheduler discussion

Moderators: Dorian (MJT support), JRL

myran1178
Junior Coder
Posts: 23
Joined: Fri Oct 23, 2020 7:26 am

Re: Help with Opening Spotify and start playlist

Post by myran1178 » Mon Oct 26, 2020 10:18 pm

Why does the script jump back to MS at the end instead of setting Spotify as active window?

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1348
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Help with Opening Spotify and start playlist

Post by Dorian (MJT support) » Mon Oct 26, 2020 10:35 pm

I'm guessing you're running it from the editor. That's to help debug. Exit the editor and see if it still does that.
Yes, we have a Custom Scripting Service. Message me or go here

myran1178
Junior Coder
Posts: 23
Joined: Fri Oct 23, 2020 7:26 am

Re: Help with Opening Spotify and start playlist

Post by myran1178 » Mon Oct 26, 2020 11:10 pm

It works but it sets Spotify as active even if I click yes when the script asks me if I wanna or not wanna continue what I did before the script started!

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1348
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Help with Opening Spotify and start playlist

Post by Dorian (MJT support) » Tue Oct 27, 2020 9:18 am

Your problem there is this line :

Code: Select all

If>%strResponse% = "Yes"
Which should be :

Code: Select all

If>%strResponse%=YES

Code: Select all

Ask>Vill du fortsätta med det du gjorde innan Spotify?,strResponse
If>%strResponse%=YES
  MDL>yes
Else
  MDL>no
Endif
...and always remember the Endif
Yes, we have a Custom Scripting Service. Message me or go here

myran1178
Junior Coder
Posts: 23
Joined: Fri Oct 23, 2020 7:26 am

Re: Help with Opening Spotify and start playlist

Post by myran1178 » Tue Oct 27, 2020 9:27 am

What do u mean with ”MDL” ?

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1348
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Help with Opening Spotify and start playlist

Post by Dorian (MJT support) » Tue Oct 27, 2020 9:36 am

myran1178 wrote:
Tue Oct 27, 2020 9:27 am
What do u mean with ”MDL” ?
MessageModal. To demonstrate the correct usage of If/Else/Endif. I suggest trying the code I provided so you can see exactly how it works.
Yes, we have a Custom Scripting Service. Message me or go here

myran1178
Junior Coder
Posts: 23
Joined: Fri Oct 23, 2020 7:26 am

Re: Help with Opening Spotify and start playlist

Post by myran1178 » Wed Oct 28, 2020 2:39 pm

How would your full code look like?

myran1178
Junior Coder
Posts: 23
Joined: Fri Oct 23, 2020 7:26 am

Re: Help with Opening Spotify and start playlist

Post by myran1178 » Wed Oct 28, 2020 6:51 pm

Hello!
I am finally done with my macro and I finally finished my macro!
This is the final code:

Code: Select all

run>Spotify.exe
WaitWindowOpen>Spotify Premium
Wait>10
UIFocus>{"Spotify Premium"},{"Niall Horan – Flicker (Deluxe)"}
Wait>1
UIClick>{"Spotify Premium"},{"Niall Horan – Flicker (Deluxe)"}
Wait>5
UIFocus>{"Spotify Premium"},{"Niall Horan – Flicker (Deluxe)"}
Wait>1
UIClick>{"Spotify Premium"},{"On The Loose"}
SetFocus>Spotify Premium
UIClick>{"Spotify Premium"},{"SPELA UPP"}
SetVolume>0
press ctrl
press left *20
release ctrl
SetVolume>20

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts