Hi there...
Well I've got this strange error... and I am trying to figure how i will bypass it... (i know one way will to create a batch or a script for it - but need it like this to avoid - click simulate from batch.)
The error:
real command line - that works - set diplay monitor at sleep:
*This command set Display-Monitor to sleep...
Well I've got this strange error... and I am trying to figure how i will bypass it... (i know one way will to create a batch or a script for it - but need it like this to avoid - click simulate from batch.)
B4X:
Dim js As Shell
Dim params As List
params.Initialize
Dim mystring As String=$"(Add-Type '[DllImport(\"user32.dll\")]^public static extern int SendMessage(int hWnd, int hMsg, int wParam, int lParam);' -Name a -Pas)::SendMessage(-1,0x0112,0xF170,2)"$
js.Initialize("js", "powershell.exe", Array(mystring)) <---here getting error...
js.WorkingDirectory="c:\windows\system32"
If Main.ShellEncoding.Length>0 Then js.Encoding=Main.ShellEncoding
js.Run(-1)
Wait for (js) js_ProcessCompleted (Success As Boolean, ExitCode As Int, StdOut As String, StdErr As String)
'Log(StdOut)
The error:
java.lang.IllegalArgumentException: Can't handle single and double quotes in sam
e argument
at b4j/org.apache.commons.exec.util.StringUtils.quoteArgument(Unknown So
urce)
at b4j/org.apache.commons.exec.CommandLine.addArgument(Unknown Source)
real command line - that works - set diplay monitor at sleep:
B4X:
powershell.exe (Add-Type '[DllImport(\"user32.dll\")]^public static extern int SendMessage(int hWnd, int hMsg, int wParam, int lParam);' -Name a -Pas)::SendMessage(-1,0x0112,0xF170,2)
*This command set Display-Monitor to sleep...