Leaderboard
Popular Content
Showing content with the highest reputation on 06/29/2021 in all areas
-
zPlayer is the name I used when I introduced the early version of this player 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 many forum members 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. Edit: August 4, 2020: Video function was added. July 23, 2023: 1. Changed playback engine from IE-embdded WMPlayer.ocx to Winmm.dll. 2. Further reduced main GUI to bare minimum. 3. Eliminated fileinstalls. Media control icon files were replaced with unicode characters Please see Downloads section of this forum for the latest version of this player.1 point
-
"Unsafe DLL Loading", Do I need to release a security advisory?
argumentum reacted to rcmaehl for a topic
Thanks for the reply, Also Is pretty genius, as if put before includes, prevents any sideload issues in UDFs as well. Thanks1 point -
"Unsafe DLL Loading", Do I need to release a security advisory?
TheDcoder reacted to argumentum for a topic
Declare your path on the loading of a DLL. As default the OS ( windows ), will load from current folder, then search in the path. So declare the path and do your own path search. Now, if someone can copy, just plain copy a DLL to where your app. is at, might as well do anything else to that PC. Or would it need your app. lo load a DLL ?? If your app. is the installer, then there is the possibility of loading the wrong thing but it'd be very strange for such DLL to be just sitting there. Do change that "SCHROTT" to open the DLL with your own path declaration and use the handle for the calls. Change the WorkingDir to WindowsDir to avoid side loading ? Other than that, I would not do much. Maybe announce a new version, so the researcher feel happy he saved countless PCs Unless you post a piece of code ( the part that looks insecure ), I would not know what else to say.1 point -
Automatically execute latest version of a program
Earthshine reacted to Nine for a topic
Assuming that the versioning is only based on 2 parts (xx.xx) : #include <File.au3> Const $sRoot = "C:\Apps\Temp" Local $aFolders = _FileListToArrayRec($sRoot, "Software*", $FLTAR_FOLDERS, Default, Default, $FLTAR_FULLPATH) _ArrayDisplay($aFolders) Local $aVersion, $iFirst, $iLast, $iHighest For $i = 1 to $aFolders[0] $aVersion = StringRegExp($aFolders[$i], "Software (\d*).(\d*)", 1) If Number($aVersion[0]) > $iFirst Or (Number($aVersion[0]) = $iFirst And Number($aVersion[1]) > $iLast) Then $iFirst = Number($aVersion[0]) $iLast = Number($aVersion[1]) $iHighest = $i EndIf Next MsgBox(0, $iHighest, $aFolders[$iHighest]) Run($aFolders[$iHighest] & "\app\windows\program.exe")1 point -
Very messy.. See below: #include <GuiConstants.au3> Global $g_iIndex = 1 ; <--- This is the current tab index which will only be changed when we press the Next/Back buttons Dim $show = 0, $Child_[4], $children = 3, $Radio[11] $Main = GUICreate("MyGUI", (@DesktopWidth) / 4, (@DesktopHeight ) / 2, (@DesktopWidth) / 2, (@DesktopHeight ) / 2) $ButtonPostion_Y = 490 $Button_Width = 80 $Button_Height = 25 $CancelButtonPostion_X = 335 $NextButtonPostion_X = $CancelButtonPostion_X - $Button_Width - 10 $BackButtonPostion_X = $CancelButtonPostion_X- $Button_Width - $Button_Width - 10 $Button_1 = GUICtrlCreateButton("&Next >", $NextButtonPostion_X, $ButtonPostion_Y, $Button_Width, $Button_Height) $Button_2 = GUICtrlCreateButton("< &Back",$BackButtonPostion_X,$ButtonPostion_Y ,$Button_Width, $Button_Height) $Button_3 = GUICtrlCreateButton("&Cancel", $CancelButtonPostion_X, $ButtonPostion_Y, $Button_Width, $Button_Height) $Label_2 = GuiCtrlCreateLabel("You're are currently viewing Child " & $g_iIndex, 300, 300, 290, 30) ; Added this so you can see what tab you're viewing GUISetState() $Child_[1] = GUICreate("", 508, 238, 1, 1, BitOR($WS_CHILD, $WS_TABSTOP) + $WS_DLGFRAME, -1, $Main) $Label_1 = GuiCtrlCreateLabel("Child 1.", 40, 140, 290, 30) ;~ GUICtrlSetState($Button_2,$GUI_DISABLE) Not working properly <--- You're disabling $Button_2 here, which is working GUICtrlSetFont(-1, 10, 650) $radio[1] = GUICtrlCreateInput ("", 10, 10, 120, 20) $radio[2] = GUICtrlCreateInput ("", 10, 40, 120, 20) GUISetState() $Child_[2] = GUICreate("", 508, 238, 1, 1, BitOR($WS_CHILD, $WS_TABSTOP) + $WS_DLGFRAME, -1, $Main) $Label_1 = GuiCtrlCreateLabel("Child 2.", 40, 140, 290, 30) ;~ GUICtrlSetState($Button_2,$GUI_ENABLE) <--- But you're enabling $Button_2 here, which is why it appears to not be working GUICtrlSetFont(-1, 10, 650) $radio[3] = GUICtrlCreateInput ("", 10, 10, 120, 20) $radio[4] = GUICtrlCreateInput ("", 10, 40, 120, 20) GUISetState(@SW_HIDE) $Child_[3] = GUICreate("", 508, 238, 1, 1, BitOR($WS_CHILD, $WS_TABSTOP) + $WS_DLGFRAME, -1, $Main) ;~ GUICtrlSetData($Button_1,"FINISH") Not working properly <-- This should have been setting $Button_1 to "FINISH" on startup? $Label_1 = GuiCtrlCreateLabel("Child 3.", 40, 140, 290, 30) GUICtrlSetFont(-1, 10, 650) GUICtrlSetState($Button_2,$GUI_DISABLE) ; <--- Enable $Button_2 here as we want to disable it on start. GUISetState(@SW_HIDE) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Or $msg = $Button_3 ExitLoop Case $msg = $Button_1 Set_Next() Case $msg = $Button_2 Set_Back() ;Case $msg = $Button_4 ; Set_Done() ;;; EndSelect WEnd ;--------- Functions ------------------- Func Set_Done() for $x = 1 to UBound($radio) -1 If _IsChecked($radio[$x]) Then MsgBox(0x0,"#" & $x, "You selected Radio " & $x, 2) Next EndFunc ;~ Func Set_Next() ;~ For $x = 1 To $children - 1 ;~ $Nwin = WinGetState($Child_[$x]) ;~ If $Nwin > 5 Then ;~ GUISetState(@SW_HIDE, $Child_[$x]) ;~ GUISetState(@SW_SHOW, $Child_[$x + 1]) ;~ Return ;~ EndIf ;~ Next ;~ EndFunc ;==>Set_Next Func _CheckInputs() Switch $g_iIndex Case 1 ; Child 1 If StringLen(GUICtrlRead($radio[1])) > 0 And _ StringLen(GUICtrlRead($radio[2])) > 0 Then Return True EndIf Case 2 ; Child 2 If StringLen(GUICtrlRead($radio[3])) > 0 And _ StringLen(GUICtrlRead($radio[4])) > 0 Then Return True EndIf Case 3 ; Child 3 Return True EndSwitch Return False EndFunc Func Set_Next() If Not _CheckInputs() Then ; Check to make sure the input boxes aren't empty Return EndIf _HideAll() ; Hide all Children $g_iIndex += 1 ; Increase the current tab index If $g_iIndex > 1 Then ; If the current tab index is > 1 then Enable the Back button GUICtrlSetState($Button_2, $GUI_ENABLE) EndIf If $g_iIndex >= 3 Then ; Check we're not going passed the amount of tabs we have (3) $g_iIndex = 3 GUICtrlSetData($Button_1,"FINISH") ; If we're at tab 3, or higher, change $Button_1 text to Finish Else GUICtrlSetData($Button_1,"&Next >") ; Otherwise set the text to Next EndIf GUICtrlSetData($Label_2, "You're are currently viewing Child " & $g_iIndex) ; Update $Label_2 GUISetState(@SW_SHOW, $Child_[$g_iIndex]) ; Show the next Child, we've already increased $g_iIndex above EndFunc Func _HideAll() For $i = 1 To ($children - 1) Step 1 GUISetState(@SW_HIDE, $Child_[$i]) Next EndFunc ;~ Func Set_Back() ;~ For $x = $children To 1 Step - 1 ;~ $Nwin = WinGetState($Child_[$x]) ;~ If $Nwin > 5 Then ;~ GUISetState(@SW_HIDE, $Child_[$x]) ;~ GUISetState(@SW_SHOW, $Child_[$x - 1]) ;~ Return ;~ EndIf ;~ Next ;~ EndFunc ;==>Set_Back Func Set_Back() ; This is pretty much the same as Set_Next but in reverse _HideAll() $g_iIndex -= 1 If $g_iIndex <= 1 Then $g_iIndex = 1 GUICtrlSetState($Button_2, $GUI_DISABLE) Else GUICtrlSetState($Button_2, $GUI_ENABLE) EndIf If $g_iIndex < 3 Then GUICtrlSetData($Button_1,"&Next >") EndIf GUICtrlSetData($Label_2, "You're are currently viewing Child " & $g_iIndex) GUISetState(@SW_SHOW, $Child_[$g_iIndex]) EndFunc Func _IsChecked($control) Return BitAND(GUICtrlRead($control), $GUI_CHECKED) = $GUI_CHECKED EndFunc ;==>_IsChecked I've left comments in response to your questions. ☺️1 point
-
Check out this from @Xenobiologist here too: ; Generated by AutoIt Scriptomatic $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $strComputer = "localhost" Sleep(5000) $Output="" $Output = $Output & "Computer: " & $strComputer & @CRLF $Output = $Output & "==========================================" & @CRLF $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_DesktopMonitor", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) then For $objItem In $colItems $Output = $Output & "Availability: " & $objItem.Availability & @CRLF $Output = $Output & "Bandwidth: " & $objItem.Bandwidth & @CRLF $Output = $Output & "Caption: " & $objItem.Caption & @CRLF $Output = $Output & "ConfigManagerErrorCode: " & $objItem.ConfigManagerErrorCode & @CRLF $Output = $Output & "ConfigManagerUserConfig: " & $objItem.ConfigManagerUserConfig & @CRLF $Output = $Output & "CreationClassName: " & $objItem.CreationClassName & @CRLF $Output = $Output & "Description: " & $objItem.Description & @CRLF $Output = $Output & "DeviceID: " & $objItem.DeviceID & @CRLF $Output = $Output & "DisplayType: " & $objItem.DisplayType & @CRLF $Output = $Output & "ErrorCleared: " & $objItem.ErrorCleared & @CRLF $Output = $Output & "ErrorDescription: " & $objItem.ErrorDescription & @CRLF $Output = $Output & "InstallDate: " & WMIDateStringToDate($objItem.InstallDate) & @CRLF $Output = $Output & "IsLocked: " & $objItem.IsLocked & @CRLF $Output = $Output & "LastErrorCode: " & $objItem.LastErrorCode & @CRLF $Output = $Output & "MonitorManufacturer: " & $objItem.MonitorManufacturer & @CRLF $Output = $Output & "MonitorType: " & $objItem.MonitorType & @CRLF $Output = $Output & "Name: " & $objItem.Name & @CRLF $Output = $Output & "PixelsPerXLogicalInch: " & $objItem.PixelsPerXLogicalInch & @CRLF $Output = $Output & "PixelsPerYLogicalInch: " & $objItem.PixelsPerYLogicalInch & @CRLF $Output = $Output & "PNPDeviceID: " & $objItem.PNPDeviceID & @CRLF $strPowerManagementCapabilities = $objItem.PowerManagementCapabilities(0) $Output = $Output & "PowerManagementCapabilities: " & $strPowerManagementCapabilities & @CRLF $Output = $Output & "PowerManagementSupported: " & $objItem.PowerManagementSupported & @CRLF $Output = $Output & "ScreenHeight: " & $objItem.ScreenHeight & @CRLF $Output = $Output & "ScreenWidth: " & $objItem.ScreenWidth & @CRLF $Output = $Output & "Status: " & $objItem.Status & @CRLF $Output = $Output & "StatusInfo: " & $objItem.StatusInfo & @CRLF $Output = $Output & "SystemCreationClassName: " & $objItem.SystemCreationClassName & @CRLF $Output = $Output & "SystemName: " & $objItem.SystemName & @CRLF if Msgbox(1,"WMI Output",$Output) = 2 then ExitLoop $Output="" Next Else Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_DesktopMonitor" ) Endif Func WMIDateStringToDate($dtmDate) Return (StringMid($dtmDate, 5, 2) & "/" & _ StringMid($dtmDate, 7, 2) & "/" & StringLeft($dtmDate, 4) _ & " " & StringMid($dtmDate, 9, 2) & ":" & StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate,13, 2)) EndFunc1 point
-
How to make Koda Form Editor to update a certain part of a script?
Skysnake reacted to argumentum for a topic
Is not in active development anymore but still quite useful. I use koda to get hints. Nowadays I just code it. It's easier to align stuff. But in the beginning I would have been lost without it. Once you code for some time, what I'm saying will make perfect sense.1 point -
Glad this isn't in a support category so I don't feel so bad necroing but since this the top result for autoit uefi... EnvGet("firmware_type") Works1 point
-
Anyhow to simplify my script?
FrancescoDiMuro reacted to Marc for a topic
#include <File.au3> #include <FileConstants.au3> #include <MsgBoxConstants.au3> Func convert($file) Local $srch = "µ∫˙√†‰∂ˇî®ßÃĀåḌḤĪïùàḶḸṂṆñìṄṚṜṢŚṬāḍḥīḷḹṃṁṇṅṛṝṣśṭūäÇéüöëò" Local $repl = "mnhntrdtirsnaadhinhmllmnnnnrrsstadhiiimmnnrrsstuasiutnd" Local $check = FileGetAttrib($file) If StringInStr($check, "D") Then ConsoleWrite("Skipping the directory " & $file & @CRLF) Return Else ConsoleWrite("Parsing file: " & $file & @CRLF) EndIf ; load file content into memory $filereader = FileOpen($file) $content = FileRead($filereader) FileClose($filereader) ; change all characters in memory For $i = 1 To StringLen($srch) $content = StringReplace($content, StringMid($srch, $i, 1), StringMid($repl, $i, 1)) Next ; write back file to disk $filewriter = FileOpen($file, 2) FileWrite($filewriter, $content) FileClose($filewriter) EndFunc ;==>convert ; Display an open dialog to select a list of file(s). Local $sFileOpenDialog = FileOpenDialog("Hold down Ctrl or Shift to choose multiple files.", @ScriptDir & "\", "Text (*.txt)|Au3 (*.au3)", BitOR($FD_FILEMUSTEXIST, $FD_MULTISELECT)) If @error Then Exit MsgBox($MB_SYSTEMMODAL, "", "No file(s) were selected.") ; split up the selected files into an array $sFileOpenDialog = StringSplit($sFileOpenDialog, "|") ; walk through the array, convert one file after another For $file = 1 To $sFileOpenDialog[0] convert($sFileOpenDialog[$file]) Next Fixed problem with only one file. Now using the approach of reading the file into memory, convert the characters and writing the file back.1 point -
You need to remove the quotations. Global $sFileName = $sFileOpenDialog Thrown this together - not tested: #include <Array.au3> #include <File.au3> #include <FileConstants.au3> #include <StringConstants.au3> Global $g_sFilePaths = FileOpenDialog('Open', @ScriptDir, 'Text (*.txt)|Au3 (*.au3)', BitOR($FD_FILEMUSTEXIST, $FD_MULTISELECT)) If @ERROR Then Exit EndIf Global $g_aFiles = StringSplit($g_sFilePaths, '|', $STR_NOCOUNT) Global $g_sDir = $g_aFiles[0] ; Global $g_sFilePath = @ScriptDir & '\test.au3' Global $g_sSearch = "µ∫˙√†‰∂ˇî®ßÃĀåḌḤĪïùàḶḸṂṆñìṄṚṜṢŚṬāḍḥīḷḹṃṁṇṅṛṝṣśṭūäÇéüöëò" Global $g_sReplace = "mnhntrdtirsnaadhinhmllmnnnnrrsstadhiiimmnnrrsstuasiutnd" Global $g_hFileOpen, $g_sFileRead For $i = 1 To (UBound($g_aFiles) - 1) Step 1 $g_hFileOpen = FileOpen($g_sDir & '\' & $g_aFiles[$i], $FO_READ) If $g_hFileOpen = -1 Then ConsoleWrite('ERROR: FileOpen' & @CRLF) Exit EndIf $g_sFileRead = FileRead($g_hFileOpen) FileClose($g_hFileOpen) For $j = 1 To StringLen($g_sSearch) Step 1 $g_sFileRead = StringReplace($g_sFileRead, StringMid($g_sSearch, $j, 1), StringMid($g_sReplace, $j, 1)) Next $g_hFileOpen = FileOpen($g_sDir & '\' & $g_aFiles[$i], $FO_OVERWRITE) If $g_hFileOpen = -1 Then ConsoleWrite('ERROR: FileOpen' & @CRLF) Exit EndIf FileWrite($g_hFileOpen, $g_sFileRead) FileClose($g_hFileOpen) Next Edit: This opens and reads each file once rather than multiple times.1 point