Jump to content
FroVN

How to use progress to _soundseek() a file song

Recommended Posts

FroVN

Hi, i'm code software listen music on GUI, it's show time playing, hotkey pause/play music, and the last i missing that's the progress to seek the video to hour::ss:( i can't describe exactly, it's like a progress with red color we can backward or fast forward on youtube, i want do the same like that on my gui) i used to use guicreate slider, but it's not good, any idea give me, Tks(sorry for my bad english)

 

12333.png

Share this post


Link to post
Share on other sites
careca

What im using in my player:

$CustomSeek = GUICtrlCreateButton('', 20, 272, 7, 20)

GUICtrlSetPos($CustomSeek, 15 + (450 * ($PosSlider)) / 100, 272)

;=============================================================================
        ;Seek Slider
        If $CursorInfo[2] = 1 And $CursorInfo[4] = $SeekGroup Then
            While _IsPressed("01", $hDLL)
                $WinCoords = WinGetPos($GUI)
                $CursorInfo = GUIGetCursorInfo($GUI)
                _MouseTrap($WinCoords[0] + 20, $WinCoords[1] + 325, $WinCoords[0] + 472, $WinCoords[1] + 328)
                $SeekB2Secs = (100 * (($CursorInfo[0] + 20) - 37) / (488 - 37))
                GUICtrlSetPos($CustomSeek, $CursorInfo[0] - 3, 272)
                $SeekB2Secs = $SeekB2Secs * $Lenght / 100
                $ConvP = _BASS_ChannelBytes2Seconds($MusicHandle, $SeekB2Secs)
                $pHour = Int($ConvP / 3600)
                $pMin = Int(($ConvP - $pHour * 3600) / 60)
                $pSec = $ConvP - $pHour * 3600 - $pMin * 60
                ToolTip(StringFormat('%02d:%02d:%02d', $pHour, $pMin, $pSec))
            WEnd
            ToolTip('')
            _MouseTrap()
            _BASS_ChannelSetPosition($MusicHandle, $SeekB2Secs, $BASS_POS_BYTE)
        EndIf
        ;=============================================================================

Hope you can make some sense out of this. The general ideia is that while left mouse is pressed the cursor is confined to a portion of the gui, and there's calculation going on for that, and what it does is move a button inside a group.


Spoiler

Paster - Main function is to paste text, but has more functions. (No longer mantained, switched to String Trigger)

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Share this post


Link to post
Share on other sites
FroVN

can u give me an example, i don't understand must ,here is my test and result not good

#include <GUIConstantsEx.au3>
#include <Misc.au3>
#include <ColorConstants.au3>

$hGUI = GUICreate("Test", 500, 200)
$CustomSeek = GUICtrlCreateButton('', 20, 272, 7, 20)
$PosSlider = GUICtrlCreateSlider( 20, 272, 7, 2)
GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        case $CustomSeek
            GUICtrlSetPos($CustomSeek, 15 + (450 * ($PosSlider)) / 100, 272)

;=============================================================================
        ;Seek Slider
        If $CursorInfo[2] = 1 And $CursorInfo[4] = $SeekGroup Then
            While _IsPressed("01", $hDLL)
                $WinCoords = WinGetPos($GUI)
                $CursorInfo = GUIGetCursorInfo($GUI)
                _MouseTrap($WinCoords[0] + 20, $WinCoords[1] + 325, $WinCoords[0] + 472, $WinCoords[1] + 328)
                $SeekB2Secs = (100 * (($CursorInfo[0] + 20) - 37) / (488 - 37))
                GUICtrlSetPos($CustomSeek, $CursorInfo[0] - 3, 272)
                $SeekB2Secs = $SeekB2Secs * $Lenght / 100
                MsgBox(0,'',$SeekB2Secs)
            WEnd
        EndIf
        ;=============================================================================
        EndSwitch

WEnd

 

Share this post


Link to post
Share on other sites
careca

You can't just grab what i posted and use it as is.

It was to give a general idea of how to do the calculations.

You'll need the values for the current song position and total lenght, aka _SoundPos and _SoundLenght

Then you get the percentage on that, and move the slider the same percentage within its own coordinates.

