Jump to content

need to open files


Recommended Posts

open all files in a dir anybody know how?

not all files like this

FileOpenDialog("open", @MyDocumentsDir, "All files (*.*)")

but all the files

Edited by (^_^)

[center][font="Arial Black"] DESEAN[/font][/center] [center]<<<WOW Fi$her>>>[/center][center]<<<mp3 player>>>[/center]

Link to comment
Share on other sites

  • Moderators

What kind of files?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

i need it to open all .mp3 and .wav just to add then to GuiCtrlCreateList("", 3, 105, 215, 115)

i know how to open then individualy to add them to my list but i wanna just open all mp3 and wav in a dir

not like this

FileOpenDialog("open", @MyDocumentsDir, ".mp3 (*.mp3)| .wav (*.wav)")

Edited by (^_^)

[center][font="Arial Black"] DESEAN[/font][/center] [center]<<<WOW Fi$her>>>[/center][center]<<<mp3 player>>>[/center]

Link to comment
Share on other sites

#include <GUIConstants.au3>
$player = GUICreate("music player", 220, 200, 180, 125, -1)
GUISetState(@SW_SHOW,$player)
$play = GUICtrlCreateButton("Play", 3, 3, 58, 25)
$stop = GUICtrlCreateButton("Stop", 63, 3, 52, 25)
$open = GUICtrlCreateButton("Open", 117, 3, 52, 25)
$Volume = GuiCtrlCreateSlider(3, 50, 165, 20)
GuiCtrlCreateLabel("Volume", 3, 35, 40, 20)
$List = GuiCtrlCreateList("", 3, 105, 215, 115)
GUICtrlSetData($Volume, 100)
$updown = GUICtrlCreateUpdown($List)
$VolLevel = 100
Func _GetExtProperty($sPath, $iProp)
    Local $iExist, $sFile, $sDir, $oShellApp, $oDir, $oFile, $aProperty, $sProperty
    $iExist = FileExists($sPath)
    If $iExist = 0 Then
        SetError(1)
        Return 0
    Else
        $sFile = StringTrimLeft($sPath, StringInStr($sPath, "\", 0, -1))
        $sDir = StringTrimRight($sPath, (StringLen($sPath) - StringInStr($sPath, "\", 0, -1)))
        $oShellApp = ObjCreate ("shell.application")
        $oDir = $oShellApp.NameSpace ($sDir)
        $oFile = $oDir.Parsename ($sFile)
        If $iProp = -1 Then
            Local $aProperty[35]
            For $i = 0 To 34
                $aProperty[$i] = $oDir.GetDetailsOf ($oFile, $i)
            Next
            Return $aProperty
        Else
            $sProperty = $oDir.GetDetailsOf ($oFile, $iProp)
            If $sProperty = "" Then
                Return 0
            Else
                Return $sProperty
            EndIf
        EndIf
    EndIf
EndFunc
While 1
        $msg = GUIGetMsg()
        Select
       Case $msg = $GUI_EVENT_CLOSE
         GUIDelete()
         Exit
         Case GUICtrlread($Volume) <> $VolLevel
             $VolLevel = GUICtrlRead($Volume)
            SoundSetWaveVolume ($VolLevel)
        Case $msg = $open
                $song = FileOpenDialog("open", @MyDocumentsDir, "MP3's (*.mp3)|WAV's (*.wav)", 4)
    $title = _GetExtProperty($song,10)
    $artist = _GetExtProperty($song,16)
    GUICtrlSetData($list, $artist &" - " & $title &  "                                                        " & $song)
            Case $msg = $play
            $Selection = GuiCtrlRead($List)
            $result = StringInStr($Selection, "C:\")
            $cut = StringTrimLeft($Selection, $result -1)
                $title = _GetExtProperty($cut,10)
                $artist = _GetExtProperty($cut,16)
            GuiCtrlCreateLabel($artist & " - " & $title, 3, 70, 215, 20)
            Soundplay ($cut)
            
        Case   $msg = $stop
            soundplay("")
    EndSelect
WEnd

heres what i have ... what i need it to do is open up multiple files at once with out it adding in the quotation marks ... thats my trouble if you just open one song and add it to the list it works fine cuz when one item is selected it opens it with out quotes... but when multi files selected it adds quotes

ex

"1-06 Simple Man.mp3" "1-13 Free Bird.mp3" "01 - Hoobastank - Crawling In The Dark.mp3" "01 - Metallica - Enter Sandman.mp3" "01 - Static X - Push It.mp3" "01 - System of a Down - Prison Song.mp3"

and when just opening one song

01 - System of a Down - Prison Song

the quotes mess up my script some how ...

Edited by (^_^)

[center][font="Arial Black"] DESEAN[/font][/center] [center]<<<WOW Fi$her>>>[/center][center]<<<mp3 player>>>[/center]

Link to comment
Share on other sites

this should get you closer

#include <GUIConstants.au3>

$player = GUICreate("music player", 220, 200, 180, 125, -1)
GUISetState(@SW_SHOW, $player)
$play = GUICtrlCreateButton("Play", 3, 3, 58, 25)
$stop = GUICtrlCreateButton("Stop", 63, 3, 52, 25)
$open = GUICtrlCreateButton("Open", 117, 3, 52, 25)
$Volume = GUICtrlCreateSlider(3, 50, 165, 20)
GUICtrlCreateLabel("Volume", 3, 35, 40, 20)
$List = GUICtrlCreateList("", 3, 105, 215, 115)
GUICtrlSetData($Volume, 100)
$updown = GUICtrlCreateUpdown($List)
$VolLevel = 100

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            GUIDelete()
            Exit
        Case GUICtrlRead($Volume) <> $VolLevel
            $VolLevel = GUICtrlRead($Volume)
            SoundSetWaveVolume($VolLevel)
        Case $msg = $open
            $song = FileOpenDialog("open", @MyDocumentsDir, "MP3's (*.mp3)|WAV's (*.wav)", 4)
            $song = StringSplit($song,"|")
            For $x = 2 To $song[0]
                $title = _GetExtProperty($song[0] & "\" & $song[$x], 10)
                $artist = _GetExtProperty($song[0] & "\" & $song[$x], 16)
                GUICtrlSetData($List, $artist & " - " & $title & "                                                        " & $song[$x])
            Next
        Case $msg = $play
            $Selection = GUICtrlRead($List)
            $result = StringInStr($Selection, "C:\")
            $cut = StringTrimLeft($Selection, $result - 1)
            $title = _GetExtProperty($cut, 10)
            $artist = _GetExtProperty($cut, 16)
            GUICtrlCreateLabel($artist & " - " & $title, 3, 70, 215, 20)
            MsgBox(1, "filepath", $cut)
            SoundPlay($cut)
            
        Case $msg = $stop
            SoundPlay("")
    EndSelect
WEnd

Func _GetExtProperty($sPath, $iProp)
    Local $iExist, $sFile, $sDir, $oShellApp, $oDir, $oFile, $aProperty, $sProperty
    $iExist = FileExists($sPath)
    If $iExist = 0 Then
        SetError(1)
        Return 0
    Else
        $sFile = StringTrimLeft($sPath, StringInStr($sPath, "\", 0, -1))
        $sDir = StringTrimRight($sPath, (StringLen($sPath) - StringInStr($sPath, "\", 0, -1)))
        $oShellApp = ObjCreate("shell.application")
        $oDir = $oShellApp.NameSpace ($sDir)
        $oFile = $oDir.Parsename ($sFile)
        If $iProp = -1 Then
            Local $aProperty[35]
            For $i = 0 To 34
                $aProperty[$i] = $oDir.GetDetailsOf ($oFile, $i)
            Next
            Return $aProperty
        Else
            $sProperty = $oDir.GetDetailsOf ($oFile, $iProp)
            If $sProperty = "" Then
                Return 0
            Else
                Return $sProperty
            EndIf
        EndIf
    EndIf
EndFunc   ;==>_GetExtProperty

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

try this with open button

Case $msg = $open
            $song = FileOpenDialog("open", @MyDocumentsDir, "MP3's (*.mp3)|WAV's (*.wav)", 4)
            If StringInStr($song,"|") Then
                $song = StringSplit($song,"|")
                For $x = 2 To $song[0]
                    $title = _GetExtProperty($song[0] & "\" & $song[$x], 10)
                    $artist = _GetExtProperty($song[0] & "\" & $song[$x], 16)
                    GUICtrlSetData($List, $artist & " - " & $title & "                                                        " & $song[$x])
                Next
            Else
                Local $szDrive, $szDir, $szFName, $szExt
                _PathSplit($song, $szDrive, $szDir, $szFName, $szExt)

                $title = _GetExtProperty($song, 10)
                $artist = _GetExtProperty($song, 16)
                GUICtrlSetData($List, $artist & " - " & $title & "                                                        " & $szFName)
            EndIf

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

giving me error

C:\Documents and Settings\Shawn\Desktop\gui\tester.au3(61,69) : ERROR: _PathSplit(): undefined function.

_PathSplit($song, $szDrive, $szDir, $szFName, $szExt)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

i dnt have a path split function did you put and #incude with the script?

[center][font="Arial Black"] DESEAN[/font][/center] [center]<<<WOW Fi$her>>>[/center][center]<<<mp3 player>>>[/center]

Link to comment
Share on other sites

... idn i think my comp it gay even with #include<file.au3> its not working.... but i think ill just write a bot to open all files in my mp3 folder. that seems to be my only option cuz none of the includes seem to be working.

[center][font="Arial Black"] DESEAN[/font][/center] [center]<<<WOW Fi$her>>>[/center][center]<<<mp3 player>>>[/center]

Link to comment
Share on other sites

)" data-cid="208103" data-date="Jul 16 2006, 10:49 AM">

... idn i think my comp it gay even with #include<file.au3> its not working.... but i think ill just write a bot to open all files in my mp3 folder. that seems to be my only option cuz none of the includes seem to be working.

Maybe it's just a typo in your post, but you must ensure that it's a space in there :

#include <file.au3>
Link to comment
Share on other sites

nope insured there was the space but still getting error

C:\Documents and Settings\Shawn\Desktop\gui\tester.au3(62,69) : ERROR: _PathSplit(): undefined function.

_PathSplit($song, $szDrive, $szDir, $szFName, $szExt)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\Documents and Settings\Shawn\Desktop\gui\tester.au3 - 1 error(s), 0 warning(s)

i dnt get it i seem to get errors when i try to include files fron beta... mabye something it corrupted some how ill try to reilstall everything even when i use _ispressed i get errors unless i copy and paste that function into the script.

[center][font="Arial Black"] DESEAN[/font][/center] [center]<<<WOW Fi$her>>>[/center][center]<<<mp3 player>>>[/center]

Link to comment
Share on other sites

  • Moderators

Are you using the Beta?

#include <file.au3>
is correct for that function option.

http://www.autoitscript.com/forum/index.php?showtopic=23823

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...