Hi,
I have a problem I want to get to know if there is one special item in a list. If there is an 8 in Mylist.
I tried many many ways to solve it but I don’t succed.
Please help me.
MArcel
Hi,
a check if a list contains a certain value is quite easy
set myList to {1, 2, 3, 4, 5, 6, 7, 8}
myList contains 10 --> false
-- or
8 is in myList --> true
Hi,
this was a helpfull advice thank you for this, but is there a way with a if-function?
Of course it is
set value to 10
set myList to {1, 2, 5, 7, 10, 13, 20}
repeat with i from 1 to count myList
if item i of myList is value then
exit repeat
end if
end repeat
display dialog (value as text) & " is at position " & i & " in mylist"
Hi,
I am sorry, but it does not work how I want it to do.
Here is my plan: I have a line there are text fields from A1 to A9.
Here I get the values of each text field. For the example I chose the text field A1.
set A1 to float value of text field "A1" of window "Cracker"
Then I make a list:
set A_line to {A1 & A2 & A3 & A4 & A5 & A6 & A7 & A8 & A9}
And now I want to make a list with a value with are in the list. For example A3=5 A5=9 A8=1.
This list should save all value which are in the list A_line. In the end I want to choose A1 with the procedur in Sudoku.
May you can help me.
Marcel
first of all: you should post topics concerning AppleScript Studio into the Xcode forum
this creates a list of the 9 values in the text fields A1 thru A9
set A_line to {}
repeat with i from 1 to 9
set end of A_line to integer value of text field ("A" & i) of window "Cracker"
end repeat
A_line
the script uses integer value or does Sudoku work also with fractions?