Name of the folder to be the name of the file

Hi all

The following script saves files, but if we have several files, the files are not saved.

#target photoshop

inputFolder = Folder.selectDialog ("Select a folder" * .tif "files");

var inputFolder = file (was: / work / in /');
var outputFolder = folder ([was: / work/out / ""]);

If (inputFolder! = null) {}
fileType = (' * .tif ');
List of files of the var = inputFolder.getFiles (fileType);
$.writeln (fileList); list of files


If (filelist. Length == 0)
{
Alert ('no file found in the folder', 'test', 'errorIcon')
}
on the other
{
for (var i = 0; i < fileList.length; i ++)
{
If (instanceof fileList [i] file & & .hidden fileList [i] == false)
{
var TiffOptions = new TiffSaveOptions()
TiffOptions.imageCompression = TIFFEncoding.TIFFLZW
TiffOptions.embedColorProfile = false

docRef var = open (fileList [i])
app.preferences.rulerUnits = Units.PICAS
docRef.flatten)
docRef.resizeImage (null, null, 600)
var Wid = docRef.width;
var Hig = docRef.height;
app.preferences.rulerUnits = Units.PICAS

If (Number (Wid) > 30)
{
docRef.resizeImage(29,null);
}
Another yew (Number (Hig) > 50)
{
docRef.resizeImage(null,50);
}
$.writeln (wid); WID
$.writeln (hig); HIG
var newName = removeExtension (inputFolder.name);
$.writeln (newName); Newname

for (a = 1; a < 12; a ++) {}


docRef.saveAs (new File(inputFolder+"/"+newName+'_f00'+a+".tif"), TiffOptions, true, Extension.LOWERCASE)

docRef.close (SaveOptions.DONOTSAVECHANGES)

}
var newcmd = fileList [i] .remove)
}
}
Alert ('completed process', 'test')
}
}

/********************************************************************/
removeExtension (myDoc) function
{
var str = myDoc.split (".tif");
var ext = str [0]
return ext;
}
/********************************************************************/

/********************************************************************/
removeExt (myDoc) function
{
var str = myDoc.split(".");
var ext = str [1]
return ext;
}
/********************************************************************/

/********************************************************************/
function removebit (myDoc)
{
var str = myDoc.split(".");
var ext = str [1]
return ext;
}
/********************************************************************/

Please help me solve this problem.

Look as if you have a loop for save 11 copies of the document, but you close the document, after the first recorded for the second record stops working because there is no open document to save.

#target photoshop

inputFolder = Folder.selectDialog ("Select a folder" * .tif "files");

var inputFolder = file (was: / work / in /');

var outputFolder = folder ([was: / work/out / ""]);

If (inputFolder! = null) {}

fileType = (' * .tif ');

List of files of the var = inputFolder.getFiles (fileType);

$.writeln (fileList); list of files

If (filelist. Length == 0)

{

Alert ('no file found in the folder', 'test', 'errorIcon')

}

on the other

{

for (var i = 0; i)< filelist.length;="">

{

If (instanceof fileList [i] file & .hidden fileList [i] == false)

{

var TiffOptions = new TiffSaveOptions()

TiffOptions.imageCompression = TIFFEncoding.TIFFLZW

TiffOptions.embedColorProfile = false

docRef var = open (fileList [i])

app.preferences.rulerUnits = Units.PICAS

docRef.flatten)

docRef.resizeImage (null, null, 600)

var Wid = docRef.width;

var Hig = docRef.height;

app.preferences.rulerUnits = Units.PICAS

If (Number (Wid) > 30)

{

docRef.resizeImage(29,null);

}

Another yew (Number (Hig) > 50)

{

docRef.resizeImage(null,50);

}

$.writeln (wid); WID

$.writeln (hig); HIG

var newName = removeExtension (inputFolder.name);

$.writeln (newName); Newname

for (a = 1;<12;>

var a = i + 1;

docRef.saveAs (new File(inputFolder+"/"+newName+'_f00'+a+".tif"), TiffOptions, true, Extension.LOWERCASE)

docRef.close (SaveOptions.DONOTSAVECHANGES)

//}

var newcmd = fileList [i] .remove)

}

}

Alert ('completed process', 'test')

}

}

/********************************************************************/

removeExtension (myDoc) function

