Jump to content

Recommended Posts

Posted

Hi all !

Need help once more :lmao: I'm a total lame and feel shame but have no clue how to solve it.

Have script which uses xcopy and progress bar from my guru ezzetabi :

; Script Start - Add your code below here

$src="c:\intel"

_xcopyWithDialog($src, "c:\temp")

Func _xcopyWithDialog($sStartingDir, $sDestDir, $sSettings = '/i/c/e/d/h/r/y')

Local $iPid, $iSDSize, $iODSize

If FileExists($sStartingDir) And StringInStr(FileGetAttrib($sStartingDir), 'd') Then

$iPid = Run(@comspec & ' /c xcopy "' & $sStartingDir & '" "' & $sDestDir & '" ' & $sSettings)

$iSDSize = DirGetSize($sStartingDir)

ProgressOn ( "XCopy", "Coping temp please wait...")

While ProcessExists($iPid)

$iODSize = DirGetSize($sDestDir)

ProgressSet(Round(100 * $iODSize / $iSDSize) )

Sleep(100)

WEnd

ProgressOff( )

Else

Return -1

EndIf

EndFunc

;

And want to hide dos window with xcopy @swhide doesn't work - or I do not know how to make it correctly.

I have added to line with run command comma separated as a flag ( so it looked like this : $iPid = Run(@comspec & ' /c xcopy "' & $sStartingDir & '" "' & $sDestDir & '" ' & $sSettings ,@swhide) but script shows erros ;)

Can anyone help me ?

Thanks

Pietka

Posted

$iPid = Run(@comspec & ' /c xcopy "' & $sStartingDir & '" "' & $sDestDir & '" ' & $sSettings , '', @SW_HIDE)

Also the working dir parameter is needed. :lmao:

Posted

Ok - I made mistake here on the forum - of course I typed in @sw_hide .... but it doesn't work - says unable to execute the external program ... :lmao:

Mhz - directory is not needed - beacuase it is in the code ... ;)

  • Moderators
Posted

MHz is saying you have to have 3 parameters if you are going to use @SW_HIDE .

example:

Run(

Parameter One = @comspec & ' /c xcopy "' & $sStartingDir & '" "' & $sDestDir & '" ' & $sSettings,

Parameter Two = '', (you need the quotes at least)

Parameter Three = @SW_HIDE)

To give you:

Run(@comspec & ' /c xcopy "' & $sStartingDir & '" "' & $sDestDir & '" ' & $sSettings , '', @SW_HIDE)

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Posted (edited)

Mhz - directory is not needed - beacuase it is in the code ... :lmao:

Yes, it is indeed. You must use the optional Working Directory parameter in the Run() function if you want to use the flag parameter. You had it missing.

Your original command with additions in red:

$iPid = Run(@comspec & ' /c xcopy "' & $sStartingDir & '" "' & $sDestDir & '" ' & $sSettings, '' ,@sw_hide)

Edit: Thanks SmOke_N, I did not see your post. ;)

Edited by MHz
Posted

Great it works - sorry Mhz - misunderstanding ...

Funniest thing is that I was really close to this solution but missed quotas before comma ....

Regards

Pietka

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