ERROR WITH USER ENTRY INFORMATION IN A DIALOG BOX
In this script the operator has to enter an order number. Next he is asked to enter picture number which correspond to the picture he wants to have a copy.
I am trying to minimal flexibility allowing the operator the change the order number before entering the picture number. Order number can be up to 6 digit long. Picture number are always maximum 4 number long. If a user wants to have three picture the operator can enter the three 4 digit number one after the other separated by a blank.
In doing a verification in case the Operator wants to change the Order number with the condition “if button… return” the script no longer work.
Does someone have an idea why?
Thanks!
Daniel
set theEVEclient to {}
set noFacture to ""
set theEVE to ""
repeat
try
if noFacture is equal to "" then
set noFacture to (the text returned of (display dialog "Please enter the order number" default button 2 default answer noFacture)) as string
end if
set theEVE to (the text returned of (display dialog "Please enter the picture number for order " & noFacture & " (i.e 1111 2222) :" buttons {"Change the order number", "OK"} default button 2 default answer theEVE)) as string -- each picture are only 4 character long
--if button returned of result is "Change the order number" then
-- set noFacture to ""
--else
-- display dialog "theEVE: " & theEVE
exit repeat
--end if
on error e number n
if n = -128 then -- user cancelled
display dialog "The operation was cancelled by the operator"
return
else if n = -1700 then -- integer coerce error
display dialog "Please re-enter the picture number" buttons {"Essayer à nouveau!"} default button 1 giving up after 2
end if
end try
end repeat
set theStart to 1
set theEnd to 4
repeat while (theEnd is less than or equal to length of theEVE)
set theEVEclient to theEVEclient & (text theStart thru theEnd of theEVE)
set theStart to theStart + 5
set theEnd to theEnd + 5
end repeat
repeat with valeur in theEVEclient
display dialog "Cévé: " & valeur
-- at this moment I am only displaying the information onto the monitor. Later on, the information contained in "valeur" will be written into a file as paragraphs. The order number will serve as the file name "noFacture".
end repeat