Amphotography Posted August 26, 2015 Posted August 26, 2015 Hi all! We had a script made to work with CS5 and since then have moved over to CS6 and now it does not work.The script is supposed to work like so:Read .xmp (xmp is a file created by Adobe bridge. We use them to find out if the Raw (.cr2) is labeled. If it is labelled then it is opened in PS and some more bits happen to it)If xmp has any Labels (Select, Second, Approved, Review) then open file.That's it in a nutshell. However it doesnt seem to be recognizing the files any more.Attached: an example of an xmp i want it to readHere's the Full part for the functions where I'm pretty sure it's all going wrong. Disclaimer: I'm completely new at this and have VERY limited knowledge in coding. So please talk to me like an idiot if required! expandcollapse popupFunc _XMP_GET_LABEL($XMP) $LABEL = StringRegExp(FileRead($XMP), "<xmp:Label>(.*?)</xmp:Label>", 3) If Not IsArray($LABEL) Then Return 0 Switch $LABEL[0] Case "Select" $LABEL = 6 Case "Second" $LABEL = 7 Case "Approved" $LABEL = 8 Case "Review" $LABEL = 9 Case Else $LABEL = 0 EndSwitch Return $LABEL EndFunc Func _READ_CAMERARAW_XMP($XMP) $XMP_DATA = StringRegExp(FileRead($XMP), 'xmlns\:crs="http\://ns\.adobe\.com/camera\-raw\-settings/1\.0/">\n(?:.|\n)*?</rdf\:Description>', 3) If Not IsArray($XMP_DATA) Then Return 0 Return $XMP_DATA[0] EndFunc Func _WRITE_CAMERARAW_XMP($DATA, $CR) $SET = StringRegExpReplace(FileRead($CR), 'xmlns\:crs="http\://ns\.adobe\.com/camera\-raw\-settings/1\.0/">\n(?:.|\n)*?</rdf\:Description>', $DATA) $F = FileOpen($CR, 2) FileWrite($F, $SET) FileClose($F) EndFunc Func _LOAD_LABELS($DIR) $LABELS = StringRegExp(FileRead($DIR & "\.BridgeLabelsAndRatings"), "<item key='(.*?)' label='(.*?)'/>", 3) If Not IsArray($LABELS) Then Return 0 Local $DATA[UBound($LABELS) / 2][2] For $I = 0 To UBound($LABELS) - 1 Step 2 $DATA[$I / 2][0] = $LABELS[$I] Switch $LABELS[$I + 1] Case "Select" $DATA[$I / 2][1] = 6 Case "Second" $DATA[$I / 2][1] = 7 Case "Approved" $DATA[$I / 2][1] = 8 Case "Review" $DATA[$I / 2][1] = 9 EndSwitch Next Return $DATA EndFunc So most of it is going haywire due to a few things:1. The String it's looking for no longer exsists.$XMP_DATA = StringRegExp(FileRead($XMP), 'xmlns\:crs="http\://ns\.adobe\.com/camera\-raw\-settings/1\.0/">\n(?:.|\n)*?</rdf\:Description>', 3)$SET = StringRegExpReplace(FileRead($CR), 'xmlns\:crs="http\://ns\.adobe\.com/camera\-raw\-settings/1\.0/">\n(?:.|\n)*?</rdf\:Description>', $DATA) 2. CS6 no longer creates BridgeLabelsAndRatings$LABELS = StringRegExp(FileRead($DIR & "\.BridgeLabelsAndRatings"), "<item key='(.*?)' label='(.*?)'/>", 3) Any help or suggestions would be great! Thanks in advance. Adam example.xmp
l3ill Posted August 26, 2015 Posted August 26, 2015 Just after a quick gander..you may just have to change the paths where the regexp is looking for the string.Found out what these variable are (probably a path (look for the FileOpen() function) ):$xmp$crand change them to work with CS5 ( I dont have CS6 so I cant help there )The $labels is more than likely the same deal, they are probably called something else in CS6.Hope this helps :-)Bill My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example
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