Jump to content

Pass Filename As Variable


 Share

Recommended Posts

#include <GUIConstants.au3>

; == GUI generated with Koda ==);

$TrackName = GUICreate("Track Name", 425, 54, 193, 161)

$Currtrack = GUICtrlCreateLabel("Current Track", 8, 16, 290, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")

$Play = GUICtrlCreateButton("PLAY", 320, 8, 97, 33, 0)
GUISetState(@SW_SHOW)

;FileOpenDialog ( "title", "init dir", "filter"
$Filename = FileOpenDialog ( $TrackName, "","All(*.*)",0)

GUICtrlSetData ( $Currtrack, "TrackName: " &$Filename)
 
Run ('C:\Program Files\Windows Media Player\wmplayer.exe $FileName')
;Run ('C:\Program Files\Windows Media Player\wmplayer.exe "F:\MP3\06 - Deeper Well.mp3"')

GUISetState(@SW_SHOW)

While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $Play
     Send("{MEDIA_PLAY_PAUSE}")
;
    EndSelect

    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
    ;;;;;;;
    EndSelect
WEnd
Exit

I can`t work out how to do such a simple thing.... :)

Thanks!

2015 - Still no flying cars, instead blankets with sleeves.

Link to comment
Share on other sites

  • Moderators

Did you try:

Run('C:\Program Files\Windows Media Player\wmplayer.exe ' & '"' & $FileName & '"')
?

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

Run ('C:\Program Files\Windows Media Player\wmplayer.exe $FileName')

^^ that looks like syntax from v2 (if i'm not wrong)... the Variable name i mean,

In the run statement highlighted above, you are not passing the value of $Filename to wmplayer. You are passing "$FileName" to the application.

SmOke_N's code would work...

#)

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...