Jump to content

Run exe from and with depdenants in @temp but working with select dir


Recommended Posts

I have an 1.exe that runs from @temp and uses another 2.exe that must be in the same dir (@temp). But I can't get 1.exe to run with path of @temp and process files in $somefolder. I have tried changing working dir in run(), and filechangedir().

I can get it to work if I use cmd.exe and run script from $somefolder. like this:

    send('set path=' & @TempDir & "{ENTER}")
    Send('for %a in ("*.*") do 1.exe -s  ' & $option & '  "%a"' & "{ENTER}")

But I need to make it work from anywhere, when $somefolder is set with FileSelectFolder. Like This:

$somefolder = FileSelectFolder("Select Folder", "")
$Afiles = _FileListToArray($somefolder)
$1exe = @TempDir&"\1.exe"

for $i = 1 to $Afiles[0]
    $file = $Afiles[$i]
    Run('"' & $1exe & '" -s ' & $option & " " & $file, $somefolder)
Link to comment
Share on other sites

Just curious, what is the goal?

Be easier for someone to figure a solution if you're willing to reveal.


Are you certain you want to pass folders as well as files to your exe?

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

I am happy to elaborate as needed. I am sorry if I sounded cryptic, not my intentions. I just dont know what information is useful. 1exe is an exe that when given the intended file size (-s & $option) and input file ($file) will run ffmpeg (located in same folder as 1exe) and calculate the bitrate required for ffmpeg to output the file at intended file size. I can run 1exe with ffmpeg in $somefolder. But not from @Temp and still process files in $somefolder.

Is this enough info? Please ask if you need more.

Link to comment
Share on other sites

The failure is that when i run 1exe from @temp it looks for ffmpeg in the working dir. And passes working dir to ffmpeg. So if ffmpeg is in $somefolder, then everything works. In the first post you see that with cmd you can change path and working dir stays @scriptdir. A workaround for my problem is to copy ffmpeg to $somefolder, bit i was hoping for a solution. Is there one? Thanks for helping.

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...