Jump to content

Using a UDV with a Run command


Guest Synthetic ID
 Share

Recommended Posts

Guest Synthetic ID

A friend guided me to AutoIt about 2 days ago, cause I hated having a dos window open during a .BAT file being ran. Right now, I am trying to add a variable of $path, which I have used as an input box in a GUI to get a path name that the user enters, but I wanted to try to use the stored variable in a run command. Here is the snippets of my code where it involves the $path variable

$path = GuiCtrlCreateInput("D:\DVD_VIDEO\{movie}\VIDEO_TS\{filename.vob}",10,25,294,20)
RunWait("C:\Program Files\AutoGK\DGMPGDec\DGIndex.exe -AIF=[{$path}] -OF=[""] -exit","",@SW_MINIMIZE)

I've tried it like that, as well, I've also tried to unquote where the $path begins and the $path variable ends, with no luck (i.e. "... -AIF=["$path"]...").

Is this even possible or am I trying to hard?

Any help would be appreciated, even if it's to call me an idiot :whistle:

Link to comment
Share on other sites

Welcome to the forums!

Variables aren't recognised within a string. Also, if you use double quotes within a string that is surrounded by them then you need to either double up on the internal ones or use single quotes around the string instead.

$path = GuiCtrlCreateInput("D:\DVD_VIDEO\{movie}\VIDEO_TS\{filename.vob}", 10, 25, 294, 20)
RunWait('C:\Program Files\AutoGK\DGMPGDec\DGIndex.exe -AIF=[{' & $path & '}] -OF=[""] -exit', "", @SW_MINIMIZE)
Link to comment
Share on other sites

Guest Synthetic ID

I've tried double quoting and every other possible method I can think, but if variables aren't passable within a string then I guess, I'll have to think of something else. Thanks a lot. The script I wrote up there is wrong as well, I edited it before I pasted it in, but oh well. Thanks for your help. :whistle:

Link to comment
Share on other sites

Don't dispare so quickly... LxP said that variables are not recognized "within" a string -- not that they couldn't be passed "with" a string.

He showed you an example how you can do it (notice the &'s)

To illustrate:

$a = "John"
$b = "Smith"

$x = "$a $b"
$y = $a & $b
$z = $a & " " & $b

$x is now the string "$a $b" because variable substitution is not done inside quotes.

$y is now the string "JohnSmith" and $z is "John Smith"

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Guest Synthetic ID

I tried a few other methods, and I had one to work, where I set a variable and it grabbed the $path variable with GUICtrlRead($path) and then it grabbed it in the clipboard, and pasted it into a temp.bat file, where it ran it using _RunDOS, although, I was having errors, which I eventually debugged. Although, I still had one with DGIndex.exe which I figured out and tried to fix, but now my whole set up isn't working. I am gonna try your idea DaleHohm, and see what the result will become. I am quite the noob at this, and of course I had to make something that required thought, lol.

Thanks for your help guys.

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