hogfan Posted October 3, 2013 Share Posted October 3, 2013 (edited) Hello, I have run into a strange issue with my application written in AutoIT lately. I was using the old Word.au3 UDF function WordDocSaveAs to save a word document to a UNC path. I updated my code to use Water's new WordEx.au3 functions, and this resolved the previous issue I was having (a crash un-related to this issue). With the new WordEx.au3 Word_DocSaveAs function I started to get failures saving to the UNC path I was previously saving the file to. So I figured, maybe there was something different between the two Word UDFs. So to work around this I just decided to save the Word document locally to the desktop first, and then use a FileCopy function to copy the file to the UNC path. However, the FileCopy still failed as well. So next I tried attempting the Filecopy within a For......Next Loop with a sleep of 10000 between attempts, thinking maybe their was just latency to the UNC path. ;attempt to copy Files up to 3 attempts For $x = 1 to 3 If FileCopy($sourceFile, $destFile, 9) Then ExitLoop Sleep(10000) Next ;If the FileCopy fails more than 3 times If $x > 3 Then Msgbox(64, "Copy Failed!", "The copy was not able to complete successfully!") Else Msgbox(64, "Copy Complete!", "The copy completed successfully!") EndIf This continued to failed. I would think that this was a permissions related issue to the UNC path, but I am able to browse to this location manually, and manually copy files over without issue. In addition, I am able to access the UNC path directly from the Run command as well. Any ideas as to why the filecopy function would not be able to write to the UNC path, but I obviously have permissions as I can create files manually there? As for additional troubleshooting, I am displaying a messagebox to display my $sourceFile & $destFile variables and there are not any issues with the path names. I have also tried putting " " around the paths but that does not seem to make a difference. Any suggestions are appreciated as I am scratching my head on this one. -hogfan Edited October 3, 2013 by hogfan Link to comment Share on other sites More sharing options...
water Posted October 3, 2013 Share Posted October 3, 2013 You talk about FileCopy but use DirCopy in your script My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
hogfan Posted October 3, 2013 Author Share Posted October 3, 2013 Water - Sorry about that. I'm am using the example code in two different scripts. I just copied the block of code as and example. Copy & paste error on my part. It should read FileCopy. I will edit that to avoid any confusion. -hogfan Link to comment Share on other sites More sharing options...
water Posted October 3, 2013 Share Posted October 3, 2013 Can you post the values of $sourceFile and $destFile? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
hogfan Posted October 3, 2013 Author Share Posted October 3, 2013 The value of $destFile is: server.domain.comshared0163LettersNew LettersCustomer Letters2013-Customer Letters (folder #2) the value of $sourceFile is: C:Documents & SettingsmyUsernameDesktopNew Customer Letter.doc -hogfan Link to comment Share on other sites More sharing options...
hogfan Posted October 3, 2013 Author Share Posted October 3, 2013 Also, I find it odd that FileCopy to the UNC path doesn't work, but I am able to programmatically open the share with ShellExecute('"' & $destFile & '"') and once that window opens I can manually drag and drop the file there from the desktop. -hogfan Link to comment Share on other sites More sharing options...
water Posted October 3, 2013 Share Posted October 3, 2013 Does DriveMapAdd("*", "\\server.domain.com\shared") MsgBox(0, "DriveMapAdd", "@error = " & @error) work for you? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
BrewManNH Posted October 3, 2013 Share Posted October 3, 2013 Is $sourcefile actually set to "C:Documents & Settings" or is it set to "C:Documents and Settings"? If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
hogfan Posted October 3, 2013 Author Share Posted October 3, 2013 @Brewman It is actually set to "C:Documents and Settings". I just typed in the path in my post. Good catch though. I've done some more digging and I'm still leaning to a possible permission related issue on the share......I found out it is a Novell share. I just doesn't make sense that that I can shell to that path and then drag and drop a file there, but the filecopy fails. -hogfan Link to comment Share on other sites More sharing options...
blckpythn Posted October 4, 2013 Share Posted October 4, 2013 (edited) Do your paths need quotes? Example: FileCopy('"' & $source & '"', '"' & $dest & '"', 9) Edited October 4, 2013 by blckpythn Link to comment Share on other sites More sharing options...
KaFu Posted October 4, 2013 Share Posted October 4, 2013 Maybe give this one a try? FileCopy("C:\Documents and Settings\myUsername\Desktop\New Customer Letter.doc", "\\?\UNC\server.domain.com\shared\0163\Letters\New Letters\Customer Letters\2013-Customer Letters (folder #2)\") OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
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