Search the Community
Showing results for tags 'wont copy'.
-
Hello Experts, I am trying to create a script that will go onto my network and copy a word document to a local folder then open it. When I hard code the FileCopy, it works perfectly, but when I use variables for file path and file name, only the local folder I need gets created. I cannot seem to get the file to open even when using the hard coded path in function FileOpen code. Here is my code with comments on what is happening. #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> $ProductName = "Microsoft Word 2013" $AbvLanguage = "ENG" $Network = "mynetwork" $Folder = "shared" $SampleDocs = "Sample Documents" $DocumentName = "Holiday Schedule.docx" ;Or $FileLocation = "mynetwork\shared\Sample Documents" SampleDocument () Func SampleDocument() ;This commented out hard coded line of code below works and does the copy, create local folder, and paste ;FileCopy ("\\mynetwork\shared\Sample Documents\Microsoft Word 2013\ENG\Holiday Schedule.docx","c:\Sample Documents\",8) ;The opening of FileOpen line of code below has not worked yet, even when the file copy works FileOpen ("C:\Sample Documents\Holiday Schedule.docx") ;Here are the 2 versions of FileCopy code(I only need one, one that works) and 1 version of FileOpen code I want to use with variables that has not work, ever ;FileCopy ("\\$Network\$Folder\$SampleDocs\$ProductName\$AbvLanguage\$DocumentName","c:\Sample Documents\",8) ;FileCopy ("\\$FileLocation\$ProductName\$AbvLanguage\$DocumentName","c:\Sample Documents\",8) ;FileOpen ("c:\$SampleDocs\$DocumentName") EndFunc What am I missing here? Is this as simple as you cannot use variables to create file paths in the FileCopy function?