Jump to content

How to build command in autoit and execute it


Recommended Posts

HI,

I am using autoit to communicate with and set parameters in an IP camera using http commands. I have the complete command list for the camera I am using and can easily get the camera to supply me with an image.

There are several parameters within the camera that I would like to set just before I grab an image - these can be set and saved into the non volatile memory on the camera but I want to make sure that no-one has changed any of those parameters from my ideal. I am using the InetGet function which will return the requested parameter setting or I can use it to set the parameter e.g. to get a parameter the command below is used (where <IP Address> is the IP address of the camera, <filename> is output file for data).

Inetget "http://<IP Address>/get?autoexp,<filename>

returns the state of the auto exposure setting which can be "on" or "off"

to set autoexposure to "on" the command is

inetget "http://<IP Address>/set?autoexp=on,<filename>

If I use these commands in a web browser the camera returns the parameter setting or sets it. 

If I use these command in an autoit script exactly as above it works but I have several parameters that I wish to do so rather than coding a whole series of Inetget lines I would like to use a Function to do that by sending it the parameter name I wish to set and the parameter value so in the function I need to build that inetget command line (no issue to do that) and I have no problem building a function passing it the required parameters to build the Inetget command. Where I am lost is how I actually action that command within autoit. In other languages there is often an execute command.

Does anyone know how to do this?

George

 

Link to post
Share on other sites
  • Moderators

Correct me if I am wrong, but all you're curious about is how to call the function in your code once you create it? And potentially pass those parameters? If that is the case, the help file on Func...EndFunc has some great examples of usage:

Keyword Func...Return...EndFunc (autoitscript.com)

If your questions is more about the actual passing of parameters, here is a quick and dirty example:

Func _returnMonth($firstName, $lastName)
    MsgBox(0, "Function Return", "Hello, " & $firstName & " " & $lastName & ". Nice to meet you.")
EndFunc

_returnMonth("John", "Smith")

 

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to post
Share on other sites

Thanks JLogan3o13

I was trying to make the whole thing far too complicated. You pointed me in the right direction hence got it sorted. Done this type of thing before but the brain just wasn't getting it sorted until you gave it a jog. Appreciate that. Sometimes we cannot see the forest for the trees.

George

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...