| View previous topic :: View next topic |
| Author |
Message |
Falco
Joined: 01 Jan 2005 Posts: 10
|
Posted: Sun Jan 02, 2005 2:04 pm Post subject: Windows Media Player - Play random song |
|
|
I've looked at alot of the scripts here and I think there isn't enough about WMP.
Anyways. Just a lil script I made up. I know it isn't very technical or anything but it does what i want it to:
Plays a random song if you press Numpad plus key. If WMP isn't open it will open, play then minimise. If its open it will play the next song. To play a random one you may need to turn Shuffle on CTRL - H.
It probably isn't stable but atm it does what I want it to. Any suggestions would be nice.
| Code: |
NumpadAdd::
IfWinExist, Windows Media Player
{
WinActivate
send, {ALT}PP
send, {ALT}PN
sleep, 1000
WinMinimize, Windows Media Player
}
else
{
Run, C:\Program Files\Windows Media Player\wmplayer.exe
WinActivate
sleep, 1000
Send, {ALT}PP
send, {ALT}PN
sleep, 2000
WinMinimize, Windows Media Player
}
return
|
BTW - I seem to be having trouble sending control virtual keys to it like:
send {CTRL}H
It dosn't seem to work. Any ideas?
Last edited by Falco on Sun Jan 02, 2005 2:34 pm; edited 1 time in total |
|
| Back to top |
|
 |
BoBo Guest
|
Posted: Sun Jan 02, 2005 2:31 pm Post subject: |
|
|
Guess that's a typo, isn't it  |
|
| Back to top |
|
 |
Falco
Joined: 01 Jan 2005 Posts: 10
|
Posted: Sun Jan 02, 2005 2:34 pm Post subject: |
|
|
Yeah, ill change it, i switched some things round before posting it...
Last edited by Falco on Sun Jan 02, 2005 2:35 pm; edited 1 time in total |
|
| Back to top |
|
 |
BoBo Guest
|
Posted: Sun Jan 02, 2005 2:35 pm Post subject: |
|
|
| Quote: | | {CONTROL} or {CTRL} CONTROL (sends the neutral virtual key but the left scan code) |
| Quote: | '^'
Sends a CONTROL keystroke, therefore Send, ^!a would send "CTRL+ALT+a". |
Both taken from AHK's help. Have you had a try with:
 |
|
| Back to top |
|
 |
Falco
Joined: 01 Jan 2005 Posts: 10
|
Posted: Sun Jan 02, 2005 2:36 pm Post subject: |
|
|
| Yeah i have, that dosn't work either... |
|
| Back to top |
|
 |
BoBo Guest
|
Posted: Sun Jan 02, 2005 2:40 pm Post subject: |
|
|
| Quote: | | {LCONTROL} or {LCTRL} Left CONTROL key (same as CONTROL for Win9x, but on NT/2k/XP it sends the left virtual key rather than the neutral one) |
As you havn't mentioned the OS you use ... |
|
| Back to top |
|
 |
Falco
Joined: 01 Jan 2005 Posts: 10
|
Posted: Sun Jan 02, 2005 2:42 pm Post subject: |
|
|
| Sorry iam using Windows XP SP2 |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10716
|
Posted: Sun Jan 02, 2005 9:09 pm Post subject: |
|
|
| Note that "Send ^H" will actually send Control+Shift+h since the "H" is capitalized. Some apps might not recognize that as being Ctrl+h. |
|
| Back to top |
|
 |
Falco
Joined: 01 Jan 2005 Posts: 10
|
Posted: Sun Jan 02, 2005 9:37 pm Post subject: |
|
|
| no, still dosn't work. |
|
| Back to top |
|
 |
savage
Joined: 02 Jul 2004 Posts: 207
|
Posted: Tue Jan 04, 2005 8:38 pm Post subject: |
|
|
| Try SetKeyDelay 1. If it's 0 or -1 sometimes certain programs won't catch the modifiers - shift, control, etc. I ran into this problem with console windows. Maybe that's the problem here. |
|
| Back to top |
|
 |
MYYM Guest
|
Posted: Mon Jan 24, 2005 11:20 pm Post subject: Re: Windows Media Player - Play random song |
|
|
| Quote: |
BTW - I seem to be having trouble sending control virtual keys to it like:
send {CTRL}H
It dosn't seem to work. Any ideas? |
Hi, try this
Send, {CTRLDOWN}h{CTRLUP} |
|
| Back to top |
|
 |
Soldier3570
Joined: 30 Aug 2006 Posts: 10
|
Posted: Thu Sep 21, 2006 6:45 am Post subject: |
|
|
the code will then look like this if you want to copy and paste....
| Code: |
IfWinExist, Windows Media Player
{
WinActivate, Windows Media Player
Sleep, 2000
Send, {ALTDOWN}PP{ALTUP}
Sleep, 1000
WinMinimize, Windows Media Player
}
else
{
Run, C:\Program Files\Windows Media Player\wmplayer.exe
Sleep, 2000
WinActivate, Windows Media Player
Send, {ALTDOWN}PP{ALTUP}
Sleep, 1000
WinMinimize, Windows Media Player
}
Return
|
its based along the same lines as yours... except it just plays not shuffles
 _________________ Soldier3570 |
|
| Back to top |
|
 |
Seclinix* Guest
|
Posted: Mon Sep 25, 2006 11:48 pm Post subject: |
|
|
use this it works but it plays a cd in the drive.... if you want it to play a song in a playlist then change the two letters "PD" to suite your needs
do not change the 4 in msgbox otherwise you might get some really random box with abort, retry and cancel lol
| Code: |
MsgBox, 4,, Would you like to play a CD?
IfMsgBox, no
Return
Msgbox, 4,,Is the CD in the drive?
IfMsgBox, no
Return
Run, C:\program files\Windows Media Player\WMPlayer.exe
sleep, 2000
WinActivate, Windows Media Player
Sleep, 2000
Send, {ALTDOWN}PD{ALTUP}
return |
enjoy...  |
|
| Back to top |
|
 |
Seclinix Guest
|
Posted: Mon Sep 25, 2006 11:50 pm Post subject: |
|
|
| you can also change the code to load from fiels and other places... |
|
| Back to top |
|
 |
|