Alexxander Posted January 20, 2014 Posted January 20, 2014 Hi all i had found this function (it read an mp3 file length) $FileName = '"C:\Users\Administrator\Desktop\1.mp3"' mciSendString("Open " & $FileName & " alias MediaFile") mciSendString("Set MediaFile time format milliseconds") $answer = mciSendString("Status MediaFile length") $answerfinl = Ceiling($answer / 1000) mciSendString("Close MediaFile") MsgBox(0,0,$answerfinl) Func mciSendString($string) Local $ret $ret = DllCall("winmm.dll","int","mciSendString","str",$string,"str","","int",65534,"hwnd",0) If Not @error Then Return $ret[2] EndFunc it is working fine when i specify the path out i want to input the pat using inputbox i'll need variables the problem is that i cant write the single quote and double quotes in the path and the unctio will not work until the path is surrounded by 2 single quotes and inside them 2 double quotes i tried this but no luck $path1 = "C:\Users\Administrator\Desktop\" $path2 = "1.mp3" $FileName = ("'" & '"' & $path1 & $path2 & '"' & "'") mciSendString("Open " & $FileName & " alias MediaFile") mciSendString("Set MediaFile time format milliseconds") $answer = mciSendString("Status MediaFile length") $answerfinl = Ceiling($answer / 1000) mciSendString("Close MediaFile") MsgBox(0,0,$answerfinl) Func mciSendString($string) Local $ret $ret = DllCall("winmm.dll","int","mciSendString","str",$string,"str","","int",65534,"hwnd",0) If Not @error Then Return $ret[2] EndFunc any ideas?
Solution michaelslamet Posted January 20, 2014 Solution Posted January 20, 2014 Try this: $FileName = '"' & $path1 & $path2 & '"' Alexxander 1
Alexxander Posted January 20, 2014 Author Posted January 20, 2014 Try this: $FileName = '"' & $path1 & $path2 & '"' woow it worked but can u explain how ? im confused i wasted a lot of time on this
michaelslamet Posted January 20, 2014 Posted January 20, 2014 (edited) woow it worked but can u explain how ? im confused i wasted a lot of time on this If you see, there is nothing special For quote a string, we can use ' or " If we want quote char " then we should use ' eg: '"' If we want quote char ' then we should use " eg: "'" edit: typo Edited January 20, 2014 by michaelslamet Alexxander 1
Alexxander Posted January 20, 2014 Author Posted January 20, 2014 If you see, there is nothing special For quote a string, we can use ' or " If we want quote char " then we should use ' eg: '"' If we want quote char ' then we should use " eg: "'" edit: typo so their is no need for srounding the path with single quotes and double quotes '"C:UsersAdministratorDesktop1.mp3"' you mean that only 2 double quotes is enough "C:UsersAdministratorDesktop1.mp3" thanks man you are awesome
michaelslamet Posted January 20, 2014 Posted January 20, 2014 so their is no need for srounding the path with single quotes and double quotes '"C:UsersAdministratorDesktop1.mp3"' you mean that only 2 double quotes is enough "C:UsersAdministratorDesktop1.mp3" thanks man you are awesome Yes, you're correct. Only 2 double quotes are enough, no need to surrounding the path with single quotes and double quotes. No, I'm not awesome This is basic and just you like, I learn a lot from many awesome people here Alexxander 1
Alexxander Posted January 20, 2014 Author Posted January 20, 2014 Yes, you're correct. Only 2 double quotes are enough, no need to surrounding the path with single quotes and double quotes. No, I'm not awesome This is basic and just you like, I learn a lot from many awesome people here thanks buddy ...
mikell Posted January 20, 2014 Posted January 20, 2014 This doesn't work ? $FileName = $path1 & $path2 mciSendString('Open "' & $FileName & '" alias MediaFile')
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now