Wednesday, December 13, 2017

#1 2011-03-30 12:04:26 pm

airbuff
Member
Registered: 2008-10-01
Posts: 60

list variable not defined

Porting  a script from the AS Editor to AS Studio, I get a message:

count_productlist not defined


The script works fine in ASEditor though. Thanks to the help of Stefan, I got everythig running with different windows and progress bar big_smile.

In the beginning of the script, I define the list:

Applescript:

set product_list_for_links to {}

This list gets populated in runtime.

At the very end of the script, an index is created an the following code spits out the mentioned message:

Applescript:


set count_productlist to number of items of product_list_for_links
set products_per_collumn to count_productlist / 6

-> count_productlist not defined

Start to like AS Studio.

Thanx in advance,
a

Offline

 

#2 2011-03-30 03:53:51 pm

airbuff
Member
Registered: 2008-10-01
Posts: 60

Re: list variable not defined

Looks like ASS can´t handle

number of items of product_list_for_links


I have replaced it with:

Applescript:

repeat with i in product_list_for_links
set count_productlist to count_productlist + 1
end repeat

which is not very AS like but works fine for me.

Offline

 

#3 2011-03-30 03:58:03 pm

StefanK
Member
From:: St. Gallen, Switzerland
Registered: 2006-10-21
Posts: 11482
Website

Re: list variable not defined

airbuff wrote:

Looks like ASS can´t handle

number of items of product_list_for_links


in AppleScript number is a class containing a real or integer, not a verb.
The common syntax you need is

Applescript:


count items of product_list_for_links

Last edited by StefanK (2011-03-30 03:58:39 pm)


regards

Stefan

Offline

 

#4 2011-03-30 04:04:49 pm

airbuff
Member
Registered: 2008-10-01
Posts: 60

Re: list variable not defined

Thanx Stefan.
I´m curious. Do you know what would be more efficient, my loop or the count?

Thanks to your hints yesterday, the script runs like a charm now. I really appreciate it!

Offline

 

#5 2011-03-30 04:15:13 pm

StefanK
Member
From:: St. Gallen, Switzerland
Registered: 2006-10-21
Posts: 11482
Website

Re: list variable not defined

airbuff wrote:

Thanx Stefan.
I´m curious. Do you know what would be more efficient, my loop or the count?


Definitely count


regards

Stefan

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)