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 » Sun Oct 25, 2020 3:13 pm

Ignore this reply!

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

Re: Help with Opening Spotify and start playlist

Post by myran1178 » Sun Oct 25, 2020 10:22 pm

THAT MEANS THIS PART:

Code: Select all

//🠗IF I CLICKED NO, REACTIVATE SPOTIFY AGAIN AND MAXIMIZE SPOTIFY. NEEDS HELP WITH THIS LINES 31-54🠗
Else
// C:\Users\Miranda\AppData\Local\Temp\msrFBE6.scp
// Recorded on  lördag, oktober 24, 2020, at 05:12 PM

//Recorded Events
Let>WW_TIMEOUT=5
CapsOn
MouseMove>485,749
Wait>1.613
//Clicking on: 
//SnapShotFile>%BMP_DIR%snapshot_32.png
Wait>1.531
LClick
Wait>0.282
//Activating Window: 
//SnapShotFile>%BMP_DIR%snapshot_33.png
WaitWindowOpen>Spotify Premium
MoveWindow>Spotify Premium,486,112
ResizeWindow>Spotify Premium,800,600
Wait>2.937
SetFocus>Niall Horan - On The Loose
MouseMoveRel>1219,127
Wait>8.959
LClick

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) » Sun Oct 25, 2020 11:22 pm

If you want to close Spotify I suggest trying either CloseWindow or KillProcess>spotify.exe
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 8:37 am

I want that if I click the ”no” button when the macro asks me if I wanna continue what I did b4 the macro started, then the macro sets Spotify as active window and maximizing the Spotify 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 9:57 am

I see. In that case between Else and Endif you need :

Code: Select all

WindowAction>1,Spotify Premium
SetFocus>Spotify Premium
This does exactly as you ask.
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 10:25 am

Why does this part suddenly only clic on the playlist in the left sidebar but doesnt open the playlist and doesnt start the song? Havent changed anything in that part!

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*
UIClick>{"Spotify Premium"},{"SPELA UPP"}
press ctrl
press left *20
release ctrl

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:48 am

myran1178 wrote:
Mon Oct 26, 2020 10:25 am

Code: Select all

UIClick>{"Spotify Premium"},{"On The Loose"}
SetFocus>Spotify*
UIClick>{"Spotify Premium"},{"SPELA UPP"}
press ctrl
press left *20
release ctrl
Could it be a timing issue? It may be too fast for Spotify. See if the reliability is improved with some waits.
Maybe re-run the Find Object Wizard on those buttons and see if the code is the same. Maybe something has changed.
I'm not too sure why you focus>click>focus again, and only you will know from your experiments if that was intentional and necessary. I'm assuming it's intentional as you said it did what you wanted. Other than that, I think I am out of suggestions.
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 6:16 pm

how could that part work differently now than before without any changes?

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 6:21 pm

Sometimes there can be subtle underlying changes to an application that we may not notice. It's sometimes worth re-running the Wizard again to rule that out.
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 6:24 pm

solved it before I read your reply. Now I will finally test your idea for when clicking no in the message.

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 6:34 pm

Would you like to share your solution to help others?

It's good to see you becoming self sufficient. You'll be a pro before you know it.
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 6:40 pm

Now I runned the full code with your "windowsaction. set focus" idea at the end. This error displays.
https://imgur.com/a/avr7Rur
The "Line 27" that the error is talking about is this line:

Code: Select all

WindowAction>1,Spotify Premium

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 6:42 pm

Dorian (MJT support) wrote:
Mon Oct 26, 2020 6:34 pm
Would you like to share your solution to help others?

It's good to see you becoming self sufficient. You'll be a pro before you know it.
I will post my final solution! When my full script is fully finished!

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 6:54 pm

If you wrote this script, how would your full code be?

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 6:57 pm

myran1178 wrote:
Mon Oct 26, 2020 6:40 pm
Now I runned the full code with your "windowsaction. set focus" idea at the end. This error displays.
https://imgur.com/a/avr7Rur
The "Line 27" that the error is talking about is this line:

Code: Select all

WindowAction>1,Spotify Premium
Then edit it to reflect the actual name of the window. This worked perfectly when I used it on Spotify Free. You can use the built in tool to find system windows, or use GetActiveWindow to ensure your window title is correct.

https://help.mjtnet.com/article/212-fin ... cannot-see

https://help.mjtnet.com/article/31-how- ... ect-window
Yes, we have a Custom Scripting Service. Message me or go here

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