← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #818073]: Running a script with a parameter

 

Question #818073 on SikuliX changed:
https://answers.launchpad.net/sikuli/+question/818073

david posted a new comment:
To run a script with a parameter, pass the parameter via the command
line, e.g., python script.py parameter. In the script, use sys.argv to
access the parameter. For example:

import sys

parameter = sys.argv[1]  # Access the first parameter
if parameter == "option1":
    # Code for option1
elif parameter == "option2":
    # Code for option2

This way, the script's behavior changes based on the parameter passed.

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for SikuliX.