angel83 Posted February 22 Share Posted February 22 Hello a help to fix this problem I have. Pressing the button on keypad number 1 plays the sound .mp3 that's fine. THE PROBLEM IS; that if I leave it pressed, it plays many times as if it were stuck. I'm new to this, maybe I have some mistakes. Problem playing a .mp3 with a keyboard button.txt Link to comment Share on other sites More sharing options...
Nine Posted February 22 Share Posted February 22 Use my Keyborad UDF. You just define the hotkey and no matter how long you press the key, it will trigger only once. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
ioa747 Posted February 22 Share Posted February 22 what does -1 mean? SoundPlay ("C:\Users\angel\Desktop\Sonidos\angel.mp3", -1) I know that I know nothing Link to comment Share on other sites More sharing options...
angel83 Posted February 22 Author Share Posted February 22 Sorry it's 1 not -1 SoundPlay ("C:\Users\angel\Desktop\Sonidos\angel.mp3",1) $SOUND_WAIT(1) = wait until sound has finished. $SOUND_NOWAIT(0) = continue script while sound is playing (default) Link to comment Share on other sites More sharing options...
angel83 Posted February 22 Author Share Posted February 22 HotKeySet("{2}", "exit1") HotKeySet("{1}", "sound1" ) While 1 Sleep(1000) WEnd Func sound1() SoundPlay ("C:\Users\angel\Desktop\Sonidos\angel.mp3", 1) EndFunc Func exit1() Exit EndFunc ;==>exit1 the problem is that you hold down THE 1 KEY for about 30 seconds, then you release it and it gets stuck for a short time, then play the mp3, that's what I want to solve. Don't let it take as long as you have the key. That when you press it for 30 seconds or 1 minute and when you release it, the mp3 is played. You can interject it, you'll know what I'm softening about. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 22 Moderators Share Posted February 22 Moved to the appropriate AutoIt General Help and Support forum, as the AutoIt Example Scripts forum very clearly states: Quote Share your cool AutoIt scripts, UDFs and applications with others. Do not post general support questions here, instead use the AutoIt Help and Support forums. Moderation Team Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
angel83 Posted February 22 Author Share Posted February 22 Thank you for someone else who can help me Link to comment Share on other sites More sharing options...
Solution ioa747 Posted February 22 Solution Share Posted February 22 (edited) HotKeySet("2", "exit1") HotKeySet("1", "sound1") While 1 Sleep(1000) WEnd Func sound1() HotKeySet("1") ; unregister the HotKey SoundPlay("C:\Users\angel\Desktop\Sonidos\angel.mp3", 1) HotKeySet("1", "sound1") ;register the HotKey EndFunc ;==>sound1 Func exit1() Exit EndFunc ;==>exit1 more here: https://www.autoitscript.com/forum/topic/211301-multiple-keystroke-handling/#comment-1528707 Edited February 22 by ioa747 remove braces I know that I know nothing Link to comment Share on other sites More sharing options...
Andreik Posted February 22 Share Posted February 22 (edited) Why do you even enclose in braces these hotkeys? Edited February 22 by Andreik ioa747 1 When the words fail... music speaks. Link to comment Share on other sites More sharing options...
ioa747 Posted February 22 Share Posted February 22 from copy paste Musashi and Andreik 2 I know that I know nothing Link to comment Share on other sites More sharing options...
angel83 Posted February 22 Author Share Posted February 22 A million thanks IOA747. I liked your help a lot and my problem solved. ioa747 1 Link to comment Share on other sites More sharing options...
angel83 Posted February 22 Author Share Posted February 22 Also thank you to everyone who helped me Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now