{

var str = myDoc.split (".tif");

var ext = str [0]

return ext;

}

/********************************************************************/

/********************************************************************/

removeExt (myDoc) function

{

var str = myDoc.split(".");

var ext = str [1]

return ext;

}

/********************************************************************/

/********************************************************************/

function removebit (myDoc)

{

var str = myDoc.split(".");

var ext = str [1]

return ext;

}

/********************************************************************/

Tags: Photoshop

Similar Questions

  • I can't save the messages in the sent folder, there is a lock on the file name

    the messaging engine Thunderbird ceased to save emails in the sent folder, when I checked the sent folder, it was a symbol of lock at the beginning of the queue file. and an error came up saying "error copy sent the file.

    The padlock, which indicated it still, the account uses a secure connection.

    Now

    So that we can better investigate this problem, you need to add a little more non-personal information.

    Please add the troubleshooting information to your post
    To find troubleshooting information:

    • Open the help (or click Help three-line-icon and select)
    • Choose troubleshooting information
    • Use the copy button in the Clipboard to select them all. Do not check box "include account names!
    • Paste this into your post.

    Please also add the result of these troubleshooting steps to your message

    • Thunderbird works in mode Safe TB (see Thunderbird Safe Mode)?
    • Do you use anti-virus software and firewall? What is the version?
    • Who is the email provider?
    • Who is the provider of the internet?

    Please post back with that information and any other questions you may have.

  • where to save the files under options the file name is duplicated how to remove an additional folder with the same name

    Under Options in Firefox, I clicked on save the files under downloads, but the file name twice and an additional file with the same name is created in the folder, i.e.:

    G:\Akbar's Songs\HAMARA DOWNLOADS\HAMARA FORUMS DOWNLOADS FORUMS

    As you can see the file repeats, how can I fix it?

    Also the music files, I download from a site of downloads as a WinRar file and I need to open it. Y at - it an option where the file opens automatically in the folder I chose?

    Thanks a lot for your help.

    Hi Akush, when you install 7 - zip, make itself the default application to open .zip and .rar files. So if you double click on the .rar file, it should open in 7 - zip. If you prefer to decompress immediately, right click the file and look for new 7 - zip items in the menu. I can't think of a way to do this automatically, however.

  • Changed the name of a bookmark in a folder, now when I try to open the file, it tries to open every bookmark in the file.

    I have a folder of bookmarks in the toolbar. I changed the name of one of the bookmarks in that folder. The next time I tried to open the file, I had (and continue to receive) a message saying that I'm about to open 47 tabs, and this can slow down the firefox. I have only to open the file, not each bookmark in it and does not know how to get it by allowing me to do.

    That only happens if you click on this button to folder in the bookmarks toolbar, or you cannot open this folder in the sidebar (Ctrl + B) or the bookmarks menu as well?

  • Move the file in the folder of the same name in AppleScript

    I had a problem with the script below. Basically, on the execution of the script, I want to create folders based on the name of the file and move the files in the files of autocorrelation. However, at the minute, that I'll have to choose the folder in which the script should run.

    Folder to choose a folder

    say application 'Finder '.

    located fileList to the name of every file in Folder with name extension is "m4v".

    end say

    the value point text delimiters to ".".

    Repeat with dittos in list of files

    get each text element of dittos

    masterFile defined in the point 1 of the result

    say application 'Finder '.

    create a new folder to Folder with properties {name: masterFile}

    move (each file from the folder Folder whose name contains masterFile) will cause

    end say

    end Repeat

    Ideally, I would like it to run automatically, but the folder is on an external hard drive. (\Volumes\Lacie\Movies). and I had problems to use the POSIX and 'alias' to properly re-create the path of the file desired.

    Any help would be greatly appreciated. Thank you!

    Hello

    You can try something like the AppleScript script which is a simple shell script wrapper.

    set d to (choose folder)'s POSIX path
    do shell script "/bin/bash -s <<'EOF' - " & d's quoted form & " 2>&1
    cd \"$1\" || exit
    shopt -s nullglob
    for f in *.m4v
    do
        m=${f%.*}
        [[ -d $m ]] || mkdir -p \"$m\" || continue
        mq=$(sed 's/[^[:alnum:]]/\\\\&/g' <<< \"$m\")   # quote meta characters for regex
        find -E . -depth 1 -type f -iregex '.*/'\"$mq\"'.[[:alnum:]]+$' -print0 | xargs -0 -J% mv % \"$m\"
    done
    EOF"
    

    For example, given that you choose/path/to/directory in the folder - source

    Input state:

    /path/to/directory/abc.m4v
    /path/to/directory/abc.txt
    /path/to/directory/abcd.m4v
    /path/to/directory/abcd.txt
    

    Status of the output:

    /path/to/directory/abc/abc.m4v
    /path/to/directory/abc/abc.txt
    /path/to/directory/abcd/abcd.m4v
    /path/to/directory/abcd/abcd.txt
    

    Briefly tested under OS X 10.6.8 but no guarantee of any kind. Please make sure that you have a full backup of the original files and directories before you run this kind of script.

    Good luck

    H

  • Find recently updated files in the folder or any name of a file in a folder

    Hello, I am looking for a quick way find the most recently updated file name, name of GOLD really a single file in a network folder.  My file has a lot of files inside, so I prefer not to use loops, etc..

    My confusion begins here: I can use wildcards for some commands to get information about files, such as:

    FileExist ("directory &" *.) TDM')

    FileDateGet ("directory &" *.) TDM","fdModify")

    I want to really just a file name in the folder so that I can use DataFileHeaderAccess.  The file most recently updated would be best, but I'm flexible.

    Hi Julia,

    By chance this record is declared as a search box?  If so, you can use a programmatic DataFinder query to return the most recently updated data file.

    Otherwise, I would use the filesystemobject in VBScript.  I can't seem to get the Item property for the collection of files (CF) to work, but it's easy enough leave the complete loop after the first inning thanks to:

    Directory = "C:\". »

    Set fso = CreateObject ("Scripting.FileSystemObject")

    The value of f = fso. GetFolder (Directory)

    The value fc = f.Files

    FOR each file in the CF

    MSG = Msg & file. Path & + "\n"

    Output FOR

    NEXT

    MsgBox Msg

    In addition, he really should not take long for the loop to find the latest file, even if you have a lot of them in this folder:

    Directory = "C:\". »

    Set fso = CreateObject ("Scripting.FileSystemObject")

    The value of f = fso. GetFolder (Directory)

    The value fc = f.Files

    FOR each file in the CF

    ModifyDate = file. DateLastModified

    IF MostRecentDate< modifydate="">

    ModifyDate = MostRecentDate

    FilePath = file. Path

    END IF

    NEXT

    MsgBox FilePath & + "\n" & MostRecentDate

    Bad Turpin

    Product Support Engineer
    National Instruments

  • "[------\\[Computer name] [name of the file or folder] is not accessible." You might not have permission to use this network resource.

    I have a home network with four computers. I have some folders and files we want to share. I haveselected these folders and files in each computer and right click top of opening and then the sharing and Security tab and check share this folder on the network, and then clicking apply and OK. [However, when I try to access these files or folders from another computer on the network I get the name of \\[Computer]------[file or folder name] is not accessible. You might not have permission to use this network resource. Contact the administrator of this server to find out if you have access permisions. Not enough server storage is available to process this command. Increased the value of the IRPStackSize following another Microsoft kb but stil get the same message.

    How can I fix this problem so that we can share these files and folders between my wife, children and myself.

    OS Win XP Pro SP3 with all its current updates on all computers.

    Any help and asisitance will be greatly appreciated

    Sadnewbie

    Hello

    Perform the steps from the link below and see if it helps.

    Error message when you try to access a network Windows XP computer: "you might not have permission to use this network resource".

    Important:  This section, method, or task contains steps that tell you how to modify the registry. However, serious problems can occur if you modify the registry incorrectly. Therefore, make sure that you proceed with caution. For added protection, back up the registry before you edit it. Then you can restore the registry if a problem occurs.

    For more information about how to back up and restore the registry, click on the number below to view the article in the Microsoft Knowledge Base:

    322756 (http://support.microsoft.com/kb/322756/)

    Hope this information helps.

  • Renaming of documents by adding an annex of the commune for the names of existing files on several files in a single folder

    Is it possible to add an annex to the town (for example "-file BL ') existing file name (for example"daily reports1) to several (selected) files in the same folder?  (The example given could therefore be renamed "daily reports - comes from the BL file").  I need to do this to identify the source of documents folder when they are copied into a common folder: to compare with the similar files in other folders for various purposes.  There are a lot of documents in many files, I need to transfer and compare.  A rough estimate, it is that I need to add an annex to the town of 200 files named differently in a single folder and repeat this process for 30 files: with my existing knowledge of XP, this means that I would have use the rename individually on 6000 documents, and if the additional annex has been say 5 characters which would be a minimum of 30 000 key strokes : If adding appendages common to several document names selected in a folder is possible, this might reduce the name change to close to 150 list.

    PLEASE NOTE the multiple rename function where each selected file is the same thing with a renamed after the index number in brackets should not be - the original file name should be kept.

    Hello

    Refer to the link below and check if this may help:http://social.msdn.microsoft.com/Forums/en-US/sqlintegrationservices/thread/1b0deaf4-8416-4e03-aa9c-e3ce1259866b

    With regard to:

    Samhrutha G S - Microsoft technical support.

    Visit our Microsoft answers feedback Forum and let us know what you think.

  • Error message: "the file names would be too long for the destination folder.

    I move the files from internal hard drive to external hard drive using cut and paste.  I get a message "the file name would be too long for the destination folder.  You can shorten the file name and try again, or try a location with a shorter path. "I then gives me choices to skip or cancel.  What happens to files that are ignored?  Are they deleted?  I don't want to lose all the data, but there are more 2 000 files with this problem, so passing by and rename each one really isn't a viable solution.  I don't really understand how the file names were originally created/saved about a problem that is only now that I want to move them.  The disc source and destination are NTFS.  Is there a solution for this?  It is imperative that no data is lost.  Thanks for any help you can offer.

    On Wednesday, 10 April 2013, 12:16:23 + 0000, MADinIowa wrote:

    I move the files from internal hard drive to external hard drive using cut and paste.  I get a message "the file name would be too long for the destination folder.  You can shorten the file name and try again, or try a location with a shorter path. "I then gives me choices to skip or cancel.  What happens to files that are ignored?  Are they deleted?

    N ° to check that what I say is correct, create a new folder
    for the purposes of the trial and to make a copy of some files. To ensure that
    one of them has a long name (rename if necessary), and then try to copy
    These files on the external drive. When you get the message, choose
    'jump' and see what happens.

  • The files 'disappear' when you add a period to a folder or a file name in windows through GUI

    The files 'disappear' when you add a period to a folder or a file name in windows through GUI

    I don't know if it's a bug, but certainly doesn't seem like it should be the case. I tried on both 64-bit and 32-bit on windows 7. Does not make this error on XP or vista.

    Can someone explain to me what is happening?

    To reproduce, in windows 7 make a file or folder, and THEN add a ".". (period) to the end of the name of the file and look at the file "disappear". It's still there, just need to refresh (F5) and it reappears (w/o of the annex "." because it's an illegal file naming convention).

    I tried to do the same thing but through command line and it always auto corrects names of files to the conventions, and correctly, it remains on the GUI, so I think that the problem is related to the graphical mode of name change

    -Favre a. Reid

    Hello

    This seems to be a bug with Windows 7. We really thank you for this bug in our opinion. This will be the team of developers. Thanking you once again.

    Concerning
    Anthony.

  • How can I correct the spelling of the name of the file (or folder)?

    I use Win 7. Accidentally, I mistyped a word of a folder title. I wrote the word with lower case rather than capitalize it. When I right click on the folder name and correct my bad typing the folder name becomes the word is spelled with lower case. Similar things are producing with the file names. In previous versions on Windows, change or correct a folder/file name was a wink. How can I do this in Windows 7? Thanks in advance for any help.

    You actually change the name. What you see is the original buffer that has not been marked "dirty" by the change in the case. If you press F5 , you can force a refresh and the revised spelling should show.

    BTW, tapping F2 initiates an editing session to rename all as right, click Rename or gently second by clicking on a selection.

  • What is the name of the font used by Windows 7 when it lists the files etc in a folder?

    I want to change a text Notepad to the same font that is used by Windows 7 when it lists the files in a folder... What is the name of the font?

    Hello

    Windows use Tahoma as default font in Windows Explorer. You can try to use the Tahoma font and check if you like that.
     
    I hope this helps.
     

    Thank you, and in what concerns:
    Shekhar S - Microsoft technical support.

    Visit our Microsoft answers feedback Forum and let us know what you think.
    If this post can help solve your problem, please click the 'Mark as answer' or 'Useful' at the top of this message. Marking a post as answer, or relatively useful, you help others find the answer more quickly.

  • Rename a folder with the character question mark (?) in the name of the file?

    The name of the folder in question has a format of "file name? This folder is on my external hard drive and was created when I've used OSX, which had the support of the character question mark (?). However, while trying to access the contents of the folder in Windows, I am welcomed with the error Although the file is inaccessible due to incorrect syntax. Whenever I try to move or rename it, I get the same error of incorrect filename syntax.

    Is it possible to rename this folder so I can access it? Thank you.

    Thanks for your replies. I don't have OSX, so I couldn't go that route. I found myself using Ubuntu to tide me over.

  • How can I select the files in a folder with the help of a list with the files you want and after that rename only the files using another list with desired new names?

    How can I select the files in a folder with the help of a list with the files you want and after that rename only the files using another list with desired new names?

    I have only:
    D: / images (where are necessary + not need files)
    -a list with only the necessary files
    -a list with new names for the files needed
    Thank you.

    Hi Pustiu,

    Thanks for posting in the Microsoft Community.

    You want to know how to select the files in a folder using a list with the files you want and after that rename only the files using another list with desired new names.

    I would have you post your query in the TechNet forums because it caters to an audience of it professionals.

    Your query will be better addressed there.

    Check out the link-

    http://social.technet.Microsoft.com/forums/en-us/w7itprogeneral/threads

    We know if you need help. We will be happy to help you. We, at tender Microsoft to excellence.

    Thank you.

  • Installation of Windows 8, error: change the folder or the file C:\Users on drive c. name and change the folder or filename to C:\ProgramData on drive C.

    Try to install windows 8 on a PC that is currently running Window XP.  It starts the installation but asks me to change the folder or the file C:\Users on C drive name. The second instruction is to change the folder or filename to C:\ProgramData on drive C.   Don't know what to do?  Thank you!

    OT:

    Problem installing Windows 8

    Hello

    Before starting the installation, you run these controls?

    Check if the manufacturer of your computer/laptop has Windows 8/8.1 drivers available for your model.

    If this is not available, Windows 8/8.1 not install and work properly for you.

    There is a lot of information in this first link from Microsoft:

    http://Windows.Microsoft.com/en-us/Windows-8/upgrade-to-Windows-8

    "8.1 for Windows system requirements.

    http://Windows.Microsoft.com/en-us/Windows-8/system-requirements

    See you soon.

  • ColdFusion CFFTP copy of the file from the remote server and save to a local folder with the same file name

    Is it possible to copy a file from a remote ftp server to a local folder, while retaining the original file name? Please note: the file name on the remote server is not always the same.

    This article from Adobe might be useful.  (I was tempted to use LMGTFY; but I do not have).

    V/r,

    ^_^

Maybe you are looking for

  • Is it OK to leave mini netbook connected to AC?

    The user guide says "avoid leaving comp. plugged and off for more than a few hours. Keep a fully charged battery can damage the battery. I thought that the lithium batteries cannot be overloaded.

  • HP Pavilion 15-n278sa Downgrade

    Hello I have a hp pavilion model 15 number n278sa HP pavilion 15-n278sa I have windows 8.1 pro, but I prefer to install windows 7. I updated my bios and booted from a USB windows 7 that works. I went through the first step of the installation where w

  • Can't do system restore to restore at all. What should I do to fix this?

    I need help to get the system restore to work. It restores not to any restore point. How can I fix it?

  • BlackBerry 10 covers the update of 10.2.1.2977

    Hello I have some questions and concerns about making my first software update. I have a blackberry z10 accompanying 10.2.1 out of the box and yesterday I received an update notification to 10.2.1.2977.So I went along to do OTA but it says that I hav

  • Optical Mouse 2.0 not working in win8 after update

    I have a Microsoft Wireless Optical Mouse 2.0, I was so happy in Windows 8, after I found the mouse in my attic and I decided to call it my Gaming Mouse, but the last time that I've updated Windows 8 when I try to connect it says it dosent it rechoni