Reputation: 13
I want to run jsx script and passing argument into array
Const psNeverShowDebugger = 1, psDebuggerOnError = 2, psBeforeRunning = 3
Dim appRef
Set appRef = CreateObject("Photoshop.Application")
Dim infosDoc
infosDoc = Wscript.arguments()
Dim JSXFile
JSXFile = Wscript.arguments(0)
appRef.DoJavaScriptFile "C:\Program Files\Adobe\Adobe Photoshop 2020\Presets\Scripts\"+JSXFile+".jsx", Array(infosDoc), psNeverShowDebugger
Im getting the first argument in JSXFile but not getting all arguments in infosDoc so im a bit confuse, if someone can help me!
Thanks you!
Upvotes: 1
Views: 241
Reputation: 6824
Wscript.Arguments
(without parenthesis) returns an array of arguments, i.e. if you need to pass it as an argument of another function you should call as
Set infosDoc = Wscript.Arguments
...
appRef.DoJavaScriptFile
"C:\Program Files\Adobe\Adobe Photoshop 2020\Presets\Scripts\"+JSXFile+".jsx",
infosDoc,
psNeverShowDebugger
if you need to pass an array with the specific keys then
appRef.DoJavaScriptFile
"C:\Program Files\Adobe\Adobe Photoshop 2020\Presets\Scripts\"+JSXFile+".jsx",
Array(infosDoc(1), infosDoc(2)), <-- custom array with 2nd and 3rd elements of infosDoc
psNeverShowDebugger
Upvotes: 1