application.executeProgram

Questions, tips and tricks and techniques for scripting in Servoy

application.executeProgram

Postby garroyo » Wed Mar 02, 2022 5:05 pm

I am trying to run application.executeprogram, specifing the cmd as I would do in a console, but I can't pass it the parameters I want.
In the console the command is:
AFCL.exe sign -certgui -i c:\tmp\fich.xml -o c:\tmp\fich_s.xml -format XAdES -store windows -filter subject.contains:12710839G -xml -config "policyIdentifier=urn:ticketbai:dss:policy:1\npolicyDescription=TicketBAI sinadura-politika / Politica de firma TicketBAI\npolicyIdentifierHash=6NrKAm60o7u62FUQwzZew24ra2ve9PRQYwC21AM6In0=\n policyIdentifierHashAlgorithm=http://www.w3.org/2001/04/xmlenc#sha256 \n policyQualifier=https://www.gipuzkoa.eus/ticketbai/sinadura \n format=XAdES Enveloped"


The options or parameters that I can pass to AFCL.exe in cmd are:
-gui (Performs the operation with a graphical environment. It has priority over -certgui)
-certgui (Uses a graphical dialog for the selection of the signing certificate)
-i inputfile (Input file path)
-o outputfile (Output file path)
-algorithm algo (Signature Algorithm)
-format (Sets the signature format)
auto (Selection of format based on the input file)
cades (CAdES format)
pades (PAdES format)
xades (XAdES format)
invoicee (Electronic invoice signature)
ooxml (OOXML format)
odf (ODF Format)
-config extraParams (Properties in plain text with the configuration of the operation)
-store (Sets the key store. By default, the system one)
auto (System Key Store)
windows (Windows Key Store)
mac (Mac OS X Key Store)
mozilla (Mozilla Firefox Keystore)
ID (electronic ID)
pkcs12:p12file (PKCS#12 store. "p12file" is the store path)
pkcs11:p11file (PKCS#11 store. "p11file" is the driver path)
-password password (Sets the store password)
-alias alias (Alias ​​of the signing certificate)
-filter filter (Filter to select the signing certificate)
-xml (Formats the response as XML)


I would appreciate help to indicate the correct way to pass these possible parameters to the application.
garroyo
 
Posts: 14
Joined: Mon Jan 23, 2017 2:01 pm

Re: application.executeProgram

Postby Manolo_Etec » Fri Mar 04, 2022 11:26 am

Hi garroyo

At first glance I would put it like this...

application.executeProgram('AFCL.exe', ['sign ', '-certgu', '-i c:\\tmp\\fich.xml','-o c:\\tmp\\fich_s.xml', .......]);
Manuel López
Etec Programación SL
[email protected]
http://www.etecsoft.com
User avatar
Manolo_Etec
 
Posts: 66
Joined: Fri Sep 12, 2008 3:58 pm

Re: application.executeProgram

Postby ROCLASI » Fri Mar 04, 2022 2:39 pm

Hi garroyo,

application.executeProgram() takes the program name as a string and everything you add behind the program name as an array with strings.
This means that every argument that is separated by a space is one entry in the array.
So -o c:\tmp\fich_s.xml are 2 separate entries in the array.
And like Manuel already mentioned, all your backslashes need to be escaped with an extra backslash. Of course when you use \n as an argument then you shouldn't add the extra backslash.

Also the application name requires usually the full path the application.

Hope this helps.
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium

Re: application.executeProgram

Postby garroyo » Sat Mar 05, 2022 10:41 am

OK thank you. i will try what you say
garroyo
 
Posts: 14
Joined: Mon Jan 23, 2017 2:01 pm


Return to Methods

Who is online

Users browsing this forum: Bing [Bot] and 5 guests