Hi,
I would like to open .mp3 file, "Play my song", which is located in my D:\ drive. Currently using Potplayer to open all my media player. This song will be my alarm clock at 6:00am. When done, close the Potplayer. The song is about 3 minutes long.
Thank you.
Open .mp3 at certain time and close after play
Re: Open .mp3 at certain time and close after play
Code: Select all
ppPath := "...\podplayer.exe" ; TBA !!
SetTimer, KickMeLikeBeckham,% 1000*60 ; check every minute
Return
KickMeLikeBeckham:
FormatTime, CurrentTime,, HH:mm ; hh:mm = 12h format | HH:mm = 24h format
If (CurrentTime = "06:00") {
ToolTip % CurrentTime
RunWait, %ppPath% "D:\play my song.mp3", Hide, PID
Process, Close,% PID
ToolTip
}
Return
Re: Open .mp3 at certain time and close after play
Since I can open the mp3 directly. Not going to include ppPath.
Below is the code I currently using but it will continuously open the same file until the script is stopped.
How can I change this?
Below is the code I currently using but it will continuously open the same file until the script is stopped.
Code: Select all
#persistent
SetTimer, CheckTime, 1000
Return
CheckTime:
FormatTime, CurrentTime,, HH:mm
If (CurrentTime = "06:00")
{
Run, "C:\(my file location)"
}
Return
Re: Open .mp3 at certain time and close after play
You can use SoundPlay to play .mp3
Re: Open .mp3 at certain time and close after play
You're using Run instead of RunWait. Checking the time every second (1000ms) will probably open 60 concurrent instances of the same song at the time the condition is met, right? Correct me if I'm wrong but you seem to ignore that you'll open a separate podplayer instance with each iteration, so once a song has finished playing you'll end up with a still existing podplayer process??
Re: Open .mp3 at certain time and close after play
Thank you. Will check it later.Xtra wrote:You can use SoundPlay to play .mp3
![Smile :)](./images/smilies/icon_e_smile.gif)
Re: Open .mp3 at certain time and close after play
@Bobo, now with this code, the script will only run once.The only reason I think it run multiple time is the checktime is 1000.
Now figure how to set close after play. Cant seem to get it work. Please brief me the tooltip. Another thing is the script didn't close after opening the mp3.
Code: Select all
#persistent
ppPath := "C:\(programme file)"
SetTimer, CheckTime, 1000*60
Return
CheckTime:
FormatTime, CurrentTime,, HH:mm
If (CurrentTime = "20:41")
{
Runwait, %ppPath% "D:\(my file location)\play my song.mp3"
}
Return
Re: Open .mp3 at certain time and close after play
![Very Happy :D](./images/smilies/icon_e_biggrin.gif)
![Arrow :arrow:](./images/smilies/icon_arrow.gif)
Re: Open .mp3 at certain time and close after play
Stop the timer when you play the .mp3 and then turn it back on after:
Code: Select all
CheckTime:
FormatTime, CurrentTime,, HH:mm
If (CurrentTime = "20:41")
{
SetTimer, CheckTime, Off
Runwait, %ppPath% "D:\(my file location)\play my song.mp3"
SetTimer, CheckTime, On
}
Re: Open .mp3 at certain time and close after play
Thanks @xtra, Bobo
Do want to close the potplayer not the timer. If successful writing this, I do want to turn it off at the week days though
. Any idea what command I need for the tasks.
Do want to close the potplayer not the timer. If successful writing this, I do want to turn it off at the week days though
![Smile :)](./images/smilies/icon_e_smile.gif)
Re: Open .mp3 at certain time and close after play
Well, I've already posted a working code that does exactly what you've requested.
No idea what's your problem. Simply click on a command (eg. like
Process) within the code section of this thread to get further details.
Good luck.
No idea what's your problem. Simply click on a command (eg. like
![Arrow :arrow:](./images/smilies/icon_arrow.gif)
Good luck.
Who is online
Users browsing this forum: DecimalTurn, macromint, peter_ahk and 349 guests