Using COM to interact with Photoshop.
The following code successfully changes the foreground color in Photoshop to the hex value of 64c820
Code: Select all
appRef := ComObjActive("Photoshop.Application")
SolidColor := ComObjCreate("Photoshop.SolidColor")
hex := SolidColor
hex.rgb.hexValue := "64c820"
appRef.foregroundColor := hex
Code: Select all
color=64c820
appRef := ComObjActive("Photoshop.Application")
SolidColor := ComObjCreate("Photoshop.SolidColor")
hex := SolidColor
hex.rgb.hexValue := "%color%"
appRef.foregroundColor := hex
[img]
https://ibb.co/ipYmHc
[/img]
My guess is that in order for Photoshop to accept the code, this line: hex.rgb.hexValue := "64c820" must contain a 6 character HEX code inside the quotes instead of a variable reference.
In other words, this one works:
Code: Select all
hex.rgb.hexValue := "64c820"
Code: Select all
hex.rgb.hexValue := "%color%"
..how can I insert a 6-character variable inside those quotation marks? I've tried many variations, such as:
Code: Select all
color=64c820
variable=
(
appRef := ComObjActive("Photoshop.Application")
SolidColor := ComObjCreate("Photoshop.SolidColor")
hex := SolidColor
hex.rgb.hexValue := "%color%"
appRef.foregroundColor := hex
)
MsgBox, %variable%