tolisn Posted April 8, 2008 Posted April 8, 2008 Hi. I'm trying to make a random file copy script using AutoIt3. The script should randomly copy a File from directory A1 and place it in directory B1 with the name background.jpg The script that I tried is the following: #cs ---------------------------------------------------------------------------- AutoIt Version: 3.1.1.0 Author: myName Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here $filename = int(Random(1, 4)) $name = string ($filename) &".jpg" FileCopy("C:\a1\$name", "C:\b1\background.jpg", 1) What am I doing wrong and it is not copying the file ? Please go easy because I'm new at this
weaponx Posted April 8, 2008 Posted April 8, 2008 (edited) #include <file.au3> $sourceFolder = "C:\temp" $destinationFolder = "C:\output" $aFileList = _FileListToArray($sourceFolder, "*.*", 1) $iRandom = Random(1,$aFileList[0],1) FileCopy($sourceFolder & "\" & $aFileList[$iRandom], $destinationFolder) Edited April 8, 2008 by weaponx
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now