Skip to main content
Participant
April 22, 2018
Answered

Insert Reference point with mouse click

  • April 22, 2018
  • 1 reply
  • 926 views

Hi! Is there a way to enter a reference point by clicking with the mouse? For example: I want to move an object (while free transform is active). In the field ''set horizontal position of reference point'', I would like to click instead of dragging or entering a value by hand..(same for Y axis). This way I would not have to zoom out to get my object, place it approximately, then zoom in and move it to where i want it to be.

thanks you!

This topic has been closed for replies.
Correct answer Chuck Uebele

I would use javascript rather than VB, as more people know JS. As I mentioned earlier, I don't think you can run the script while you're transforming something, but you can do it afterwards. Here's a script that will move the current layer's top left corner to a color sample point.

#target photoshop

var doc = activeDocument;

var pt = doc.colorSamplers[0].position

var lBounds = doc.activeLayer.bounds

doc.activeLayer.translate (pt[0]-lBounds[0], pt[1]-lBounds[1]);

Moving thread to scripting forum.

1 reply

Chuck Uebele
Community Expert
Community Expert
April 22, 2018

You could do that with a script: set an eye dropper sample point as your reference point, then move the object, but I don't think it will work when free transform is active.

Participant
April 23, 2018

ok! I am currently trying to figure out how to make that script..I am not very experienced with VBS. My experience stops at making macro command for Autocad, which have very little variable to play with compare to scripting..I might try in the scripting forum to see if someone can help me with that..

thanks!

Chuck Uebele
Community Expert
Chuck UebeleCommunity ExpertCorrect answer
Community Expert
April 23, 2018

I would use javascript rather than VB, as more people know JS. As I mentioned earlier, I don't think you can run the script while you're transforming something, but you can do it afterwards. Here's a script that will move the current layer's top left corner to a color sample point.

#target photoshop

var doc = activeDocument;

var pt = doc.colorSamplers[0].position

var lBounds = doc.activeLayer.bounds

doc.activeLayer.translate (pt[0]-lBounds[0], pt[1]-lBounds[1]);

Moving thread to scripting forum.