Using the syscommand to execute gpg

 3 Replies
 0 Subscribed to this topic
 52 Subscribed to this forum
Sort:
Author
Messages
JimY
Veteran Member Send Private Message
Posts: 510
Veteran Member
I have flow that I am using for testing purposes and I am writing the following out to a bat file and then trying to execute it using the syscommand.

[code]
"gpg --recipient \"ING\" --output \"D:\\putty\\gpg_help.txt.gpg\" --encrypt \"D:\\putty\\gpg_help.txt\"\r\n"
"ftp -s: d:\\putty\\jimcmds 10.50.4.179"
[/code]

     When it gets executed I get the message that it does not recognize gpg as a command.  If I run the bat file from the command line it works fine.  I have tried execution mode of automatic and cmd.exe,  Is there something that I need to set up in the configuration?  Has anybody tried anything similar? IPA Version 10 Windows 2008r2.  Thank you.

Shane Jones
Veteran Member Send Private Message
Posts: 460
Veteran Member

I created a .vbs file in the flow with this content to use the GNU program:

Option Explicit

Dim bWaitOnReturn: bWaitOnReturn = True
Dim iWindowStyle: iWindowStyle = 7 'Minimized; active window stays active
Dim sPassphrase: sPassphrase = "yourpassphrasehere"
Dim sFileName_Output: sFileName_Output = "\\fs-Server\hr-data\FTProot\401\LOAD-401-Loan\FromVendor_ToBeProcessed\decrypted-loan-<!--agsdatetoday-->.csv"
Dim sFileName_Input: sFileName_Input = "\\fs-Server\hr-data\FTProot\401\LOAD-401-Loan\FromVendor_ToBeProcessed-ENCRYPTED\<!--FA_GPG_file_filenames-->"
Dim sCommand_Text: sCommand_Text = Chr(34) & "C:\Program Files\GNU\GnuPG\gpg.exe" & Chr(34) & "--passphrase " & Chr(34) & sPassphrase & Chr(34) & " -o " & Chr(34) & sFileName_Output & Chr(34) & " -d " & Chr(34) & sFileName_Input & Chr(34)
Dim oWiSH_Shell: Set oWiSH_Shell = CreateObject("WScript.Shell")
oWiSH_Shell.Run sCommand_Text, iWindowStyle, bWaitOnReturn
Set oWiSH_Shell = Nothing
WScript.Quit

Then after it is created I run it with this:

run \\AS-Server\c$\linte5\apps\bpm\pfrepository\PF-external-scripts\decryptfile<!--agsdatetoday-->.vbs

TIP:

You might need a pause between the two nodes because sometimes the process runs so fast that the vbs file is not saved before the system command is run... I use a javascript and then a variable assignment to pause the flow.

function startPause(mill, tdiff)
{
var lastdate = new Date();
var currdate = null;
var tdiff = 0;

do { currdate = new Date();
tdiff = currdate-lastdate; }
while(currdate-lastdate < mill);
return tdiff;
}

Then just assign a double variable like this:

startPause(60000, 0)


Shane Jones
Tools: HR, Payroll, Benefits, PFI, Smart Office, BSI, Portal and Self-Service
Systems: Lawson, Open Hire, Kronos, Crystal Reporting, SumTotal Learning
** Teach others to fish...
JimY
Veteran Member Send Private Message
Posts: 510
Veteran Member
Hi Shane,
Thank you for the response. I am not experienced in VB so I will have to look at another solution.
JimY
Veteran Member Send Private Message
Posts: 510
Veteran Member
I was able to resolve this by using "cd" to move into the directory where the executable gpg is located. Thank you.