Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Assign sounds to mouse clicks


  • Please log in to reply
20 replies to this topic
Dike
  • Members
  • 19 posts
  • Last active: Aug 29 2015 02:09 PM
  • Joined: 18 Dec 2014

Yes, I have many partitions so m: drive is there on my pc, although it is a usb drive but other sounds of path as long as 127 chars on the same m: drive are working fine for me.

 

@bobycom, can you post your tested script code here.



bobycom
  • Members
  • 40 posts
  • Last active: Apr 14 2019 07:50 AM
  • Joined: 25 Mar 2014

Here it is:

~LButton::SoundPlay, %A_WinDir%\Media\ding.wav
~LButton up::SoundPlay, M:\12345678901234567890123456789012345678901234567890\12345678901234567890123456789012345678901234567890\12345678901234567890123456789012345678901234567890\chimes.wav
~RButton::SoundPlay, C:\Documents and Settings\bobycom\My Documents\My Received Files\12345678901234567890123456789012345678901234567890\12345678901234567890123456789012345678901234567890\chord.wav
~RButton up::SoundPlay, G:\1234567890 1234567890 1234567890 1234567890 1234567890\1234567890 1234567890 1234567890 1234567890 1234567890\1234567890 1234567890 1234567890 1234567890 1234567890\chimes.wav

I took the wave files from my Windows folder.

My M: drive is a mounted network drive.

My G: drive is a flash drive.

 

All are working fine. I noticed that the sounds are not playing if I hold any of the Ctrl, Alt or Shift keys.

BTW what version of AHK you are using. As I said before, mine is the last one, i.e. 1.1.19.01.



Exaskryz
  • Members
  • 3249 posts
  • Last active: Nov 20 2015 05:30 AM
  • Joined: 23 Aug 2012

@bobycom, makes sense that holding a modifier key doesn't play the sounds. They probably would if you did ~*LButton, etc.

 

I'm on 1.1.15.01 and couldn't get AHK to play in long directories on my C drive, but will do an upgrade to see if this was some recent fix.

 

I've upgraded now, but I was on 1.1.15.01 Unicode 64-bit on Windows 8.1. I will test 1.1.19.01 Unicode 64-bit on WIndows 8.1 when I get to an environment where it's appropriate.



bobycom
  • Members
  • 40 posts
  • Last active: Apr 14 2019 07:50 AM
  • Joined: 25 Mar 2014

@Exaskryz, I know it makes sense. It was just a reminder. :)

 

I will test on 64bit Windows 7 once I return at home. I think I had similar issues with long file paths on 64bit systems.



Exaskryz
  • Members
  • 3249 posts
  • Last active: Nov 20 2015 05:30 AM
  • Joined: 23 Aug 2012

Reporting back to say that with latest AHK (1.1.19.01) Unicode 64-bit on Windows 8.1 that long file paths do not play sound:

 

NumpadEnter::SoundPlay, C:\Users\Exaskryz\Desktop\This is a really long folder name because I need to reach the limits of the maximum entropy for what I am bestowed\Keep the good times rolling - almost there\Test.wav

 

Hitting NumpadEnter does not work there. Putting quotes around the file path doesn't work either. But if I drop it to NumpadAdd:: SoundPlay, C:\Users\Exaskryz\Desktop\Test.wav things are fine.



bobycom
  • Members
  • 40 posts
  • Last active: Apr 14 2019 07:50 AM
  • Joined: 25 Mar 2014

I tested it again on Windows 8.1 Pro 64bit and it is not working.

 

I suggest you replace the function SoundPlay with DllCall. It is playing fine this way:

~RButton::DllCall("winmm.dll\PlaySound", AStr, "C:\Users\Kop4o\Desktop\This is a really long folder name because I need to reach the limits of the maximum entropy for what I am bestowed\Keep the good times rolling - almost there\Alarm01.wav", uint, 0, uint, 1)

Edit:

After some experiments I set the last parameter to 1, because when it was 0 the script was waiting the file to stop playing.

Now the only problem is that you can not interupt the DllCall with SoundPlay so all of them should be replaced.