8 posts in this topic
Struggling to get Filecopy() working
MsgBox(0,"Moving file: ", $fLine) ; C:\AlmeterS3\AI74_No2.csv FileCopy( $fLine, "C:\AlmeterS3\S3_Database\") ; FileCopy( $fLine, $BatchDir & "\S3_Database\") If @error Then MsgBox($MB_SYSTEMMODAL, "ERROR!", "database write error " & @error) EndIf FileDelete( $fLine) doesn't copy only creates a file "C:\AlmeterS3\S3_Database" (actually AI74_No2.csv)
Again my typo I should have added
$FC_OVERWRITE + $FC_CREATEPATH since folder didn't actually exist.
This is a personal project to log into several facebook accounts and send a message to a specific person on their birthday. I need to stop a script in a few different ways for several different reasons. For example, it might start sending the email to the wrong account, it might do something other than send a message, it might fail to logout of one account, etc.
1) Pause the script at it's exact location with a resume feature in case I need to put it on hold while I do another task.
2) Pause the script at it's current location with the option to start over or execute another part of the script (example in GUI with multiple buttons).
Also, is there a way to interact with menus? If I log into facebook how can I force it to go straight to sending a message to the proper person? I tried automating a mouseclick but the window opens in different places. I also tried searching for specific text and I couldn't get any information from the windows info tool on the facebook page.
Also, how do I get my code in here to show like it does in my editor? (scite)
Thanks for looking at it, and any help/suggestions I sgreatly appreciated!
Suppose you want from time to time to update a destination folder with new files that where created at a origin folder.
It´s a kind of synchronization, where new files in origin must be "added" to destination. No worry about files that changed, just the new ones.
The natural way: FileCopy ($originFolder & "\*.*" , $destinationFolder , $FC_NOOVERWRITE)
After many tests, where I have 300 .jpg files in origin and no subfolders:
If there is nothing at destination => OK, copy is done. Now destination has 300 files. If I erase at destination 10 files in the middle (explorer, shift del) and then filecopy => the 10 deleted files are NOT copied !! If I erase at destination 10 files "at the beginning"* (explorer, shift del) and then filecopy => the 10 deleted files are copied !! = OK !! * "at beginning" = sorted by name, ascending, erase the 10 first ones.
** I tried $originFolder & "\*.*" , $originFolder&"\" , $originFolder , and many other variants. The same for destination.
So, what´s seems to me is that when FileCopy finds the first file from origin that exists at destination it stops to search. That´s expected behavior?
I have a script which is copying one file (the latest file among a bunch of structured folders) from one network device to another network device.
The weird thing is the file copied successfully to the destination folder right after the FileCopy command ran but the script is hanging for another few minutes until it return with exit code 0.
Below is my script:
#include <MsgBoxConstants.au3> #include <File.au3> #include <Array.au3> #include <FileConstants.au3> copyfile() Func copyfile() Local $testLogFile = FileOpen(@ScriptDir & "\CopyMSI", 1) Local $BuildArtifacts = "\\vm-build\BuildArtifacts" Local $dServer = "\\VM-DEV\c$\Users\Administrator\Desktop" Send("#r") WinWaitActive("Run") ControlSend("Run", "", 1001, $BuildArtifacts) ControlClick("Run", "OK", 1) _FileWriteLog($testLogFile, "Opened Builds folder") ;trying to get the latest build folder and grab the latest msi file for copying WinWaitActive("BuildArtifacts") Local $FolderList = _FileListToArray($BuildArtifacts, "Grand-4.*") _ArraySort($FolderList, 1) Local $latestSEbuild = $FolderList Sleep (5000) WinClose("BuildArtifacts") Local $sServer = $BuildArtifacts & '\' & $latestSEbuild & '\G4.msi' ; start copying file from build to destination folder FileCopy($sServer, $dServer, $FC_OVERWRITE) _FileWriteLog($testLogFile, "Copied MSI") EndFunc
I'm working on this script:
Case $BTN Global $URL = FileOpenDialog("IMPORT FILE", $DESKTOP, "ALL FORMAT (*)", 4) $DIR_DEST = "C:\DIR-WORK\list\IMPORT_DOC\" DirCreate($DIR_DEST) Local $LINE For $t = 1 To $URL _FileReadToArray($URL[$t], $LINE) For $u = 1 To $LINE FileCopy($URL[$u], $DIR_DEST) Next Next the selected files via OpenFileDialog must be copied to the folder $DIR_DEST.