hello sirs, i've created a tool to the blind users, this tool helps the blind to listen to a audio effect when moving between the GUIs controls on they computers
where this tool can get the class for the current focus control and play a sound from a folder
i've added all the knowne classes, but i found some problems i hope any one can help me.
this is the code that i created
#include <WinAPISys.au3> Global $h_CurrentHWNDFocus = "", $h_CurrentControlHWNDFocus = "" AdlibRegister("WindowAudioFocus", 50) Func WindowAudioFocus() Local $h_NewHWNDFocus = WinGetHandle("[active]", "") Local $h_NewControlHWNDFocus = ControlGetFocus($h_NewHWNDFocus, "") If ($h_NewHWNDFocus = $h_CurrentHWNDFocus) And ($h_NewControlHWNDFocus = $h_CurrentControlHWNDFocus) Then Return 0 AdlibUnRegister("WindowAudioFocus") If Not ($h_NewHWNDFocus = $h_CurrentHWNDFocus) Then SoundPlay(@ScriptDir & "\focus_Audio\WindowChanged.wav") Else Switch _WinAPI_GetClassName(ControlGetHandle($h_NewHWNDFocus, "", $h_NewControlHWNDFocus)) Case "Button", "Start", "TrayButton", "TrayShowDesktopButtonWClass", "sbutton", "CirrussButton", "ODbcButton", "ThunderRTCommandButton", "ThunderSSOption", "ThunderSSCommand", "ThunderCommandButton", "ThunderRT6CommandButton", "ThunderRT5CommandButton", "TButton", "TBitBtn", "TAdvGlowButton", "ButtonWndClass", "afx:0:376:baa946", "_AOL_Button" If _IsCheckBox(ControlGetHandle($h_NewHWNDFocus, "", $h_NewControlHWNDFocus)) Then SoundPlay(@ScriptDir & "\focus_Audio\checkBox.wav") ElseIf _IsRadio(ControlGetHandle($h_NewHWNDFocus, "", $h_NewControlHWNDFocus)) Then SoundPlay(@ScriptDir & "\focus_Audio\radio.wav") Else SoundPlay(@ScriptDir & "\focus_Audio\button.wav") EndIf Case "ComboBox", "ComboBoxEx32", "MSOBALLOONREComboBox20W", "REComboBox20W", "ThunderComboBox", "ThunderDriveListBox", "ThunderRT6ComboBox", "TORComboEdit", "TCombobox", "TComboBoxEx", "TORComboBox", "TColorBox", "TNFComboBox", "Internet Explorer_TridentCmbobx", "ComboWndClass", "_AOL_ComboBox", "ThunderRT5ComboBox", "ComboLBox" SoundPlay(@ScriptDir & "\focus_Audio\list.wav") Case "Edit", "SearchBox", "TChatRichEdit", "_WwN", "_WwO", "RichEdit20A", "RichEdit20WPT", "RICHEDIT60W", "OKttbx", "RichEditA", "ThunderTextBox", "ThunderRT6TextBox", "ThunderRT5TextBox", "TEdit", "TRichEdit", "TRichEditViewer", "TMemo", "TInplaceEditList", "TLabeledEdit", "TMaskEdit", "TDateTimePicker", "TRichEdit", "TCaptionMemo", "TAddictRichEdit", "TCaptionEdit", "RichTextWndClass", "TextWndClass", "PasswordWndClass", "TextAreaWndClass", "MSWorksDoc", "_AOL_Edit", "SysDateTimePick32" SoundPlay(@ScriptDir & "\focus_Audio\edit.wav") Case "ListBox", "ComboLBox", "REListBox20W", "SUPERGRID", "OUTEXVLB", "WMSUIVLB", "SchdmapiVLB", "VLBClass", "ThunderDirListBox", "ThunderFileListBox", "ThunderListBox", "ThunderRT6ListBox", "ThunderRT5ListBox", "TListbox", "TValueListEditor", "TORCalendar", "TColorListBox", "TCheckListBox", "Internet Explorer_TridentLstBox", "ListBoxWndClass", "ListWndClass", "hh_kwd_vlist", "afx:8:376:0:946", "_AOL_ListBox", "_AOL_Tree", "" SoundPlay(@ScriptDir & "\focus_Audio\List.wav") Case "SysListView32", "OpenListView", "wuDuiListView", "ListView20WndClass", "TcxGridSite", "TListView", "TSystemListView", "ListViewWndClass", "" SoundPlay(@ScriptDir & "\focus_Audio\ListView.wav") Case "SysTreeView32", "SearchTreeList", "FeatureTree", "TreeView20WndClass", "TSystemTreeView", "TTreeView", "" SoundPlay(@ScriptDir & "\focus_Audio\TreeView.wav") Case Else SoundPlay(@ScriptDir & "\focus_Audio\focus.wav") EndSwitch EndIf $h_CurrentHWNDFocus = $h_NewHWNDFocus $h_CurrentControlHWNDFocus = $h_NewControlHWNDFocus AdlibRegister("WindowAudioFocus", 50) Return 1 EndFunc ;==>WindowAudioFocus Func _IsCheckBox($ctrl_hwnd) $Style = _WinAPI_GetWindowLong($ctrl_hwnd, $GWL_STYLE) Return BitAND($Style, $BS_CHECKBOX) = $BS_CHECKBOX EndFunc ;==>_IsCheckBox Func _IsRadio($ctrl_hwnd) $Style = _WinAPI_GetWindowLong($ctrl_hwnd, $GWL_STYLE) Return BitAND($Style, $BS_AUTORADIOBUTTON) = $BS_AUTORADIOBUTTON EndFunc ;==>_IsRadio
what i need from you is :
play a sound when a menu item focus, that sound named menu.wav
play a sound named items.wav when the users move on list box items or list view or treeview items or a combobox items
please if can any one help me i'll very happy
thanks on advance
In this post I take the opportunity to show the awesome capabilities of AutoIt and its libraries. My open source project Peace is a long running AutoIt based app located on SourceForge. It provides users with a system-wide equalizer and effects machine. It's an interface using the power of Equalizer APO, an audio processing object software. Peace has been download over 1,100,000 times by various kind of users. Amongst others it gives them possibilities like these:
Hearing impaired - Amplify the gain of frequencies which are impaired. Home Theatre - Create Equalizer presets for watching movies and listening to music. Music lovers & audiophiles - Create presets for listening to music on their high quality speakers and headphones. Gamers - Enhance frequencies to get an edge over other gamers. Headphones - Improve the sound quality of cheap headphones and get the max out of expensive ones. Bass lovers - Boost low frequencies for extra bass. Voice - Make a microphone sound better and improve the voice, for instance for YouTube usage. Low audio - Boost low audio of an input source to a comfortable level. This list covers the main needs of the Peace user. Many people have contacted me over the years asking for new features and telling me how they use Peace for their (sometimes specific) needs. I was able to use AutoIt and its libraries for all of their needs. So what are the main features of Peace?
Equalize your computer audio by using up to 31 sliders. Support of equalizing 9 speakers : left/right, center, subwoofer, left/right rear, left/right side. Per slider a filter can be chosen such as peak, low/high pass, shelving. The graph windows shows your equalization so you see exactly what you're doing. Apply an effect such as crossfeed simple/Jan Meier/Chu Moy, stereo balance, bass/treble, upmix/downmix, channel routing. Save presets (called configurations) and activate by mouse click, hotkey, desktop shortcut or Peace system tray. Select a target device to equalize, microphone as input can also be equalized. Automate: you can let Peace automatically activate presets on a switch to another device and another process. Peace is available in these languages: English, Czech, Deutsch, Français, Italiano, Nederlands, Pусский, Українська So who am I? I'm a Dutch programmer who happens the stumble upon AutoIt 5 years ago and created a small Equalizer interface app of less than 400 program lines with it. Nowadays Peace has grown to more than 17,000 lines as many features were added. Although Peace is open source, the program code isn't of the best possible quality. The reason being that I didn't expect it to become so popular. It caught me by supprise. I've created a Library of functions called Pal which quality is up to the AutoIt community standard as counterpart to the Peace program code.
I want to state here that AutoIt is a mature program language as Peace obviously shows. I wish it to be used more extensively for professional or semi-professional apps. In my view AutoIt deserves a place amongst the major programming languages for Windows computers.
This file includes all the source codes and a compiled .exe version of zPlayer, which is a stand-alone, simple, intuitive and easy-to-use, yet fully functional audio player. I made this to suit my purpose and you can tweak it to your taste as the source code is only about 1000 lines which are very much readable. This player has the following functions:
- Play back all formats of audio files which can be palyed back by the Windows Media Player in your computer
- Graphical player similar to embedded Windows Media Player
- Forward, backward, pause, repeat, shuffle funtions
- Increase/decrease/mute sound volume
- Change folders and create playlist for all audio files in that folder and its subfolders, and support for manually-made playlists
- Save play-back environment when terminating and resume that environment when restarting
- With one click, you can see DuckDuckGo search results for the file being played back
- With a double-click, you can play back an item in the playlist
- Search strings in the playlist
- Option to see long file names including folder names
- Resize the playlist window, and restore it to its default position
- Very small footprint: very low CPU and memory usage, with only about 1MB when compiled
- You can even hide all the windows and manipulate the player with hotkeys only
zPlayer is the name I used when I introduced the early version of this palyer in my blog back in early 2009 and, therefore, has nothing to do with the mobile media player of the same name which started marketing in 2015.
After I retired from active duty in 2002 I spent much time listening to music. First I started with CD's and LP's, then quickly moved on to mp3 files. I converted many of my CD's to mp3 and I collected many more from various sources which were freely available at the time. As the number of my mp3 files grew, I put them in folders according to their genres and my favorite classifications. I mainly used Windows Media Player to listen to them and I slowly began to dislike wmp because it had massive user interface while I just wanted to listen to music in the background while I was doing other work in the foreground, hopping between folders from time to time. It was the time I was beginning to learn AutoIt and I thought I should make my own player with AutoIt. Coming from a sales career with no experience in programming, it was not an easy task. Somehow, after about 2 years of learning and trying, I had my own audio player which worked with only hotkeys without any graphical interface. I gave it to some of my friends who were not as computer-savvy as I. They liked it but definitely wanted something to clcik with mouse. So I came up with very rude gui which took a form similar to what it is now.
The attached source files include one au3 file, one icon file and 14 jpg files. The jpg files are used for drawing a graphical player and are fileinstalled in @DocumentsCommonDir folder. This player uses WMPlayer.OCX as its engine and supports all audio file formats supported by wmp and additional codecs installed. I would like to thank @Bilgus for kind answers to my questions and would appreciate it if anyone could review the code and give me any suggestion. This player works for me, but I don't know whether the code is presentable as an example. I am posting this here with a hope to learn much from AutoIt community.
PS: 1. An error (Variable used before declaration) was reported and corrected - 02:00 hours GMT, March 14, 2019
2. An error in tray menu was corrected -10:00 hours GMT, March14, 2019
3. AutoIt3Wrapper_Au3Check_Parameters definition was added at the top of the code and all ensuing errors were corrected. - 00:10 hours GMT, March 16 2019
4. Some features were added. - 10:30 hours GMT, March 18, 2019
a. Jumping to new play-back position in a file
b. Support for a manually made playlist
c. Ctrl+Alt+h hotkey to trigger a help message box
5. The minimum resizing width of playlist window was set at 450. - 01:10 hours GMT, March 23, 2019
6. Problems associated with actions taken while in 'paused' status was addressed. - 07:40 GMT, April 12, 2019
7. An error was found and corrected in restoring previous play-back environment when the mode was 'Shuffled.' - 11:00 GMT, April 17, 2019
Please see Downloads section of this forum for source code files.
Hi dear, I have a question please
I designed a function to read the content of the playlist
I succeeded in that
I have a problem
For VLC player playlists
If the path of the files in Arabic language the path is be as follows
I did not know how to decrypt this text to be readable
This is the function that i used
func M3UImport($M3UFile) dim $AM3UItems local $fileOpen = FileOpen($path, bitOr($FO_OVERWRITE,$FO_CREATEPATH,$FO_ANSI)) _FileReadToArray ($fileOpen, $AM3UItems) if @error then return setError(1) local $M3UPath for $i = 1 to $AM3UItems $AM3UItems[$i] = stringReplace($AM3UItems[$i], "file:///", "") $AM3UItems[$i] = stringReplace($AM3UItems[$i], "/", "\") $AM3UItems[$i] = stringReplace($AM3UItems[$i], "%20", " ") $M3UPath = _fileGetDirPath($AM3UItems[$i]) if $M3UPath = "" then $M3UPath = @WorkingDir if not StringTrimRight($M3UPath, 1) = "\" then $M3UPath &= "\" $AM3UItems[$i] = $M3UPath & $AM3UItems[$i] endIf local $ext = _GetFileExt($AM3UItems[$i]) if fileExists($AM3UItems[$i]) and not (StringInStr($FilesExt, $ext) = 0) then $aListItems += 1 GUICtrlCreateListViewItem(_GetFileName($AM3UItems[$i]) & Opt("GUIDataSeparatorChar") & " : " & Opt("GUIDataSeparatorChar") & $AM3UItems[$i], $list) endIf next return "" endFunc
I ask for your help in this work
with my Greetings and thanks in advance