Results 1 to 2 of 2

Thread: Pass all arguments into array VBS

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2021
    Posts
    1

    Pass all arguments into array VBS

    0


    I want to run jsx script and passing argument into array

    Code:
    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!

  2. #2
    Frenzied Member
    Join Date
    Feb 2003
    Posts
    1,807

    Re: Pass all arguments into array VBS

    Hi WellPlayed,

    Welcome to the forum. Your post is hard to understand and I am not sure what you're asking. But, after some testing I found that "infosDoc = Wscript.arguments()" should cause an error. Are you using "On Error Resume Next"?

    To get all arguments passed to your vbscript in a string you could use this code:
    Code:
    Option Explicit
    
    WScript.echo(GetArguments)
    
    Function GetArguments()
    Dim Argument
    Dim Arguments
    
     Arguments = vbNullString
     For Each Argument In WScript.Arguments
      Arguments = Arguments & " "  & Argument
     Next
    
     GetArguments = Trim(Arguments)
    End Function
    yours,
    Peter Swinkels

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width