Jump to content

quoting strings


boeinguy2
 Share

Recommended Posts

I am trying to extend an app to allow the user to define the location and the working directory.

I have set two variables that contain the path for each. Now I am trying to add these variables to RunWait calls. I am having trouble quoting the variables to get the right string:

Func _ProcessVideos($a, $b, $c, $d, $e)

Local $VAR_1

$VAR_1 = $e & '\ffmpeg.exe -i'

RunWait(''$VAR_1 & "" & $a & "" -vcodec copy -acodec copy "temp.mp4"', '"' & $d & '"', @SW_MAXIMIZE)

;RunWait('C:\h264\ffmpeg.exe -i "' & $a & '" -vcodec copy -acodec copy "temp.mp4"', "C:\h264", @SW_HIDE)

MsgBox(0, "", $VAR_1)

;MsgBox(0, "", 'C:\h264\ffmpeg.exe -i "' & $a & '" -vcodec copy -acodec copy "temp.mp4"' "C:\h264")

;RunWait('"' & $e & '\mp4box.exe -raw 1 "temp.mp4"', '"' & $d & '"', @SW_MAXIMIZE)

;RunWait('"' & $e & '\mp4box.exe -raw 2 "temp.mp4"', '"' & $d & '"', @SW_MAXIMIZE)

;RunWait('"' & $e & '\mp4box.exe -add "temp_track1.h264:fps=' & $b & '" -add "temp_track2.aac" "' & $c & '.mp4"', '"' & $d & '"', @SW_MAXIMIZE)

;FileDelete('"' & $d & '\temp.mp4')

;FileDelete('"' & $d & '\temp_track1.h264')

;FileDelete('"' & $d & '\temp_track2.aac')

MsgBox(0, "", "You have completed processing Videos.")

Return

EndFunc ;==>_ProcessVideos

Particularly, this line works:

RunWait('C:\h264\ffmpeg.exe -i "' & $a & '" -vcodec copy -acodec copy "temp.mp4"', "C:\h264", @SW_HIDE)

I am trying to substitute variables into the previous line

Local $VAR_1

$VAR_1 = $e & '\ffmpeg.exe -i'

RunWait(''$VAR_1 & "" & $a & "" -vcodec copy -acodec copy "temp.mp4"', '"' & $d & '"', @SW_MAXIMIZE)

$e is the path to the ffmpeg tools and $d is the path to the working directory. In this case

$d = F:\video\processing

$e = C:\h264

The use of $VAR_1 was one effort to fix the problem. I cannot get the quoting correct to reproduce the previous line

In fact I am a bit confused. When I use a msgbox to see the contents I see what appears to be correct:

FileDelete('"' & $d & '\temp.mp4"')

MsgBox(0, "", '"' & $d & '\temp.mp4"')

Displays this string - "F:\video\processing\temp.mp4" - exactly what I would expect. But the FileDelete will not execute with the quoted string created from a variable, but will execute if I hard code the string into it.

Thanks for the help.

Link to comment
Share on other sites

Try:

FileDelete('"' & $d & '\temp.mp4' & '"')

In fact I am a bit confused. When I use a msgbox to see the contents I see what appears to be correct:

FileDelete('"' & $d & '\temp.mp4"')

MsgBox(0, "", '"' & $d & '\temp.mp4"')

Displays this string - "F:\video\processing\temp.mp4" - exactly what I would expect. But the FileDelete will not execute with the quoted string created from a variable, but will execute if I hard code the string into it.

Thanks for the help.

Link to comment
Share on other sites

Thanks, but that did not work. either.

using msgbox I get the following for the string:

"F:\Video\Processing"

which means that I should be submitting the following command:

FileDelete("F:\Video\Processing") - this should be the correct syntax but it does not work.

If I hard code the statement with the same syntax, it performs correctly. What gives?

Edited by boeinguy2
Link to comment
Share on other sites

I am really stuck here so any help would be appreciated. This is one of three things I need to finish before the app is complete.

If you use a literal string like c:\filepath\filename then filedelete needs to have the string quoted to recognize it as a string.

FileDelete("c:\filepath\filename")oÝ÷ Øò¢ë¬y«­¢+ØÀÌØíÍ}¥±Áѡѽ±ÑôÅÕ½ÐíèÀäÈí¥±ÁÑ ÀäÈí¥±¹µÅÕ½ÐoÝ÷ ÚØ^«­¢+Ø¥±±Ñ ÀÌØíÍ}¥±Áѡѽ±Ñ¤

need not be quoted. I tested this with spaces in the file or directory name as well.

Link to comment
Share on other sites

While you probably have this by now, I'll throw it out there...

The string is what needs the quotes not the function. Thus:

FileDelete("file.txt")

or

$file = "file.txt"

FileDelete($file) ;no quotes

or

$path = "c:\dir"

FileDelete($path & "\file.txt") ;quotes around the string only

Link to comment
Share on other sites

Thanks to both of you!. I was able to get this one working: FileDelete($path & "\file.txt").

The problem was that I was trying to hard code the first quote and apparently with a variable at the beginning I did not need to do that.

Thanks again. Just two more functions to go and I am done.

Link to comment
Share on other sites

While you probably have this by now, I'll throw it out there...

The string is what needs the quotes not the function. Thus:

FileDelete("file.txt")

or

$file = "file.txt"

FileDelete($file) ;no quotes

or

$path = "c:\dir"

FileDelete($path & "\file.txt") ;quotes around the string only

was gonna write the same thing :) but ya I always store strings in variables...just a habit i guess

*WoW Dev Projects: AFK Tele Bot development journalSimple Player Pointer Scanner + Z-Teleport*My Projects: coming soon.Check out my WoW Dev wiki for patch 3.0.9!http://www.wowdev.wikidot.com

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