1

I have a simple script that runs from a shared folder on a server. When I run it from the same network where the server is, everything runs smooth, but when I'm not on the same network and I establish a VPN connection before running it, it returns an error message.

The script:

url = %1%
reservation = %2%
status = %3%
uid = %4%
ex_id = %5%

variables = {"id":"%reservation%", "status":"%status%", "uid":"%uid%", 
"ex_id":"%ex_id%"}

WebRequest := ComObjCreate("WinHttp.WinHttpRequest.5.1")
WebRequest.Open("PUT", url, false)
WebRequest.setRequestHeader("Content-Type", "application/json")
WebRequest.Send(variables)
Return

The error is 0x80072726 - An invalid argument was supplied. Specifically: Send

WebRequest.Send(variables)

Error Image Any help would be greatly appreciated because I'm stuck here.

needle
  • 11
  • 2
  • Welcome. Didja try it like `WebRequest.Send(%variables%)` ? I guess since it works as interpreted, that's _not_ the issue . . . Try quoting each independant command line variable, or put in a msg box that displays what each variable is first to debug. – PGilm Oct 19 '18 at 17:06
  • Thanks PGilm but I discovered new clues and updated the thread... any more ideas? – needle Oct 21 '18 at 14:37
  • can you recreate the request in something like Postman while you're on and off the VPN? Definitely sounds like it's a network related error and nothing with the code – colinwurtz Oct 21 '18 at 16:25
  • Are you running a compiled script? Try at the top of your code the following directives: `#NoEnv` and `SetWorkingDir %A_ScriptDir%` and re-compile. You could also try making two different shortcuts, one using the express Server paths to executable and working directory, and the other using the VPN network paths (probably different drive letters). – PGilm Oct 22 '18 at 18:24

0 Answers0