1 Script.... Two programs

Total Newbie… just need a push in the right directions.

I have two script files I am often running. 1 for when I am using Adobe photoshop and 1 for when I am using Adobe Lightroom. I would like to combine the two script files and add some code that would allow me to run the script and have the script know which program (lightroom or photoshop) is currently active and therefor which section of the code to run.

For example:

If window title is “Photoshop” run section A of script.
Else If window Tittle is “Lightroom” run section b of Script.

I have no clue what this might look like… So any help would be super.


try this

set Nm to short name of (info for (path to frontmost application))
if Nm contains "Photoshop" then
	-- do Photoshop action
else if Nm contains "Lightroom" then
	-- do Lightroom action
end if