AutoHotkey Community

It is currently May 25th, 2012, 2:21 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 14 posts ] 
Author Message
PostPosted: January 2nd, 2005, 3:04 pm 
Offline

Joined: January 1st, 2005, 1:05 pm
Posts: 10
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 January 2nd, 2005, 3:34 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 2nd, 2005, 3:31 pm 
Code:
sned, {ALT}PP


Guess that's a typo, isn't it :wink:


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 2nd, 2005, 3:34 pm 
Offline

Joined: January 1st, 2005, 1:05 pm
Posts: 10
Yeah, ill change it, i switched some things round before posting it...


Last edited by Falco on January 2nd, 2005, 3:35 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 2nd, 2005, 3:35 pm 
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:

Code:
Send, ^H
:?:


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 2nd, 2005, 3:36 pm 
Offline

Joined: January 1st, 2005, 1:05 pm
Posts: 10
Yeah i have, that dosn't work either...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 2nd, 2005, 3:40 pm 
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 ...


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 2nd, 2005, 3:42 pm 
Offline

Joined: January 1st, 2005, 1:05 pm
Posts: 10
Sorry iam using Windows XP SP2


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 2nd, 2005, 10:09 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 2nd, 2005, 10:37 pm 
Offline

Joined: January 1st, 2005, 1:05 pm
Posts: 10
no, still dosn't work.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 4th, 2005, 9:38 pm 
Offline

Joined: July 2nd, 2004, 11:53 pm
Posts: 207
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.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: January 25th, 2005, 12:20 am 
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}


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: September 21st, 2006, 7:45 am 
Offline

Joined: August 30th, 2006, 8:06 am
Posts: 10
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
:wink:

_________________
Soldier3570


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 26th, 2006, 12:48 am 
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
Code:
 {ALTDOWN}PD{ALTUP}

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... :o


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: September 26th, 2006, 12:50 am 
you can also change the code to load from fiels and other places...


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 14 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: lblb and 20 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group