Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Convert to text

I'm trying to get a numerical value to put into this script, but I get an error when I try to convert the line to text


Is this possibly, I 'm trying to go back a set number of history steps in photoshop.


Many Thanks

Matt



tell application id "com.adobe.photoshop"
  tell current document
  set a to current history state
  --undo larget action
  log a
  --(*history state 57 of document DJ30ER08204OR6GO.JPG*)---
  set b to 3rd text item of (a as text)
  set current history state to history state (b - 27)
  end tell
end tell



Error "Can’t make «class cHst» 57 of document \"DJ30ER08204OR6GO.JPG\" of application \"Adobe Photoshop CC 2015\" into type text." number -1700 from «class cHst» 57 of document "DJ30ER08204OR6GO.JPG" totext

Posted on Feb 8, 2016 3:38 AM

Reply
3 replies

Feb 8, 2016 6:09 AM in response to MattJayC

This works.... for now but is somewhat messy.



tell application id "com.adobe.photoshop"
  tell current document
  set a to (current history state)
  try
  set b to (a as text)
  on error error_message
  end try
  log "error " & error_message
  set {oldTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, "Can’t make «class cHst»"}
  set c to last text item of error_message
  set {oldTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, "of document"}
  set d to first text item of c
  set e to d as integer

  --(*history state 57 of document DJ30ER08204OR6GO.JPG*)---
 
  set current history state to history state (e - 27)




  end tell
end tell

Convert to text

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.