← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #289066]: Variable values not carrying over to functions called from separate scripts

 

Question #289066 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/289066

    Status: Answered => Open

Jimmy Bartlett is still having a problem:
Hm. It would appear that I failed to capture the complexity of my
problem with the example code. Let me explain what I'm trying to do, and
hopefully that will help more.

I'm using Sikuli to automate the process of posting about a half-dozen
different ads for my handyman business to a local website that
specializes in that kind of thing. So all of the dynamic variables
(things like the ad title, body, location of photos to upload, etc) are
stored in the individual script for each ad. For the purposes of this
discussion, we'll call it AdX.sikuli. All of the ad scripts end with a
call to the static function stored in a separate module
(Ad_Function.sikuli), which plugs the dynamic variables for whichever ad
script called it into the places where it needs to fill in the forms on
the website. All of the parts that don't change per-ad, such as which
button or link to click on, are pulled in from another module
(Ad_Lib.sikuli).

The problem with doing it the way you suggested is that I can't put the
dynamic variable values into Ad_Function or Ad_Lib, because the content
for each ad changes all the time. I was trying to set it up so that I
can add more scripts at a later date, without ever touching the main
code. Eventually, I'll probably have a few dozen ads running at various
times, and I'd like to be able to delegate the job of creating new ad
content and setting up the task scheduler to an assistant, who I
wouldn't necessarily trust to navigate through the code and replace
variables without messing anything up. At least with the AdX.sikuli
setup, I can basically just tell them, "Clone the ad script, then just
replace everything in between the quotation marks," and if they mess up,
they've only changed a clone, not the original source code.

Ad_Function can always call the static variables from Ad_Lib without any
trouble, because Ad_Lib is static. But since AdX is really Ad1, Ad2,
Ad3, etc... I need a way to tell Ad_Function to grab the values of the
dynamic variables from whichever script called it. Is there a way to do
that dynamically?

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