TreatJ Posted Thursday at 09:58 PM Posted Thursday at 09:58 PM It has been a minute since I have uploaded one of my scripts. This is a very simple one! In a nutshell this program opens the MS Sound Window, Selects a Playback Device and Check its Mute status. If it finds that it is Muted then the appropriate Button is clicked on to UnMute it. That's it! If you want the Program to check and UnMute (if needed) ALL of the Playback Devices in the list then use a For/Next Loop. I have made that very simple to implement within my script. Just open it up to see what I am talking about, I used Windows 11 NotePad v11.2410.21.0 / Font: Consolas / Regular / 12 as an Editor. I am somewhat "OCD" when it comes to lining up my script. I also find it easier to read when I look at my code sometime later! Having it line up helps me to read it better. Anyway, Script is attached.... Any feedback would be much appreciated... MuteCheckerV100.au3 CYCho 1
CYCho Posted yesterday at 03:50 AM Posted yesterday at 03:50 AM (edited) My desktop is Windows 11 v24H2 Korean version. After a couple of localization changes, it works as intended. I was thinking of doing something similar for my zPlayer. ControlCommand($CWHandle, "", "SysTabControl321", "TabRight") changed to: $tabHandle = ControlGetHandle($CWHandle, "", 12320) ControlClick($CWHandle, "", $tabHandle, "left", 1, 25 + ($TabsLoop - 1) * 50, 12) If $IconBnTx = "&Mute" Then changed to: If $IconBnTx = "음소거(&M)" Then Edited 17 hours ago by CYCho zPlayer - A Small Audio and Video Player
CYCho Posted yesterday at 05:50 AM Posted yesterday at 05:50 AM Please check: zPlayer - A Small Audio and Video Player
TreatJ Posted yesterday at 03:00 PM Author Posted yesterday at 03:00 PM Thanks for your feedback! I can see that you are a much better coder then me Anyway I do have a few questions.... ControlCommand($CWHandle, "", "SysTabControl321", "TabRight") changed to: $tabHandle = ControlGetHandle($CWHandle, "", 12320) ControlClick($CWHandle, "", $tabHandle, "left", 1, 25 + ($TabsLoop - 1) * 50, 12) If $IconBnTx = "&Mute" Then changed to: If $IconBnTx = "음소거(&M)" Then 1. From what I understand per AutoIt Help... ControlGetHandle returns: the handle (HWND) value So I don't understand how $tabHandle can be used as a controlID number in ControlClick 2. I don't fully understand how you are calculating the X/Y position (25 + ($TabsLoop - 1) * 50, 12) 3. If $IconBnTx = "&Mute" Then changed to: If $IconBnTx = "음소거(&M)" Then Here I am guessing that your change to my code has something do with Version of Windows that you are using. Again THANKS for you feedback...
CYCho Posted yesterday at 08:50 PM Posted yesterday at 08:50 PM (edited) 9 hours ago, TreatJ said: So I don't understand how $tabHandle can be used as a controlID number in ControlClick $CWHandle is a window handle and $tabHandle is the handle of the tab control. ControlClick() requires both. 9 hours ago, TreatJ said: I don't fully understand how you are calculating the X/Y position (25 + ($TabsLoop - 1) * 50, 12) It would be better to use a control handle if it is easy to get and is applicable worldwide. I used AutoIt v3 Info Tool (Au3Info.exe in AutoIt installation folder) to find the coordinates of tabs. 9 hours ago, TreatJ said: I am guessing that your change to my code has something do with Version of Windows Yes, you are right. Please refer to the following link for another post of mine. This code does the same thing as your code does and more. _MasterVolume() function takes approximately 10 milliseconds for each cycle. Edited 22 hours ago by CYCho zPlayer - A Small Audio and Video Player
TreatJ Posted 19 hours ago Author Posted 19 hours ago WOW... Like I said before.... you look to me to be a Pro Coder! Me? I'm just a Rookie! LOL I have never coded a var like this before... $sMsg = ($bMute = 1) ? ('muted!') : ('not muted!') I ran your program (very cool by the way) and the way you coded the $sMsg var works (and is also very cool by the way!)... I looked in Autoit Help but did not come across (or missed it) how this works... could you please help me to better understand how it works? thanks
CYCho Posted 18 hours ago Posted 18 hours ago In AutoIt Help, search for 'Ternary operator'. It can be handy sometimes. I still consider myself a rookie, too. There are many experts here who are willing to help rookies like us. What a beautiful community! zPlayer - A Small Audio and Video Player
TreatJ Posted 9 hours ago Author Posted 9 hours ago If you consider yourself a "Rookie" Then I would say that I'm really pushing it to call myself a "beginner" ! LOL Thanks for all your feedback so far!! You are right about this Autoit community! I have been working with Autoit for years now (So you would think that I would be a better coder by now) and have seen the capability of Autoit improve many times over on what it can do...and how it does it! I will have a look at that 'Ternary operator' . Thanks again for your help... CYCho 1
TreatJ Posted 8 hours ago Author Posted 8 hours ago Back in 2019 I posted and uploaded one of my bigger AutoIt Programs (Bigger for me anyway). that I named 'TxtFinderV475' and sometime later I unloaded my latest Version of it: 'TxtFinderV512'. I wrote this for my wife and decide to share it on AutoIt. In a nutshell my program searches through many Text Files for user specified text. My wife likes to store information in many (very many) different NotePad Files. So I wrote this to help her find that info. The script is zipped up with other files that it needs to work with. Once you unzip it you will see what I mean. Hope it works on your Version of Windows! Please let me know if it did or not.... Anyway take a look inside my script. Do a search for the following function... ;Func: _FindTxInFile() (Note that I have the ( ; ) in front of "Func" This will take you to the Remarks first) In this Function you will find the heart of how it works.... I just wrote my program around it... I found this code in the Autoit script examples forum. As you can see in my remarks I have noted the Author of it. I am not one to take credit for other people's work. Anyway just go to AutoIt's Browse / Forum,,, and Enter this into Search: TxtFinderV512 Hopefully you will have no problem finding it. Last time I searched for it this way (02/08/25) only one result came up.... If you need help finding it just let me know... and if you do find it please run it... have a look inside the script... and as before your feedback would be much appropriated! P.S. If you open up the script in Windows (11) NotePad v11.2410.21.0 / Font: Consolas / Regular / 12 the code should line up good... and at least for me... should be easier to read through. Your Version of Window may not... but I hope it does....
TreatJ Posted 8 hours ago Author Posted 8 hours ago By the way.... found it: Conditional operator ? : Select conditionally an expression. e.g. $condition ? $expression1 : $expression2 i did not even know that AutoIt had this capability! Thanks for the Info
TreatJ Posted 2 hours ago Author Posted 2 hours ago (edited) I am not sure if others may have the same question about how to Code using the 'Ternary operators' method... but if they do... send them this little script that I just put together.... Sometimes (at least for me) coding it out like I just did can be very helpful towards giving one a better understanding of how it works Maybe others too! TernaryOpv100.au3 Edited 1 hour ago by TreatJ Updated code
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