Hi,
I imagine the only way I can set the insertion point of a text field to the beginning of the text inside it is to call a Cocoa method. Basically what I am looking for is to place some text into a text field (that I can do with Applescript Studio obviously), but then set the current insertion point to the beginning of the text so that when the user starts typing in the field, the original text is not overwritten. Can anyone inform of the proper method call to do this? Thanks.
An update to this…
I have found the method to do this, but I am having trouble getting the proper syntax. My code snippet looks as follows
set contents of text field “editedFileName” of window “namingProblem” to imageDimText & text -5 thru end of imageFileName
show window “namingProblem”
call method “setSelectedRange:NSMakeRange:” of (text field “editedFileName” of window “namingProblem”) with parameters {0, 0}
basically, when I run this, I am getting the text being put into the text field “editedFileName”, but it stays highlighted even after the call method.
try this saskscripter
call method “setSelectedRange:” of (call method “currentEditor” of text field “editedFileName”) with parameter 0
Budgie
Thank you so much!
Had to change it ever so slightly to
call method “setSelectedRange:” of (call method “currentEditor” of (text field “editedFileName” of window “namingProblem”) with parameter 0
Thanks again