lepass7 Posted December 1, 2021 Report Posted December 1, 2021 Dears, I would appreciate your help on the below matter. I am trying to send email using intouch scada. I am using the following command: StartApp "powershell.exe " + par0 + par1 + par2 + par3 + par4 + par5 + par6 + par7 + par8 + par9; par0 --> is the powershell script path par1 --> is the email par2 to par9 are some parameters i would like to send. I checked the power shell script and its working just fine, but when i run the script through intouch it seems that executes a part of the string. For example: par0 = "PATH_ON_MY_PC/powershell.ps"; par1 = "test@test.com" par2 = " -par1 12"; par3 = " -par2 10"; par4 = " -par3 test"; ... par9 = " -par9 9"; I am only getting first parameter and if i change to this: StartApp "powershell.exe " + par0 + par1 + par3 + par2 + par4 + par5 + par6 + par7 + par8 + par9; I will only get third parameter. How can I overcome this limitation?
BobLfoot Posted December 1, 2021 Report Posted December 1, 2021 Not sure of this but I usually use & and not + for string concatenation -- which is what you're doing.
lepass7 Posted December 2, 2021 Author Report Posted December 2, 2021 HI BobLFoot, Thank you for your reply and your suggestion but I think this in not the case. I am pretty sure that the problem is with the length of the string. As you can see in the following example I call the power shell script with only two parameters par1 and par2. I get the email but the string I get is not "123456789123456789123456789123456789" but I only get "123456789123" StartApp "powershell.exe PATH_TO_SCRIPT -par1 test@test.com -par2 123456789123456789123456789123456789 " Based on the example below I strongly believe that the problem is with the length of the string, so is there any way to "hack" this?
BobLfoot Posted December 2, 2021 Report Posted December 2, 2021 Strange that 123456789123 meets the 12345678.123 length criteria. What happens if you change par2 Message1.txt and have your longer string in that text file. I'm not sure where you'd place message1.txt on the PC. Sorry that's about all the help I can give.
lepass7 Posted December 4, 2021 Author Report Posted December 4, 2021 THank you for your help. I have created a walk around solution. I am saving the parameters in a file and then i "call" powershell app with just one parameter (the file parameter). Thank you Bob for the idea.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now