Can't change creator type with AppleScript

I'm trying to change the file type and creator type of some files using AppleScript. I've found many examples telling me how to do it. My problem is, that no matter what I try, the creator type does not change. Yes, I can change the file type, but using the same syntax for the creator type fails to make any change. There is no error; rather, the creator type simply remains what it was before.
I'm doing this on 10.6.8, but I also tried it on 10.8.4 and had the same issue.
Here's an example script:
After executing on a single file (for example), the alerts show that the file type has been changed, but the creator type HAS NOT, and remains what it was previously.

Hello
Firstly, I have posted wrong handler, which should have been:
on set_creator_code(f, c)
        string f : POSIX path of target file
        string c : 4-character creator code (or "" to set 0x00000000)
    do shell script "/usr/bin/perl <<'EOF' - " & f's quoted form & " " & c's quoted form & "
die \"Usage: $0 <file> [<creator code>]\" unless @ARGV > 0;
my ($f, $c) = @ARGV;
(my $finfo = qx[xattr -p com.apple.FinderInfo \"$f\" 2>/dev/null]) =~ s/[[:space:]]//og;
$finfo = \"00\" x 32 unless $finfo;
my $cccc = unpack('H8', $c . \"\\0\\0\\0\\0\");
$finfo =~ s/ ^((?:..){4}) ((?:..){4}) /$1$cccc/ox;
qx[xattr -w -x com.apple.FinderInfo \"$finfo\" \"$f\"];
EOF"
end set_creator_code
* The previous (wrong) handler will create wrong data when there's no com.apple.FinderInfo attribute of the file. Sorry.
By the way, this handler is written to set creator code to \0\0\0\0 when c = "". So the script below will do what you want for a file.
set f to choose file
set_creator_code(f's POSIX path, "")
As for recursive processing, it is straightforward but the question is how to determine the target files. Processing every file under a given directory tree could be too broad and potentially dangerous. Can we assume the target files are all html and its name extension is .html or .htm? If so, the script below will do what you want:
set d to choose folder
set_creator_code_recursively(d's POSIX path, "(html|htm)", "")
on set_creator_code_recursively(d, e, c)
        string d : POSIX path of target directory
        string e : name extension pattern (case insensitive), e.g., (html|htm|css)
        string c : 4-character creator code (or "" to set 0x00000000)
    do shell script "/usr/bin/perl <<'EOF' - " & d's quoted form & " " & e's quoted form & " " & c's quoted form & "
die \"Usage: $0 <directory> <name extension pattern> [<creator code>]\" unless @ARGV > 1;
my ($dir, $ext, $code) = @ARGV;
local $/=\"\\0\";
my @ff = map {chomp; $_} qx[find -E \"$dir\" -type f -iregex '.*\\\\.$ext\\$' -print0];
for my $f (@ff) {
    (my $finfo = qx[xattr -p com.apple.FinderInfo \"$f\" 2>/dev/null]) =~ s/[[:space:]]//og;
    $finfo = \"00\" x 32 unless $finfo;
    my $cccc = unpack('H8', $code . \"\\0\\0\\0\\0\");
    $finfo =~ s/ ^((?:..){4}) ((?:..){4}) /$1$cccc/ox;
    qx[xattr -w -x com.apple.FinderInfo \"$finfo\" \"$f\"];
EOF"
end set_creator_code_recursively
Hope this may help,
H

Similar Messages

  • How can i change brush type with script?

    I can already set the width, size of it, but i cant find out how to change the type. Even script listener dont produce the needed code for it.

    Never mind. I managed to do it, script listener did produce the code, i just didnt find it at first. I meant brush style by type.

  • How can I change from paying with a credit card to using prepaid for itunes

    How can I change from paying with a credit card to using prepaid for itunes on ipad 2 .alrwady have app ID

    iTunes Store: Changing Account Information
    http://support.apple.com/kb/HT1918
    Apple ID Support - Manage Account
    http://www.apple.com/support/appleid/manage/
     Cheers, Tom

  • How can I change the language with the .dat (.bak) file?

    How can I change the language with the .dat (.bak) file? Is it legal?
    How does it work?
    Thanks for answering

    https://discussions.apple.com/message/17364930#17364930

  • How can I open a document with applescript without the doc. window opening.

    How can I open a document with applescript without opening the document window and speak the text of the document?  I can get it to open the file but the doc window always opens up. 

    try
              set pathToMyFolderOnDesktop to ("Macintosh HD:Users:jodyconnor:Desktop:") & "Dsource:" as alias
              set rnd to (random number from 1 to 6)
              set rndFileName to (rnd as text) & ".scpt"
              set FullPath to pathToMyFolderOnDesktop & rndFileName as text
              set myScript to load script (FullPath as alias)
      run script myScript
    on error the error_message number the error_number
              display dialog "Error: " & the error_number & ". " & the error_message buttons {"OK"} default button 1
              return
    end try
    This code answered my question:  Hats off to Digimonk from stackoverflow and Darrick Herewe from stackoverflow.

  • In transaction Fv60 can we change transaction type(invoice/ credit memo)

    Hi Experts,
    Can you help?
    In transaction Fv60 , while editing a park documentcan can we change transaction type(invoice/ credit memo) . I mean can we change the status of document from credit memo to invoice?
    Thanks

    Hi Sumit,
                  Certainly, we can change the transaction type in fv60. Yes we can change the status of the document.
    Regards,
    Srinivas Muthyala

  • Can I change hard disk with SSD drive in Toshiba NB100?

    Can I change hard disk with SSD drive in Toshiba NB100 ?
    The Hard disc in this model is same size as SSD 2.5" drive?

    Hi
    As mentioned above: the SATA controller is supported so you will need to use a SATA SSD drive usually it should not be a big problem to upgrade the notebook with an SSD drive in some cases it could be possible that the SSD firmware needs to be updated but this depends on the SSD drive manufacturer
    However, the SSD drive is much faster than a common HDD. Therefore you should notice a faster performance

  • How can I change of page with double click on my I-pod nano 7th generation?

    How can I change of page with the double click feature on my I pod nano 7th generation?

    I can't really understand what you are asking. Can you elaborate?

  • Can I change AMD 6490 with a nividia graphic card in a DV6 6129sl?

    Can I change AMD 6490 with a nividia graphic card in a DV6 6129sl?
    dual boot Windows 7/  Debian
    I'm tired of this RADEON.It's terrible with both Windows and even more with linux.
    I also regret having bought a HP.
    If I could change it with a Nividia, configure the driver for linux is much easier and no blue screen on Windows.
    Mary

    Hi, Mary:
    Your notebook does not have any removable/replaceable graphics 'cards'.
    The GPU's are chips which are soldered to the motherboard and cannot be upgraded, or replaced.

  • Windows BUG: Can't change file types through control panel Quicktime settings

    I am running the latest version of Quicktime on Viista Home Premium 64-bit.
    When I into Control Panel -> View 32-bit Control Panel Items -> Quicktime -> Browser, and I click on "File Types" or "MIME Settings", I get a blank page that looks like this: http://oi40.tinypic.com/hvbbia.jpg, and Quicktime momentarily freezes.
    I have no issue adjusting file type settings when bringing up Quicktime outside of control panel, or when using "Default Programs" within control panel, it's only when I do it within "View 32-bit Control Panel Items" that it does this.
    This is a minor bug but still weird. Can anyone else verify the issue? I tried uninstalling and reinstalling but that didn't help.

    This could be caused by damaged QuickTime preference files (or possibly a permissions problem on the preferences files).
    We can try rebuilding one set of your preference files to see if that helps with the greyed-out stuff.
    First, quit QuickTime if you have it open.
    Next, you'll need to make sure you are set up to view hidden files and folders in Vista (or 7).
    1. From the Start menu, click Open.
    2. In the Organize menu, click Folder and Search Options.
    3. Click the View tab.
    4. In the "Advanced settings" pane under "Hidden files and folders" make sure that the "Show hidden files and folders" option is selected.
    5. Click OK.
    Next, you'll remove the QuickTime preference folder (and contained file).
    6. In Computer, open Local Disk: C or whichever drive your documents are stored on.
    7. Open the Users folder.
    8. Open the folder with the name of the Windows 7 user account in which the QuickTime file types are "greyed out".
    9. Open the AppData folder.
    10. Open the Local folder.
    11. Open the Apple Computer folder.
    12. Drag the QuickTime folder out onto the Desktop.
    Now you'll rebuild the preference folder and file.
    13. Launch QuickTime. Check your file types again.
    Are they still greyed out, or can you change them now?

  • Can't change the type of media from Home videos to TV Shows.

    My aim is to organize videos into folders, so I followed the well known workaround to change the type of videos to 'TV Show' and group them by name of the 'show'. After changing the type, videos are moved to 'TV Shows', but when I try to play them on iPad, the player shows up for a fraction of second and closes (the "downloading" icon appears, of course running endlessly, since the files are mine, not downloaded). After that, when I try to play the video in iTunes, the exclamation mark appears, and the only thing I can do with the video is delete it...
    I have, in fact, succeeded in this conversion with one of the files, but only once. After deleting it and trying once again, the same problem appeared. Is this a software bug, or a new feature in iOS 8.1 and the only thing I can do to get my videos organized is rely on third party apps?

    OK, the problem is solved. I've beed uploading the videos directly to iPad ("On My Device" section) and then trying to change the type to TV Show, while I should first import them into iTunes library, then change the type, and finally sync.

  • How can I change the type of column in matrix

    I want to change the type of column in matrix to it_LINKED_BUTTON, so it can show the orange arrow
    I added the column throw marketing documents (rows)
    It's seems the default column type  is it_Edit
    is there a way of changing the column type
    i tried the below code, but it did not work because the type property in a matrix column is readonly
    mtx.Columns.Item(0).Type = SAPbouiCOM.BoFormItemTypes.it_LINKED_BUTTON
    sincerely yours
    Riade Asleh

    i don't want to add a new column
    i want to change the column type of existing column in matrix, becuase it's bind to a field
    beside that, i can not add column , if the matrix has rows in it
    sincerely yours
    Riade Asleh

  • How Can I change a report with base in another in the same dashboard?

    Hi,
    I need to publish two reports in a dashboard, the first report is a list of values and the second report is a chart. When I click in a value of the first report, the second report must change with the value selected from the first report.
    I first created the first report, and I changed the column properties in the data format, I selected treat text as: "Custom Text Format", the Custom Text Format is:
    @[html]"<f ont class=Nav oncl ick=\"Ja vaScr ipt:GoNav(event, '/path/reporte2','TABLE','FIELD','"@"');\">"@"< /fo nt>";;@
    The second Report has the next filter: FIELD is equal to / is in @{NQ_SESSION.@}
    With this the first and second reports works well, however, when I include the two reports in dashboard, the second report is updated in another window not in the same section.
    How Can I change the second report in the same page or section where this the first report?
    Thanks
    Edwin Guerrero

    I am not sure whether this would work but worth a try. Create a third report which would call the 2nd report using iframe and GO URL. Name the iframe of the narrative view. And use the java script to update the iframe using objWin = window.open(<ur go url>, “biee”,”height=480,width=240,scrollbars=yes,resizeable=yes”);. I had used a similar method to integrate biee with mapviewer. You can check it out here http://oraclebizint.wordpress.com/2007/09/26/oracle-bi-ee-10133-and-mapviewer-step-by-step-integration-phase2-and-phase3/
    Thanks,
    Venkat
    http://oraclebizint.wordpress.com

  • Can I change DataSouce Type?

    I have two questions:
    1. Is that possible to change DataSouce Type from Attribute to Text? How?
    2. We created a InfoObject has one key only, and found out the only key returns non unique records. When I opened the DTP, I saw one key for one of the Rule Name. How can I add another one?
    Thanks!

    Hi,
    Existing Standard Datasources cannot be changed from Attrib to Text.This is decided at the time of creation. When you create generic data source you can decide it at the time of creation.
    Hope this helps
    Happy

  • How can I change Time data with List Entry Screen ?

    Hi expert.
    I transfer Time Data (Infotype 2003) via CAT6.
    When I go to transaction PA61 and click List Entry icon.
    Record is display and cannot change data.
    If I wanna change data.I must to click Choose Icon one by one record.
    How can I change data with List Entry Screen?
    ps. If record create via PA61. I can change data with List Entry Screen.
    I can't change with record that create via CAT6.
    Best Regards.

    have u tried to change your time entry through CAT2 tcode, ithink if u have created profile for time entry then it should allow you to change and you can use esc otherwise, its generally the standard profile given by SAP. but is 4 one user
    hope this helps
    guds

Maybe you are looking for

  • SQL Injection with CF7 and MS SQL 2005

    I looked through a bunch of SQL injection posts and couldn't find a definitive answer to this... Let me introduce this by saying that I know I should be using CFQUERYPARAM with EVERY CF variable in a CFQUERY tag. No excuses. But for a necessary quick

  • Black & White Printing MAC

    Hi, I can not get my printer to print only in greyscale or black and white. Can you please help me with this? I have almost no need to print color ever.  Thanks!

  • Broadband at Braunston Exchange

    Hello, Can you please let me know what the following means on our exchange, this is from the Samknows website Wholesale Broadband Connect should be available in your area from May 31st 2012 Does this mean that the internet speeds will increase? Will

  • IDOCType PORDCR101 : XML IDoc conversion: No known segments identified

    Hello all, I'm strugling with the mapping to the IDOC create puchase order PORDCR1.PORDCR101. The source structure for the moment is exactly the same as the target strcuture i.e. our IDOC. So I would not expect to much problems with this one. However

  • Pse 10 organizer crashes on start up

    I added folders to organizer. After that it didn't work. Before that worked fine. What to do?