I need help with my script please

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
SweetLife
Posts: 14
Joined: 02 Jan 2023, 15:41

I need help with my script please

Post by SweetLife » 28 May 2023, 13:09

Here is what I have so far:

Code: Select all

v::
Click, 1182, 52
Sleep 30000
Click, 1276, 136
Send, ^w
Click, 704, 756
Click, {Down}
SendInput {Down}{Enter}
Sleep, 1000
Click, v
return
V should restart the process but it dose not. I'm still new to all of this but I know if I remove the Click, v at the bottom I need to click v manually and then it all starts again. I want to have this work as a way so I don't have to click the v every time.

This is what the code without the Click, v dose.

(1) I open Random Music which is a messed up folder of random songs inside my Music folder. I click on the very fist song and it opens in "Google Chrome".
(2) V - Clicks the "Shazam" icon extension and then waits about 30 seconds and then clicks in the open browser windows tab to select empty space and then closes the currently open tab.
(3) Click, {Down} selects Random Music folder again and open folder comes front and center.
(4) SendInput, {Down}{Enter} selects the next song in the list and then it opens in "Google Chrome" and auto plays.

I want it to automatically hit the same thing again and again. But v dose not work. Do I need to put the same code over and over or is there a work around some home.

wetware05
Posts: 750
Joined: 04 Dec 2020, 16:09

Re: I need help with my script please

Post by wetware05 » 28 May 2023, 13:20

Hi, SweetLife.

I see the path (the process), but not the intention (what it is done for: i think the internet is "overshadowing" the ability to read the minds of others). Do you have Google Chrome as your default player?

You have to create a loop, not call the same routine when v is pressed (this is the basic error), because I don't understand what such a process does or intends.

Code: Select all

v::
Loop
{
Click, 1182, 52
Sleep 30000
Click, 1276, 136
Send, ^w
Click, 704, 756
Click, {Down}
:SendInput {Down}{Enter} 
Sleep, 1000 ; This time seems short to start the process again.
}

SweetLife
Posts: 14
Joined: 02 Jan 2023, 15:41

Re: I need help with my script please

Post by SweetLife » 28 May 2023, 14:11

Originally I had setup (2) scripts and taken it down to (1).
I want to have 2 windows side by side but when using "Google Chrome" my my media player to play music files it would popup a extra icon and it kept moving the "Shazam" icon around a bit so I kept both windows full size and went and did this.

1. Open folder called Random Music select the first file and double click it so it would pop open a new tab on "Google Chrome" and then the song auto plays.
2. I click the "Shazam" icon within a few seconds once I'm sure media is playing audio and then I wait a few seconds for the songs information to be found by the extension
3. I then close the current tab and then go back to the folder and select the second song and continue.

I had made 2 scripts the first one was simple {Down}{Enter} pretty simple by hitting enter on the keyboard the selected song will open a new tab in "Google Chrome".
"Tip: I always kept the browser open and just kept it at new tab with only 1 tab open and then when new tab for player opened I just always closes it. This way I only have (2) tabs open and that is "New Tab" and "Player Tab".

I used v to click on the icon once media was playing and then I used sleep to wait for about 30 seconds some songs take a little longer to find. So 30 seconds is pretty good. I then click off the shazam icon in a empty spot to select the tab and then I close the tab and then I go back to the folder and then I just select down so it goes down one file and selects it with enter and then the tab opens and then the shazam gets clicked. But Shazam was not being clicked.

So I hope this helps make things a bit quicker.

SweetLife
Posts: 14
Joined: 02 Jan 2023, 15:41

Re: I need help with my script please

Post by SweetLife » 28 May 2023, 14:45

wetware05 wrote:
28 May 2023, 13:20
Hi, SweetLife.

I see the path (the process), but not the intention (what it is done for: i think the internet is "overshadowing" the ability to read the minds of others). Do you have Google Chrome as your default player?

You have to create a loop, not call the same routine when v is pressed (this is the basic error), because I don't understand what such a process does or intends.

Code: Select all

v::
Loop
{
Click, 1182, 52
Sleep 30000
Click, 1276, 136
Send, ^w
Click, 704, 756
Click, {Down}
:SendInput {Down}{Enter} 
Sleep, 1000 ; This time seems short to start the process again.
}
Okay I did need to tweak this a little for the going back to "Google Chrome" part. I needed to add a sleep right after opening the new tab otherwise it was clicking in the searchbar and not the "Shazam" icon since the icon was not in the correct place yet. Since the media icon that pops up when media starts to play did not appear yet. So I gave a little time to load the media button.

So other then adding a 10 after loop and adding a Sleep, 1000 before the click, 1182, 52 everything seems to be pretty good so far.

I do appreciate the help with the loop and the sleep idea. Thank You!

Post Reply

Return to “Ask for Help (v1)”