cbuliarca / BCM_exetndShortcutsUI

Collection of Photoshop scripts accesed with an UI, main focused on game textures creation. Ex: multi mask, multi import files, change color with gestures, magic wand for a hot layer, more saves options, special layer, layer sets, split colors id, some other tools
23 stars 9 forks source link

Use part of a BCM_tools script as single script? #1

Open jonohunt opened 6 years ago

jonohunt commented 6 years ago

How easy would it be to take one of the functions/scripts from BCM_tools into a single (simple/lightweight) script without having to call on BCM_ToolsUI.jsx?

I don't really know JavaScript, but create a few AppleScripts for Photoshop. It would be really useful to add the code for selectBack, ToggleOpen_CloseGroup etc. into some of my AppleScripts using the 'do javascript' function in AppleScript and pasting it those snippets of JavaScript code :)

cbuliarca commented 6 years ago

Hi, the scripts are saved as .jsx files in the folder structure of BCM_exetndShortcutsUI, for example the ToggleOpen_CloseGroup is this script: "BCM_exetndShortcutsUI\BCMtoolsUI\extras\scripts\~BCM08 ToggleOpenCloseGroup.jsx" so you can just acces from AppleScript using 'do javascript (path to ~BCM08 ToggleOpen_CloseGroup.jsx"). To see the script that is accesed by any button just right cliuck on it, and in the command field you will see a function: runScript_Fnct_Arguments(gCurrentESHui.path + "/extras/scripts/~BCM08%20ToggleOpenCloseGroup.jsx;;" ); the argument of that function is the path to the sript in this case: gCurrentESHui.path + "/extras/scripts/~BCM08%20ToggleOpen_CloseGroup.jsx" after that should be the function to act if the script acts with functions and then the arguments, these are splited by the ; So to be clear: runScript_Fnct_Arguments( path to jsx;someFunction;arguments for someFunction) Let me know if you dont understand, I know it's not that clear. Sorry about that

jonohunt commented 6 years ago

Thanks a lot for getting back to me!

Ideally I was wanting to embed all of the code that's needed into one AppleScript, so something like this:

tell application id "com.adobe.Photoshop"
    tell current document

        do javascript "app.activeDocument.suspendHistory('bcmToogleOpenCloseSet', 'toogleOpenCloseSet()');

        some other code that ToggleOpen_CloseGroup uses without needing to link to mb_Utils.jsx"

    end tell
end tell

Is that possible? :) (Without too much trouble)

cbuliarca commented 6 years ago

For that you need go to the mb_utils.jsx and create another newFile.jsx, then copy the function: toogleOpenCloseSet(), ( it's starting with function toogleOpenCloseSet(){ and go to the last }). To test it you have to call it. So after copying the function add on the first line: toogleOpenCloseSet().
By testing you will get errors saying what functions can not be found, or something like this, so you need to copy all the functions that are used by that toogleOpenCloseSet(). You have to reconstruct the script. It will be a bit of a pain to search for all the functions, but I think in maximum 10-20 minutes you could find all of them.

jonohunt commented 6 years ago

Thanks a lot, I'll give it a go.

…BTW, did you really work on Dishonored and Dishonored 2?! Both are my favourite games ever!

cbuliarca commented 6 years ago

Yes, I was lucky to be a part of the team. I'ts always great to meet guys who like Dishonored games :) You can check my portfolio here: https://www.artstation.com/cbuliarca, and if you want to listen to me stutter and trying to find words in english you can watch this interview :) https://www.youtube.com/watch?time_continue=2&v=9CJ4TJkCp5A

jonohunt commented 6 years ago

Amazing.

Still playing DH2 and DOTH now :)

Thanks again for the help!