Set label colour to files in loop.

This Script works in part to open a folder select the image to create a text document of the files, at the same time I would like to label them as red.
set myFile to (Macintosh HD:Users:Matt:Desktop:
SelectedImages.txt")
open for access file myFile with write permission
set eof file myFile to 0
set resultFiles to (choose file with prompt "Choose Files" with multiple selections allowed)
set tc to (count resultFiles)
repeat with i from 1 to tc
  set theNfile to (item i of resultFiles) & return
  write ((theNfile as list) as text) to file myFile
  log theNfile
  tell application "Finder"
  set label index of file (theNfile as text) to 2 --red
  end tell
end repeat
close access file myFile
My end result is this
Result:
error "Finder got an error: Can’t set file \"Macintosh HD:Users:User:Desktop:Bits and bobs:DP GOOD:Untitled1.psd
\" to 2." number -10006 from file "Macintosh HD:Users:User:Desktop:Bits and bobs:DP GOOD:Untitled1.psd
yet run the line below on its own and it has no problems?
tell application "Finder" to  set label index of file "StudioA:Users:StudioA:Desktop:Bits and bobs:DP GOOD:Untitled1.psd" to 2

Hello
Error -4960 is a generic error that tells little about what is wrong.
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/Headers/MacErrors.h:  coreFoundationUnknownErr      = -4960
Fortunately I can reproduce this error when I pass HFS path instead of POSIX path to the write_to_file() handler. So I guess you're doing it as well by replacing:
my write_to_file("", myFile's POSIX path, {_append:false, _class:«class utf8»})
with:
my write_to_file("", myFile, {_append:false, _class:«class utf8»})
when myFile is HFS path.
If myFile is HFS path and the file at the path already exists, you may call the handler like this:
my write_to_file("", (myFile as alias)'s POSIX path, {_append:false, _class:«class utf8»})
If myFile does not exist yet, the above won't work because (myFile as alias) fails. In such case, you'd need to build myFile as POSIX path from the beginning.
Having that said, here's a revised handler that seems to work with both HFS path and POSIX path under 10.6.8 although it does NOT conform to the definition of "open for access" and "close access" commands in OSAX dictionary. I do not like this sort of loose coding in undocumented way, but if it works for you and you're fine with the looseness, you may use it with due caution.
on write_to_file(x, p, {_append:_append, _class:_class})
        anything x : anything to be written to output file
        string p : POSIX path or HFS path of output file
        boolean _append: true to append data, false to replace data
        type class _class: type class as which the data is written
    local fd
    try
        set fd to open for access (p) with write permission
        if not _append then set eof fd to 0
        write x as _class to fd starting at eof
        close access fd
    on error errs number errn
        try
            close access (p)
        end try
        error "write_to_file(): " & errs number errn
    end try
end write_to_file
Good luck,
H

Similar Messages

  • Label Colours.

    Despite using the usual adjustments (Universal access etc) I find my pre-set label colours are not sufficiently distinct; indeed, they are decidedly washed out in appearance. Would anyone know of a way to adjust them (my first thoughts are via the colour palette)?

    Hello Barry.
    Followed your route to reached the colour palette I first thought may solve the problem but sadly, it doesn't. Transferring the colours from the palette to the folders in my finder just does not work. They skip off into the wide blue yonder !! When I originally mentioned pre-set label colours I had in mind replacing most of the 7 basic colours in Finder > preferences > labels with more positive shades. Did I fail to communicate this? If not and you could go a touch further and set out a step by step route you will surely isolate where I've gone astray. I have to say, VK seemed pretty positive and I've rarely found him wrong yet, but on the other hand you have often solved my problems.
    Guess I'll have to wait and see what develops.

  • Is there a PS setting where it can read my Canon Mark 3 5D's monochrome setting so that the files will also appear in monochrome instead of colour? Or do I have to change from RAW each time to Monochrome within PS (even if I have set up for Monochrome in

    Is there a PS setting where it can read my Canon Mark 3 5D's monochrome setting so that the files will also appear in the same monochrome structure (instead of appearing in colour as it is now when i open in PS, not even monochrome)? Or do I have to change from RAW each time to Monochrome within PS (even if I have set up for Monochrome in my 5D)?
    1. Basically I am taking photos with a monochrome setting with my 5D and the screen shows monochrome.
    2. when i import this onto my computer and open with PS, it opens in colour.
    3. when I change this to Monochrome in PS. (It cannot read my monochrome setting with my preference of the greyscale mix when I viewed it on my 5D)
    4. my question is: is there a way so that PS can read the monochrome setting from my 5D and display the same monochrome setting as my 5D instead of a different one from PS.
    Lily

    you need camera raw 6.7 or better.
    i don't know what version of ps you have so i can't say if it can be updated to use that, but update anyway.
    pre cc updates:  http://www.adobe.com/downloads/updates/
    cc updates:  http://prodesigntools.com/adobe-cc-updates-direct-links-windows.html
    cc 2104 updates:  http://prodesigntools.com/adobe-cc-2014-updates-links-windows.html
    if you can't update your cr sufficiently, use the dng converter. DNG Converters:
    Win
    Mac

  • Why can I not assign colour labels to some files

    When I try to assign a colour label to some files or folders, even icons, sometime it works, sometimes it doesn't.  I've tried from the contextual menu, from Get Info, from File > Label.  Sometimes, one method may work but it's puzzling when none works.  Why is this anyway. I never had this problem before ML.
    Colour me frustrated...

    I've been so used to working seamlessly from external drives (I had a MBPro 2.2, 120GB drive, tip-toeing around in Lion), that it never occured to me that it would be different in ML on my new Mac Mini.  So, yes, after further investigation, the problem seems to only occur on the ONE external drive which I used all the time for all my video files, photos, music and any other large folders. (I plan to migrate most of it to my main drive now that i have 1GB to play with, so it's a temporary hiccup at least.)  This probably also explains why I have to "authorize" any move or transformation on that drive, but WHY?  It doesn't happen on other drives and I even tried changing permissions to Read and Write for Everyone, to no avail.  Perhaps it's still tied in to the MacBook somehow, but then so would be the other drives.  ???
    Anyway, thank you for your time and for making me delve into this further.  At least now I know it doesn't affect the main system.

  • Applescript watched folder using label colour as trigger

    Hi can anyone with good applescript knowledge please let me know if this can be done?
    I have Folder A and Folder B
    I want only items in Folder A that are "Labeled Blue" to be Moved and compressed into Folder B (on the same drive).
    Applying the label command and colouring "Blue" would be the trigger.
    Any help in how to do this would be very welcome, thanks in advance.

    Many thanks for your feedback.
    In order to compress the moved files, the script might be modified as follows:
    set A to POSIX file "/Users/pierre/Desktop/A"
    set B to POSIX file "/Users/pierre/Desktop/B"
    tell application "Finder"
        activate
        move (items of folder A whose label index is 4) to folder B
        reveal result
    end tell
    tell application "System Events" to tell process "Finder"
        click (menu item 1 of menu 1 of menu bar item "File" of menu bar 1 whose name begins with "Compress")
    end tell
    Since the last part of the above script uses GUI Scripting, you must enable the Accessibility Frameworks by clicking the checkbox labeled "Enable access for assistive devices" in the Universal Access System Preference pane.

  • Writing large xmltype data to UTL_FILE and setting max row per file

    Hey Gurus,
    I am trying to create a procedure (in Oracle 9i) that writes out xml data I have created into several xml files (file would probably be to large for one xml file output...I am doing this for 270,000 rows of data), setting the max rows to 1000 rows per file. I know one would have to create a looping contsruct to do this but I am just not adept enough in PL/SQL to figure it out at the moment.
    So essentially their would be some sort of loop construct and substr process that creates a file after looping through 1000 rows and then continues the count and creates a another file until all 270 xml files are created. Simple enough right...lol? Well I've tried doing this and haven't gotten anywhere. My pl/sql coding skills are too elementary I am guessing. I've only been doing this for about three months and could use the assistance of a more experienced person here.
    Here are the particulars...
    This is the xmltype view code that I used to create the xml data.
    select XMLELEMENT("macess_exp_import_export_file",
    XMLELEMENT("file_header",
    XMLELEMENT("file_information")),
    XMLELEMENT("items",
    XMLELEMENT("documents",
    (SELECT XMLAGG(XMLELEMENT("document",
    XMLELEMENT("external_reference"),
    XMLELEMENT("processing_instructions",
    XMLELEMENT("update", name)),
    XMLELEMENT("filing_instructions",
    XMLELEMENT("folder_ids",
    XMLELEMENT("folder",
    XMLATTRIBUTES(folder_id AS "id", folder_type_id AS "folder_type_id")))),
    XMLELEMENT("document_header",
    XMLELEMENT("document_type",
    XMLATTRIBUTES(document_type AS "id")),
    XMLELEMENT("document_id", document_id),
    XMLELEMENT("document_description", document_description),
    XMLELEMENT("document_date",
    XMLATTRIBUTES(name AS "name"), document_date),
    XMLELEMENT("document_properties")),
    XMLELEMENT("document_data",
    XMLELEMENT("internal_file",
    XMLELEMENT("document_file_path", document_file_path),
    XMLELEMENT("document_extension", document_extension)
    ))))from macess_import_base WHERE rownum < 270000))))AS result
    from macess_import_base WHERE rownum < 270000;
    This is the Macess_Import_Base table that I am creating xml data from
    create table MACESS_IMPORT_BASE
    MACESS_EXP_IMPORT_EXPORT_FILE VARCHAR2(100),
    FILE_HEADER VARCHAR2(20),
    ITEMS VARCHAR2(20),
    DOCUMENTS VARCHAR2(20),
    DOCUMENT VARCHAR2(20),
    EXTERNAL_REFERENCE VARCHAR2(20),
    PROCESSING_INSTRUCTIONS VARCHAR2(20),
    PATENT VARCHAR2(20),
    FILING_INSTRUCTIONS VARCHAR2(20),
    FOLDER_IDS VARCHAR2(20),
    FOLDER_ID VARCHAR2(20),
    FOLDER_TYPE_ID NUMBER(20),
    DOCUMENT_HEADER VARCHAR2(20),
    DOCUMENT_PROPERTIES VARCHAR2(20),
    DOCUMENT_DATA VARCHAR2(20),
    INTERNAL_FILE VARCHAR2(20),
    NAME VARCHAR2(20),
    DOCUMENT_TYPE VARCHAR2(40),
    DOCUMENT_ID VARCHAR2(64),
    DOCUMENT_DESCRIPTION VARCHAR2(200),
    DOCUMENT_DATE VARCHAR2(100),
    DOCUMENT_FILE_PATH VARCHAR2(200),
    DOCUMENT_EXTENSION VARCHAR2(200)
    Directory name to write output to "DIR_PATH"
    DIRECTORY PATH is "\app\cdg\cov"
    Regards,
    Chris

    I also would like to use UTL_FILE to achieve this functionality in the procedure.

  • Setting the colour of the search box text on a public website

    I am using the search box snippet in the header of my public website.
    The background of the header is a dark blue.  The search box background is transparent so the default colour of the text (#444) on the dark blue background is barely visible.
    The text colour appears to be set by the following entry in corev15.css:
    input[type=password],
    input[type=text],
    input[type=file],
    select,
    textarea,
    .sp-peoplepicker-topLevel,
    .sp-peoplepicker-topLevelDisabled,
    .sp-peoplepicker-autoFillContainer,
    .ms-inputBox
    border:1px solid #B0B0B0;
    background-color:#fff;
    background-color:rgba(255, 255, 255, 0.85);
    color:#FFFFFF;
    I changed the colour from #444 to #FFFFFF.
    Now I want to create a new post in the Blog.  The new post's Title and Body fields use the same entry in corev15.css to set the colour of the text.  As the background of the new post is white the text is invisible!
    Using the F12 development function in IE, setting the colour of the Search box text with an inline function works, but when I add style="color:white" to the <input> of the Search box snippet it seems to be ignored.
    What am I doing wrong?  Is there another way around the problem (I don't want to change the background colour of the header nor the background of the post page and there is no colour that will display the text well enough against both backgrounds).
    Your help would be much appreciated.
    Thanking you in anticipation.
    Roger
    rogerwithnell

    Thanks for your help, Patrick.
    Adding color: white !important; inline in the <input tag of the Search box snippet is still ignored, however.  When I look at the HTML and CSS with F12 in IE, the inline mark-up is not set.  I guess this something to do with how the Search Box
    snippet works?
    I've made some progress, though.  All the pages of the site (except the Blog NewPost page) use the corev15.css file. So I've set the colour here to white.  The css entry is:
    input[type=password],
    input[type=text],
    input[type=file],
    select,
    textarea,
    .sp-peoplepicker-topLevel,
    .sp-peoplepicker-topLevelDisabled,
    .sp-peoplepicker-autoFillContainer,
    .ms-inputBox
    border:1px solid #B0B0B0;
    background-color:#fff;
    background-color:rgba(255, 255, 255, 0.85);
    color:#FFFFFF;
    The Blog NewPost page uses \_catalog\theme\themed\CDD8DBA6/COREV15-51C31438.themedcss. I've changed the same CSS entry as follows:
    input[type=password],
    input[type=text],
    input[type=file],
    select,
    textarea,
    .sp-peoplepicker-topLevel,
    .sp-peoplepicker-topLevelDisabled,
    .sp-peoplepicker-autoFillContainer,
    .ms-inputBox
    border:1px solid #B0B0B0;
    background-color:#fff;
    background-color:rgba(255, 255, 255, 0.85);
    color:#444 !important;
    Now this page sets the colour to #444.  This means that the text in the Title and Body fields is visible but the text in the Search Box (with its dark blue background) is not.
    The Search Box on Blog NewPost is not vital but I'd like to fix it.  How can I do this?
    Roger
    rogerwithnell

  • Applescript to read text file & set color of matching files in a folder

    I am keen to find a way to process a file I have been given for a string and to check if that string exists as part of a filename in a folder on my disk.
    If the string in the file list corresponds to the file name in the folder then I want to color the corresponding file red.
    Can anyone suggest a way to do this?

    'I am keen to find a way to process a file I have been given for a string; - ? Is this to translate to - you have a file, containing multiple file names? And if so, are each file names on a separate line?
    My above questions are derived from the statement portion of - 'If the string in the file list corresponds to the file name ...'.
    Assuming such, here is some starter code:
    property tFolder : (((path to desktop folder from user domain) as string) & "untitled folder 2:") -- Provided folder path.
    on run -- Notify user to drag a file onto the applet.
    display dialog "Drag file onto applet, for further processing." default button "OK"
    end run
    on open dItems -- Obtain a list of dragged-on items.
    repeat with i in dItems -- Cycle through individual items
    set fList to paragraphs of (read i)
    repeat with j in fList
    with timeout of 0 seconds -- Extend default timetout to infinity.
    tell application "Finder" -- Activate 'Finder' for processing of desired folders' contents.
    try -- Capture any unwanted AppleScript errors.
    -- Obtain a list of all files with the name stored in 'fName'.
    set tFiles to (every file of entire contents of folder tFolder whose displayed name contains j)
    -- or, use the line of code below (in place of the line of code above), if the complete file name, including file extension, is within the dragged file.
    -- set tFiles to (every file of entire contents of folder tFolder whose displayed name is fName)
    if ((count tFiles) > 0) then -- If one or file exists, proess the file(s).
    repeat with k in tFiles -- Cycle through the list of located files.
    set (label index of k) to 2 -- Set the 'label index' of located file to 'red'.
    end repeat
    end if
    end try
    end tell
    end timeout
    end repeat
    end repeat
    end open
    Save the above code as an application.

  • Applying labels to multiple files

    How can I apply a label to multiple files through the visual interface? In other words, I want to select 3 files at once and then select the label option.  I know I can click on the add button for the apply label dialogue but this can be very tedious if you are dealing with a large set of files.  there has to be a way to do this right?
    Thanks in advance . .

    Let's see if I can describe this clearly.  If I don't, do not hesitate to ask for clarification:
    We have a parent folder Main that has production code.  When  a developer needs to work on a new project, he or she will branch a section of code to development folder and start working on it (if the same code files are there, there is no need to branch).  to make sure we have a rollback option (in case things go wrong), the developer should be able to select a group of files and label them as labelproj1 old before he or she starts development.  The way we do do development here is we have a rollback versions (we are still using VSS) based on previous pinnings if the project gets rolled back for whatever reason.
    Selecting a group of files means we are only concerned with the files we modify.  We don't want to select the code at the folder level because we are not modifying those files.  We only concern ourselves with the files we modify for audit purposes.
    does this clarify what I am looking for or do you need more clarification? Let me know and I wll be happy to clarify.

  • Unable to set label in finder

    I've noticed when playing with setting labels, there are certain files where the option to set a label is greyed out.. I was wondering if this is normal, or something odd? Is there a fix or what can I do so I have access to working with my computer.. I am the admin on here, and the only one using this computer.

    Have you tried to right click on the Google Drive you want to remove and select Remove from Sidebar? If that doesn't work, try left click and hold and drag it off the Sidebar.

  • Why can't I set label color? I have write permission.

    I can't set label color on a particular file, or rename the file, or duplicate the file.
    Why not?
    I'm in an Admin account.
    Get File Info shows that the file is not locked.
    Get File Info shows that the file is readable and writeable by my account, by staff, and by everyone.
    In Terminal, "ls -l" agrees, showing that the file is readable and writable by user, group, and other.
    I have write permission to the containing folder.
    Disk Utility's Repair Disk Permissions didn't change the permissions.
    What else can I try?

    Might try BatchMod, it's much better/easier than the Finder for recursive Permission changes, but careful, it's powerful...
    http://www.lagentesoft.com/batchmod/index.html
    Once open, drop that folder on it's icon, change rights, Apply to all within.

  • Illustrator won't run: "unable to set maximum number of files to be opened"

    I have an intel macbook pro (core duo with 2GB ram) and a copy of purchased adobe creative suite 2. Other applications in the suite like photoshop, acrobat, etc can run on my mac without any problem. But when I try to run illustrator, it just shows an error message "Unable to set maximum number of files to be opened" and quits. I also installed a trial version of illustrator cs3 and got the same problem. Can anyone help? Thanks.
    CC

    Hi, I realize this is an old thread but it was unanswered and the issue has come up again in a newer thread:
    http://forums.adobe.com/message/2534652
    If the original poster sees this, can you reply tin the new thread and let us know if you were ever to solve this problem?
    Thanks!

  • Open Another Project - how do I set up the published files?

    I created a Menu project that launches (via buttons) two other projects. Each of these other projects has a button to return to the Menu. I copied the published set of files to each of the Callees folders. So, Menu\Callees has Run 1 and Run 2 folders (all the published files) Run 1 and Run 2\Callees each have Menu folder with all the published files. Menu launches Run 1 and Run 2 fine but the Menu button on Run 1 and 2 works once, then I get this:
    No webpage was found for the web address:file:///C:/Users/Jeff/Documents/My%20Adobe%20Captivate%20Projects/menu%20test/Menu/callees /Run_1/callees/Menu/callees/Run_1/callees/Menu/index.html
    Anyone have a simple explanation for how I should be setting up the published files?
    Thanks so much,
    Jeff

    Thanks Rob,
    Would running these from a web server resolve the file location problem I asked about? I tested the SWF version on my HD and got a similar error message (this time looking in the root directory, not the callees folder.) Can you point me to a reference re: how to set up files when running another project?
    Thanks,
    Jeff

  • Open data set for reading excel file on application server in back ground

    open data set for reading excel file on application server in back ground

    hi Vijay,
    I am afraid you won't be able to read from Excel file on Appl. Server.
    ec

  • In Adobe Acrobat Pro XI, is there a way to set defaults when combining files?

    My specific problem;  When I combine files, Adobe creates the bookmarks (which is desirable).  These bookmarks however, always seem to default on "page width" view.  I would prefer to have the bookmarks set to "fit page".  It is very cumbersome to edit each bookmark to reset the view.  (this is another issue which should be addressed as well).
    My preferences already are set to view the files in fit page, single page, however this setting does not seem to transfer to the combined file.
    Is there a way to globally set the preferences for this?  Even the settings during the combining function do not give options for the page view settings.

    There isn't a way to set this during the Combine process but it's easy to change all the bookmarks in one go using the following technique:
    Open the bookmark navigation pane and select all the bookmarks (be sure to expand all subbookmarks).
    Right-click and choose Properties from the context-sensitive menu.
    Click the Actions tab and choose Execute a menu item from the dropdown.
    Click the Add button and choose View > Zoom > Zoom to Page Level and click OK.

Maybe you are looking for

  • ITunes 10.1 Launching Problem

    I tried launching iTunes 10.1 today and the indicator comes on for 5 seconds and it shuts down. I tried to launch it in safe mode but it still won't launch. I uninstalled using Appcleaner to make sure the .plst files have been deleted as well. I just

  • Black band on screen G570

    I have a lenova G570 and recently a black line appeared from top to bottom of my screen. It has gradually got wider and when looking at it up close there are thin short black horizontal lines. Can someone tell me what this is and how to cure it.

  • Cannot open numbers app after it crashed

    Went to open numbers app before & specified icloud files - Got spinning wheel of death - After awhile did force close on app to shut off machine but now cant open numbers at all on my laptop.  i am on the latest release on everything.   Must I delete

  • Photo Sharing on iPad

    Hi, I am using Music and Video Sharing on iPad from our iMac iTunes Library. Is it possible to do same for Photos ... without copying the photos on the iPad? Thanks. Regards. Pierre

  • Creating writeable forms from documents

    How do I create a writeable form from a pdf or word file.