Sign in to follow this  
Followers 0
Lakes

Pass Filename As Variable

4 posts in this topic

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

Share this post


Link to post
Share on other sites



Did you try:

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


[center]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.[/center]

Share this post


Link to post
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...

#)

Share this post


Link to post
Share on other sites

Yep, it works!, thanks Guys!

I had tried the double quotes thing, I see, you have to put the filename quotes in quotes.. :)


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

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
Sign in to follow this  
Followers 0