Capturing a numerical value

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
TimTom
Newbie
Posts: 18
Joined: Mon Oct 10, 2005 3:05 pm

Capturing a numerical value

Post by TimTom » Sun Sep 09, 2007 3:06 am

Hi, All--

This is my second attempt at posting about this problem. My first post didn't show up, probably because I forgot to put in a subject line.

I am attempting to capture two numbers, the height and width of a photo in pixels, from Photoshop. Then I will use those numbers to automatically determine how to resize it.

The problem is that it appears that I can't capture these numbers using the clipboard because the clipboard captures it as text. Therefore the relational tests won't work.

I guess this means I need to be using the "Let" function but haven't found a way to do it. Here is the macro as it now is written. Any help would be greatly appreciated.

=============================
//compare height & width
press ctrl
send>c
release ctrl
getclipboard>width
wait>1
press tab * 2
press ctrl
send>c
release ctrl
getclipboard>height
wait>1
IF height > width
send> 130
wait>1
ENDIF
IF width > height
press shift
press tab * 2
release shift
send> 130
wait>1
ENDIF
IF width = height
send> 130
wait>1
ENDIF
press enter
=========================

Thanks,

timtom

User avatar
JRL
Automation Wizard
Posts: 3526
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Sun Sep 09, 2007 4:25 am

TimTom,
I don't have PhotoShop so I can't test this but if the ctrl+c is capturing the numbers (as text) that PhotoShop reports for the width and height of the image then Macro Scheduler will certainly be able to make comparisons between the two numbers.

You have multiple syntax errors including unneeded spaces in your code.
I have rewritten your submission with the errors fixed.

=============================
//compare height & width
press ctrl
send>c
release ctrl
getclipboard>width
wait>1
press tab*2
press ctrl
send>c
release ctrl
getclipboard>height
wait>1
IF>%height%>%width%
send>130
wait>1
ENDIF
IF>%width%>%height%
press shift
press tab*2
release shift
send>130
wait>1
ENDIF
IF>%width%=%height%
send>130
wait>1
ENDIF
press enter
=========================

TimTom
Newbie
Posts: 18
Joined: Mon Oct 10, 2005 3:05 pm

Capturing a numerical value

Post by TimTom » Sun Sep 09, 2007 2:16 pm

Thank you for your excellent advice. It now works great!!

Just want to, again, thank everyone for their help on this forum. I have used this group several times in the past and you folks always come through -- and very, very quickly. Can't tell you how much I appreciate it.

timtom

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts