Sign in to follow this  
Followers 0
gcue

trying to get a return value from FileCopy

5 posts in this topic

#1 ·  Posted (edited)

I am trying to get a return value with this:

$copy = RunWait(@AutoItExe & ' /AutoIt3ExecuteLine "FileCopy(''' & $source_path & ''', ''' & $target_path & ''', 1 )"')

MsgBox(0,"",$copy)

but i think that returns the value for RunWait. this doesnt work either:

local $copy

RunWait(@AutoItExe & ' /AutoIt3ExecuteLine ' & $copy & '=' & '"FileCopy(''' & $source_path & ''', ''' & $target_path & ''', 1 )"')

MsgBox(0,@error,$copy)

reason i am using /autoit3execulteline is because i am copying large files, gui becomes unresponsive if i dont use it.

can anyone shed any light on this?

thanks!

Edited by gcue

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

try to put the filecopy inside the Exit function to let the interpreter end with the return of filecopy:

$copy = RunWait(@AutoItExe & ' /AutoIt3ExecuteLine "Exit(FileCopy(''' & $source_path & ''', ''' & $target_path & ''', 1 ))"')
Edited by JFX

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

works great! so what is it exiting?

thanks JFX!!

Edited by gcue

Share this post


Link to post
Share on other sites

works great! so what is it exiting?

thanks JFX!!

The Exit() function will set the %ErrorLevel% of the newly started Autoit.exe to 1 if Filecopy was successfully or to 0 if filecopy failed.

The RunWait will save that %ErrorLevel% in the $copy variable.

Share this post


Link to post
Share on other sites

genius!

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