Just a quick one, why do I have to use "Object." with any internal variables in the JavaScript patch, does it conflict with other variables?
Regards, Charlie On 13 January 2011 13:58, Achim Breidenbach <ac...@boinx.com> wrote: > Hello, > > @George: the output_cmd and input_cmd seems to be correct to me. the > structure comes in with positions, which is declared as __structure. > > @Charlie: The script is once executed as a test without any parameters > given. This gives you the error because you dont have an object in > "positions". > lso you can't manipulate input parameter (input_cmd = ''"; will fail). > > When I read your code correctly, you want to push through the input_cmd to > output_cmd only if there is an object in the structure. (anyways, I am not > sure about testing against "null" here) > > function (__string output_cmd) main (__string input_cmd, __structure > positions) > { > var output_cmd = ""; > > if (Object.firstRun == undefined) { > Object.firstRun = 1; > } > else{ > if (positions[input_cmd] == null) { > output_cmd = ""; > } > else{ > output_cmd = input_cmd; > } > } > > var result = new Object(); > result.output_cmd = output_cmd; > return result; > } > > I didn't test the code... > > best, > > Achim Breidenbach > Boinx Software > > On 13.01.2011, at 14:40, George Toledo wrote: > > > I totally haven't even read through your post, but note that you're > declaring string input and output, while actually wanting to deal with > structure. That's problematic, off top. > > > > What are you actually trying to achieve? > > > > -gt > > > > On Thu, Jan 13, 2011 at 8:37 AM, Charlie Francis < > charl...@cellcastonline.com> wrote: > > Hi, > > > > I'm struggling a bit with using JavaScript within Quartz, especially how > to use and abuse the structures that can be passed into the patch. > > What I'm trying to achieve is only letting a string through that matches > one of the keys in the structure. > > Also, if the composition has only just been run, and no strings have been > passed the return string should be blank. > > > > Below is an example of the structure I'm passing: > > > > 0: "left" = Structure > > 0: "x" = -1 > > 1: "y" = 0 > > 1: "right" = Structure > > 0: "x" = 1 > > 1: "y" = 0 > > 2: "center" = Structure > > 0: "x" = 0 > > 1: "y" = 0 > > > > And my Javascript at the moment is: > > > > function (__string output_cmd) main (__string input_cmd, __structure > positions) > > { > > var result = new Object(); > > var firstRun; > > > > if(firstRun != 1) { > > input_cmd = ''; > > firstRun = 1; > > } > > > > if (positions[input_cmd] == null) { > > input_cmd = ''; > > } > > > > result.output_cmd = input_cmd; > > return result; > > } > > > > I seem to be getting an error on the if (positions[input_cmd] == null) { > line, saying that positions is not an object. > > > > I'm also pretty sure the firstRun section is correct, as I've tested it > on it's own and it works. > > > > > > So what is the correct way to work with Structures inside of a JavaScript > patch? > > > > Regards, > > Charlie > > > > _______________________________________________ > > Do not post admin requests to the list. They will be ignored. > > Quartzcomposer-dev mailing list (Quartzcomposer-dev@lists.apple.com > ) > > Help/Unsubscribe/Update your Subscription: > > > http://lists.apple.com/mailman/options/quartzcomposer-dev/gtoledo3%40gmail.com > > > > This email sent to gtole...@gmail.com > > > > > > > > -- > > George Toledo > > gtole...@gmail.com > > www.georgetoledo.com > > > > The information contained in this E-mail and any attachments may be > confidential. > > If you have received this E-mail in error, please notify us immediately > by telephone or return E-mail. > > You should not use or disclose the contents of this E-mail or any of the > attachments for any purpose or to any persons. > > > > _______________________________________________ > > Do not post admin requests to the list. They will be ignored. > > Quartzcomposer-dev mailing list (Quartzcomposer-dev@lists.apple.com > ) > > Help/Unsubscribe/Update your Subscription: > > > http://lists.apple.com/mailman/options/quartzcomposer-dev/achim%40boinx.com > > > > This email sent to ac...@boinx.com > >
_______________________________________________ Do not post admin requests to the list. They will be ignored. Quartzcomposer-dev mailing list (Quartzcomposer-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com