angel83 Posted February 22, 2024 Posted February 22, 2024 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
Nine Posted February 22, 2024 Posted February 22, 2024 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) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
ioa747 Posted February 22, 2024 Posted February 22, 2024 what does -1 mean? SoundPlay ("C:\Users\angel\Desktop\Sonidos\angel.mp3", -1) I know that I know nothing
angel83 Posted February 22, 2024 Author Posted February 22, 2024 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)
angel83 Posted February 22, 2024 Author Posted February 22, 2024 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.
Moderators Melba23 Posted February 22, 2024 Moderators Posted February 22, 2024 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
angel83 Posted February 22, 2024 Author Posted February 22, 2024 Thank you for someone else who can help me
Solution ioa747 Posted February 22, 2024 Solution Posted February 22, 2024 (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, 2024 by ioa747 remove braces I know that I know nothing
Andreik Posted February 22, 2024 Posted February 22, 2024 (edited) Why do you even enclose in braces these hotkeys? Edited February 22, 2024 by Andreik ioa747 1
ioa747 Posted February 22, 2024 Posted February 22, 2024 from copy paste Andreik and Musashi 2 I know that I know nothing
angel83 Posted February 22, 2024 Author Posted February 22, 2024 A million thanks IOA747. I liked your help a lot and my problem solved. ioa747 1
angel83 Posted February 22, 2024 Author Posted February 22, 2024 Also thank you to everyone who helped me
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