Do scirpt for copy file

for(var a=0;a<myDoc.links.length;a++){
            var  f = File(myDoc.links[a].filePath);
            var fname = f.name;
            copyPasteScript = "tell application \"Finder\"\r";
           copyPasteScript += "copy file \""+myDoc.links[a].filePath+"\" to folder \""+ArtFolder+"\"\r";
            copyPasteScript += "end tell";
            app.doScript(copyPasteScript, ScriptLanguage.applescriptLanguage);
            var f2 = File(ArtFolder+"/"+fname);
            myDoc.links[a].relink(f2);
            myDoc.links[a].update();
it throws error in the highlighted line what to do....

Why NOT use ID's links copyLink to folder? No need to involve AppleScript and Finder…
#target indesign
var userHome = Folder('~').fsName.toString();
var linksFolder = userHome + '/Desktop/ID Links/';
myLinks = CreateFolder(linksFolder);
main();
function main() {
if (app.documents.length == 0) {
alert('Please have an "Indesign" document before running this script.');
return;
docRef = app.activeDocument;
with(docRef) {
for (var i = 0; i < links.length; i++) {
links[i].copyLink(myLinks);
function CreateFolder(Directory) {
var folderPath = new Folder(Directory);
if (folderPath.exists == false) {
folderPath.create();
return folderPath;

Similar Messages

  • I have a passport external hard. previously, I used it on windows, then I changed my laptop to mac. Now, It's only read. How can I use it for copying files on it on mac? I don wanna use it on windows again.

    I have a passport external hard. previously, I used it on windows, then I changed my laptop to mac. Now, It's only read. How can I use it on my mac for copying files on my passport? I don wanna use it on windows again.

    If you're not going to use the drive on a Windows machine, you should use Disk Utility (Applications>Utilities folder) to erase the drive and format it as "Mac OS Extended (Journaled)" with a single GUID partition (default):
    Good luck,
    Clinton

  • Logon Scripts for copying files in Windows 7

    Issues using Logon scripts to copy files in windows 7.  Its default is to append the file rather than copy and replace, which is what XP did.  How can I achieve the same results using
    logon scripts in W7 to copy any files to specified folders and replacing old files.  The reason for this is that we use a software that performs offsite/onsite updates and the only way all the users can have the correct version/tables is to either manually
    update each user in a 90+ user environment or use a logon script to perform the coping of the updates.  Unfortunately the software support won’t create a (while logging in to software) patch for this.  So we have to force it during the user logon.

    Hi Novice,
    It should depend on your script content. it's recommended you ask in the official scripting guys forum for professional help:
    https://social.technet.microsoft.com/Forums/scriptcenter/en-US/home?forum=ITCG
    Karen Hu
    TechNet Community Support

  • Script for copying files to drop boxes of other Macs

    I don't know much about scripts as yet, but for daily backup purposes
    I would like to copy all new or modified files from various folders
    to the drop boxes of two other Macs (like the old DOS command XCopy)
    and then reset the "modified attributes" (is there something like that at all?)
    of these files.
    A script could do this without the need to always find and select these files
    and to always confirm the messages "You can put items into “Drop Box”,
    but you won’t be able to see them. Do you want to continue?".
    Thanks!

    Here is a short skeleton which doesn't treat subfolders.
    May you check if it do what you want ?
    property sourceFolder : "/Users/home/Documents/Pages/current/"
    property destFolder : "/cr1’s iMac.afpovertcp.tcp.local/cr1's%20Public%20Folder/Drop Box/backup/Documents/Pages/current/"
    on run
    tell application "System Events"
    set dest_folder to path of folder destFolder
    set listeSource to path of disk items of folder sourceFolder
    repeat with sf in listeSource
    if visible of disk item sf then
    tell disk item sf
    set sn to name
    set smd to modification date
    end tell
    if exists disk item sn of folder destFolder then
    set needCopy to modification date of disk item sn of folder destFolder is not smd
    else
    make new file at end of folder destFolder with properties {name:sn}
    set needCopy to true
    end if -- exists disk item
    if needCopy then my copyFile(sf, dest_folder)
    end if -- visible …
    end repeat
    end tell -- System Events
    end run
    on copyFile(sourceFile, targetFolder) (*
    sourceFile is the path to the source file as text,
    dest_folder is the path to the destination folder as text
    newFileName is the name of the file as text
    tell application "Finder"
    duplicate file sourceFile to folder targetFolder with replacing
    end tell
    end copyFile
    Yvan KOENIG (VALLAURIS, France) mercredi 16 décembre 2009 18:33:43

  • Logs for copied files

    Hello,
    Is there somewhere a log file that shows wich files are copied (from HD to HD, to a burning Program, or copied over the network).
    Thanks

    Unfortunately, no. Unless you install the common criteria tools, this stuff isn't logged.

  • Script for copying or moving files from windows server to another remote windows server

    Copy below 2 line into notepad and save as movescript.vbs
    execute in command prompt
    c:\cscript movescript.vbs  (Press ENTER)
    Files will move to remote location.
    =========================================
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    objFSO.MoveFile "C:\scripts\*.txt","\\servername\c$\share"
    =========================================
    for copy files to remote location
    =========================================
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    objFSO.CopyFile "C:\scripts\*.txt","\\servername\c$\share"
    =========================================
    Lets us know if you face any error. reply back to me on [email protected]
    Thank you.....
    Regards Ravikiran MCITP

    What is your question?  Are you asking how to do this?  Can you post the errors?
    ¯\_(ツ)_/¯

  • Is consolidating library necessary if you have the "copy files to itunes media folder" box checked?

    Like the title, Since I've had iTunes I've always had the box checked for "copy files to itunes media folder"... if I want to backup my itunes folder now, do I still have to consolidate the library? I just copied it over without consolidating and it took like half an hour, so I'm just wondering if I should do it again after consolidating? I'm assuming it's fine. It seems to have transfered all 70G of my music.

    Sharing,
    What Consolidate does is look thru your iTunes library, and for any track that is not already in your iTunes Media Folder, it puts a copy there.
    If you have always had Copy checked, and have never moved your iTunes Media Folder, and have not manually put any files elsewhere, then you probably already have all your files in the iTunes Media Folder, and would not need to run Consolidate.  However, it would not hurt.

  • How can I prevent iTunes from copying files to C drive?

    I keep all my music files on my D drive. When I installed iTunes, I made sure that each song title in the library was linked to the mp3 on the D drive. Recently I found about 155 music files that are now duplicated in a folder on my C drive named "iTunes music" Most the file modification dates are either 9/11/2010 or 10/25/2010. I tried to think of any action I've taken that might have caused this. The only unusual thing I've done recently with iTunes is try out a new accessory called TuneUp. I've used it to find album art and find details about some songs that were missing, like what album the file came from etc. Is it possible that TuneUp is creating new modified versions of the music files rather than applying the updated data to the original files on the D drive?

    That sounds like a good guess.
    I know nothing about TuneUp or how it works, and I can't recall where iTunes keeps it's Artwork, but they may very well be related.
    Is your settings in iTunes for copying files/where they are stored correct? Perhaps installing the 3rd party application made a change to your settings.
    Try tracing back one of the files to your library and see if you can identify an action you took that created the files. For example... look at one of these suspect files and find it in the iTunes library. Sort your music by Date Added and see if you can find a correlation.

  • Copy file without retyping its name

    I`m just starting to use Java (in school) so I need help even with simple things like this: I have to copy file without retyping its name in destination. I`ve tried to use substring method for extracting filename, but it gives me an error "The method substring() is undefined for type Copy". Any help?
    import java.io.BufferedReader;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.InputStreamReader;
    public class Copy{
         * @param args
         public static void main(String[] args) {
              try {
                   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    //Entering the path to the file that I want to copy
                   System.out.println("Enter file path");
                   String filePath= br.readLine();
    //Entering the destination for copied file
                   System.out.println("Enter destination");
                   String destination = br.readLine();
                   FileInputStream fis = new FileInputStream(filePath);
                   FileOutputStream fos = new FileOutputStream(destination);
                   int c=0;
                   while((c=fis.read())!=-1){
                        fos.write(c);
                   fis.close();
                   fos.close();
              } catch (FileNotFoundException e) {
                   e.printStackTrace();
              } catch (IOException e) {
                   e.printStackTrace();
    }

    cereal_killer wrote:
    No. I expected this (String fileName = substring(filePath.lastIndexOf("/")+1, filePath.length());) to workYou didn't provide a string reference on which to execute substring. As in:
    String str = "blah blah blah";
    String fileName = str.substring(...);
    {code}If you just say *substring(start, end)* how is it supposed to know *which* String object to operate on?
    Without the someStringReference. preceding it, calling a method--in your case substring--is like calling it on this object, i.e., like this.substring. Your class does not define a substring method, so it's a compile time error to try to call that non-existent method.

  • Copying Files in Java

    How can I code in Java the copying of a file from one directory to another. I am trying to copy a Database from one folder to another and I do not want to use streams because this will read in characters or bytes but the Database is made up of tables. I thought there might be a method called 'copy' in the Java API, but I cannot find it anywhere.
    The closest I have got to the solution is the use of renameTo method in the Java API. However this copies the file but also removes it from the original location (like cut and paste). Is there a way of using a method similar to that so I get the file in both locations?
    Thanks in advance.

    Here's a utility class I wrote specifically for that purpose. It contains a method for copying files, and one for copying entire directories(including sub-directories).
    I use this mostly to move around mySql databases.
    http://www.auburn.edu/~bradfje/FileUtil.txt
    1. copyDirectory(String source, String destination)
    source is the directory to be copied, destination is what you want the new diretory to be called. Use absolute file names.
    2.copyFile(String source, String destination)
    same remarks as above.

  • Hyperion DIM (Data integn mgmt/Informatica) - Create Workflow to copy files

    Hello,
    I understand this is an ODI forum but I could not find a Oracle Hyperion DIM forum and so I thought some of you might know DIM. This should be easy for those who have Informatica experience.
    So we are using WinSCP for copying files from one folder to the other.
    Those who do not know what WINSCP is - it is a simple to tool used to conduct secure file transfer b/w local and remote desktop.
    We are doing this file copy from one folder to the other on a repeat basis and we would like to automate the workflow using DIM.
    Well, the task is that I basically log on to WinSCP by providing a hostname, username and password and from a specific folder I have to pick up a file and drop it into a different folder.
    I need to create a workflow to do this so that it may be automated. Can anybody suggest ideas on which tasks I may use within DIM and the general approach? This would be great help. Thanks.
    -- Adi

    Hello,
    I understand this is an ODI forum but I could not find a Oracle Hyperion DIM forum and so I thought some of you might know DIM. This should be easy for those who have Informatica experience.
    So we are using WinSCP for copying files from one folder to the other.
    Those who do not know what WINSCP is - it is a simple to tool used to conduct secure file transfer b/w local and remote desktop.
    We are doing this file copy from one folder to the other on a repeat basis and we would like to automate the workflow using DIM.
    Well, the task is that I basically log on to WinSCP by providing a hostname, username and password and from a specific folder I have to pick up a file and drop it into a different folder.
    I need to create a workflow to do this so that it may be automated. Can anybody suggest ideas on which tasks I may use within DIM and the general approach? This would be great help. Thanks.
    -- Adi

  • Copying files between Iphone and PC over 3G-connection?

    Hi,
    Is there any application for copying files between PC and Iphone using a 3G or Edge connection? I'm using Jaadu VNC client on my Iphone but it has no functions for file transfers (as far as I know).
    Thanks for any hints!

    No. I don't believe that would be allowed with the SDK. You could always email them to yourself.

  • My Time Capsule has stopped backing up.  I have an Apple Time Capsule which backs up by wireless. For the last 3 days it has not backed up. I get this message: "The backup was not performed because an error occurred while copying files to the backup disk.

    My Time Capsule has stopped backing up.
    I have an Apple Time Capsule which backs up by wireless. For the last 3 days it has not backed up. I get this message:
    "The backup was not performed because an error occurred while copying files to the backup disk."
    I have gone into Mac Help and followed this down to stage 4:
    under shared it lists my time capsule and my husband's iMac - both use the time machine but we have switched his off temporarily.  Clicking on my Time capsule I get "Connected" and "Sharepoint" - I didn't have to enter connect or password
    I don't understand stage 5: how and where do I select the disk or volume that contains Time Machine backups ?  How do I know which it is? My disk utility lists 160.04 TOSHIBA MK... with sub-heading Macintosh HD.  It also lists (with a "CD" icon) HL-DT-ST DVDRW GS22N
    Under stage 6, how and where do I Locate your backup ? I try dragging my Time capsule from Finder to the Disk Utility side panel but it won't go.  What is my computer's name?
    Please someone help!  I'm completely stumped.
    Thanks,
    Maggie
    Mac Help says:
    If you back up to a Time Capsule or network disk:
    Open the Time Machine pane of System Preferences, and slide the switch to Off.
    Open Time Machine preferences
    Open Disk Utility, which is in the Utilities folder in the Applications folder. 
    Open Disk Utility
    Make sure the Time Capsule or network disk is turned on and available. 
    Open a Finder window, select your Time Capsule or network disk in the Shared section of the sidebar, and click Connect. If necessary, enter your user name and password. 
    On the Time Capsule or network disk, select the disk or volume that contains Time Machine backups. Depending on how your Time Capsule is set up, there may be one or more disks or volumes. 
    Locate your backup, and drag it to the Disk Utility sidebar.You can identify your backup by looking for your computer’s name in the backup’s filename.

    Hello,
    Thanks to the great Pondini...
    http://pondini.org/TM/C3.html

  • Error 7 occurred at Copy in ABAPI Dist New VI Library.vi​- ABAPI Dist Chk for Destinatio​ns.vi- ABA​PI Copy Files and Apply Settings.v​i- EBEP_In​voke_Build​_Engine.vi​- EBUIP_Bu​ild_Invoke​.vi- EBUIP​_Build_Inv​oke.vi.Pro​xyCaller

    When I try to build executables in LabView 8.01 I get message:
    Error 7 occurred at Copy in ABAPI Dist New VI Library.vi->ABAPI Dist Chk for Destinations.vi->ABAPI Copy Files and Apply Settings.vi->EBEP_Invoke_Build_Engine.vi->EBUIP_Bu​ild_Invoke.vi->EBUIP_Build_Invoke.vi.ProxyCaller
    Best Regards

    I got the same error as I tried to build my application, the reason was the string I set for the 'Build specification name' property of my build.
    I changed from '3DC - Dlog Data Compacter ' to '3DC' and it worked afterwards..quite strange behaviour..

  • A script for copying certain files to a new location

    I have a folder with over 50,000 images in it. I need about 15,000 of them copied to another folder.
    Is there a script (that I can paste the list of the ones I need copied) to perform this action?
    Thanks in advance.

    perhof,
    After much googling, I was fortunate enough to find your beautiful script!
    I added a couple of things like subfolder recusion ( by tweaking scripts I found) .
    Would you be kind enough to look this over and see if it's ok or needs fixing?
    Thanks for any help,
    ec
    [code]
    ' Read a list of images from text file
    ' and copy those images from SourceFolder\SubFolders to TargetFolder
    ' Should files be overwriten if they already exist? TRUE or FALSE.
    Const blnOverwrite = TRUE
    Dim objFSO, objShell, WSHshell, objFolder, objFolderItem, strExt, strSubFolder
    Dim objFileList, strFileToCopy, strSourceFilePath, strTargetFilePath
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objShell = CreateObject("Shell.Application")
    Set WSHshell = CreateObject("WScript.Shell")
    Const ForReading = 1
    ' Make the script useable on anyone's desktop without typing in the path
    DeskTop = WSHShell.SpecialFolders("Desktop")
    strFileList = DeskTop & "\" & "images.txt"
    ' File Extension type
    strExt = InputBox("Please enter the File type" _
    & vbcrlf & "For Example: jpg or tif")
    If strExt="" Then
       WScript.Echo "Invalid Input, Script Canceled"
    Wscript.Quit
    End if
    ' Get the source path for the copy operation.
    Dim strSourceFolder
    Set objFolder = objShell.BrowseForFolder(0, "Select source folder", 0 )
    If objFolder Is Nothing Then Wscript.Quit
    Set objFolderItem = objFolder.Self
    strSourceFolder = objFolderItem.Path
    ' Get the target path for the copy operation.
    Dim strTargetFolder
    Set objFolder = objShell.BrowseForFolder(0, "Select target folder", 0 )
    If objFolder Is Nothing Then Wscript.Quit
    Set objFolderItem = objFolder.Self
    strTargetFolder = objFolderItem.Path
    Set objFileList = objFSO.OpenTextFile(strFileList, ForReading, False)
    On Error Resume Next
    Do Until objFileList.AtEndOfStream
        ' Read next line from file list and build filepaths
        strFileToCopy = objFileList.Readline & "." & strExt
        ' Check for files in SubFolders
        For Each strSubFolder in EnumFolder(strSourceFolder)
          For Each strFileToCopy in oFSO.GetFolder(strSubFolder).Files
        strSourceFilePath = objFSO.BuildPath(strSubFolder, strFileToCopy)
        strTargetFilePath = objFSO.BuildPath(strTargetFolder, strFileToCopy)
        ' Copy file to specified target folder.
        Err.Clear
        objFSO.CopyFile strSourceFilePath, strTargetFilePath, blnOverwrite
        If Err.Number = 0 Then
            ' File copied successfully
            iSuccess = iSuccess + 1
            If Instr(1, Wscript.Fullname, "cscript.exe", 1) > 0 Then
                ' Running cscript, output text to screen
                Wscript.Echo strFileToCopy & " copied successfully"
            End If
        Else
            ' Error copying file
            iFailure = iFailure + 1
            TextOut "Error " & Err.Number & _
            " (" & Err.Description & ")trying to copy " & strFileToCopy
        End If
       Next
    Next
    Loop
    strResults = strResults + 0 '& vbCrLf
    strResults = strResults & iSuccess & " files copied successfully." & vbCrLf
    strResults = strResults & iFailure & " files generated errors" & vbCrLf
    Wscript.Echo strResults
    Sub TextOut(strText)
        If Instr(1, Wscript.Fullname, "cscript.exe", 1) > 0 Then
            ' Running cscript, use direct output
            Wscript.Echo strText
        Else
            strResults = strResults & strText & vbCrLf
        End If
    End Sub
    Function EnumFolder(ByRef vFolder)
    Dim oFSO, oFolder, sFldr, oFldr
    Set oFSO = CreateObject("Scripting.FileSystemObject")
    If Not IsArray(vFolder) Then
    If Not oFSO.FolderExists(vFolder) Then Exit Function
    sFldr = vFolder
    ReDim vFolder(0)
    vFolder(0) = oFSO.GetFolder(sFldr).Path
    Else sFldr = vFolder(UBound(vFolder))
    End If
    Set oFolder = oFSO.GetFolder(sFldr)
    For Each oFldr in oFolder.Subfolders
    ReDim Preserve vFolder(UBound(vFolder) + 1)
    vFolder(UBound(vFolder)) = oFldr.Path
    EnumFolder vFolder
    Next
    EnumFolder = vFolder
    End Function
    [/code]

Maybe you are looking for

  • Duplication Check for Vendor Invoices

    Can we check for duplicate invoices in SAP Regards Satish

  • Problem with my floppy drive

    Today i tried to use my old floppy drive. I tried to format some floppies with Kfloppy but it says something like: Internal error: device not correctly defined. Ideas how to fix this?

  • Dumps in sap pi

    Hi Gurus, Can any body tell me that on what cases we will get Dumps in sap pi ,Can any body share me is there any documents related to dumps. It is very help ful for me . Thanks&Regards

  • 'System Error' when trying to save Form Manager Registry Settings

    Hi, trying to save changes made in the form manager registry settings [Home > Services > Adobe LiveCycle Form Manager > Registry Settings (http://localhost:8080/FormManagerAdmin/registry-cfg-load)], I get an error, which reads: > System Error > The r

  • Can anyone helpith this?

    I'm trying to get the program to return a decimal format what is the problem in this case? // Thomas Klooz // October 15, 2008 /** Class that manipulate class Dvd1   * to display an invenotry of Dvd,s by the user*/ import java.util.*; public class Dv