Must do a check, If the slider moves, calculate the percentage (within slider's own coordinates) and with that the time, to then seek the song.

I feel im overwelming you, hope you understand.

 

Edited by careca

Spoiler

Paster - Main function is to paste text, but has more functions. (No longer mantained, switched to String Trigger)

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Share this post


Link to post
Share on other sites
FroVN

Tks, finally i can do it, but another way however same like you
case $Slider1
             $w=GUICtrlRead($Slider1)
    SoundSetWaveVolume($w)
    GUICtrlSetTip($Slider1,GUICtrlRead($Slider1)&'%')
             Case $cLabel
            $aMpos = GUIGetCursorInfo($Form1)
            $iPercent = 100 * ($aMpos[0] - 290) / 140
            _Metro_SetProgress($cProgress, $iPercent)
            $timethanhmax=_SoundLength($s,2)
            $seek=$iPercent/100
            $truelinh=$seek*$timethanhmax
                $truelinh=Int($truelinh)
            $toseek=mili($truelinh)
            $time = StringSplit($toseek,':')
            _SoundSeek($s,$time[1],$time[2],$time[3])
            _SoundPlay($s)
that      ($iPercent = 100 * ($aMpos[0] - 290) / 140)     290,174 is left and width of progess, and i have an 2 hours to know this lol

Share this post


Link to post
Share on other sites
careca

Im glad it's solved. :D

 


Spoiler

Paster - Main function is to paste text, but has more functions. (No longer mantained, switched to String Trigger)

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Similar Content

    • Skeletor
      By Skeletor
      Hi All,
      I want to make my progress bar progress with the amount of File lines read. 
      How would I do this correctly. So far the code below can sometimes run in the middle of the progress bar and state completed.. and other times it can run into the 200%. 
       
      ;======================================================================== ProgressOn("TITLE", "ACTION") ;======================================================================== For $count = 1 To _FileCountLines($FileRead) Step 1 $string = FileReadLine($FileRead, $count) $value1 = $input[1] $value2 = $input[2] $value3 = $input[3] $value4 = $input[4] $TM = FileWrite("C:\temp\test.txt", $value1 & " " & $value2 & " " & $value3 & " " & $value4 & @CRLF) ProgressSet($count, $count & "%") Next ;======================================================================== ; PROGRESS BAR OFF ;======================================================================== ProgressSet(_FileCountLines($FileRead), "Completed!") Sleep(750) ProgressOff() ;========================================================================  
    • nacerbaaziz
      By nacerbaaziz
      hello
      please i need to link a progress bar with a time can you help me?
      e.g
      i want to set a progress bar for 10 sec
      am waiting for your answers
      thank you.
    • RyukShini
      By RyukShini
      #include <ColorConstants.au3>; Including required files #include <GUIConstantsEx.au3> #include <file.au3> #include <Array.au3> #include <string.au3> Example() Func Example() Local $hash Local $hashes = "hash.txt" _FileReadToArray($hashes, $hash) For $i = 1 To UBound($hash) - 500 $hashcheck = $hash[$i] $PDenc = "hash=" & $hashcheck & "&decrypt=Decrypt" $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("POST", "http://myurl/", False) ; Post url $oHTTP.SetRequestHeader("Host", "myurl") $oHTTP.SetRequestHeader("Connection", "keep-aliveContent-Length: 29") $oHTTP.SetRequestHeader("Cache-Control", "max-age=0") $oHTTP.SetRequestHeader("Origin", "http://myurl") $oHTTP.SetRequestHeader("Upgrade-Insecure-Requests", "1") $oHTTP.SetRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.84 Safari/537.36") $oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded") $oHTTP.SetRequestHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8") $oHTTP.SetRequestHeader("Referer", "http://myurl") $oHTTP.SetRequestHeader("Accept-Language", "en-US,en;q=0.8") $oHTTP.Send($PDenc) $oReceived = $oHTTP.ResponseText $oStatusCode = $oHTTP.Status sleep(2000) If $oStatusCode = 503 then MsgBox(4096, "Response code", $oStatusCode) ExitLoop EndIf ; Saves the body response regardless of the Response code $file = FileOpen("Received.html", 2) ; The value of 2 overwrites the file if it already exists FileWrite($file, $oReceived) $read = FileRead("Received.html") ;read file if StringInStr($read, "not found") Then ContinueLoop Else ContinueLoop $Datastring = ('</script></div><br/>') $newreadamount = _StringBetween($read, $Datastring, "</b><br/><br/>") ;read title from file $newreadamount[0] = StringReplace($newreadamount[0], '<b>', "") ; taking out the X makes it easier to compare value If @error Then ContinueLoop EndIf $file = FileOpen("decrypted.txt", 1) FileWrite($file, $newreadamount[0] & @CRLF) EndIf Next sleep(2000) EndFunc ;==>Example As you can read my script loads 500 lines of text, lets say I have a list with 10.000 lines
      Is there a way to show a progressbar GUI to show how long in a text file I am?
      I may not know how long a particular .txt file is always so I am thinking I need some sort of algorythm?
      Thanks in advance.
      ( I just got unclear if I actually read 500 lines each attempt or if I start with 500 and add 1 to it each time? )
       
      For $i = 1 To UBound($hash) - 500 ; LIke that ^ For $i = 500 To UBound($hash) - 500 ; or like this^ Thanks a lot.
    • ling3882688
      By ling3882688
      There is an Example called _7ZIPExtractEx_Example_using_Callback.AU3 in the 7-Zip UDF.
      I found a problem. If one file in the 7z archive is too big,the progress  bar will stop for a long time.
      How can I get the exact progress even though there are big files in the archive?
      In other words,how to get the exact extracted file size without delay  ?
      7Zip_UDF.zip
    • 31290
      By 31290
      Hi everyone
      Hope you're doing great.
      Well, I'm writing a script that allows our Service Desk to clean several temp folder as a first diagnostic. 
      Indeed, the agent in charge of the issue will have to choose what to clean (web browsers temp folders, some windows one etc...)
      I added a progress bar to see the current state of the script but if I select more than one checkbox, it seems that the counting is not done properly and is directly filled at 100% (when at leat 2 boxes are checked) and I don"t get the final message saying that all is done, especially for if the last box is checked.
      But if I launch the process with only one checkbox checked,it's working...
      I've enclosed the au3 files for you because posting them in this post would be... unreadable lol. So you can maybe do some tests as well.
      I'm pretty sure the code can be optimized (a lot  ) and that there is a much better way to achieve what I want the script to be.
      Maybe can someone can give me a hand over here.
      Thanks in advance.
      31290
      SEE_Delete_Temp.au3
      SEE_Delete_Temp_Functions.au3
×