Hello,
I am trying to shorten my script by putting steps which are frequently executed in a subroutine. The line of code founded between —**** are being executed at multiple places within the applescript program.
There are two values being passed and their value LigneKeynote and ItemNo. Those variables are used within the subroutines and their new values are to be returned with variable retLigneKeynote and retItemNo.
I do not have any problems in passing the values to the subroutine. However, return it back does not work. Is there a way to return two variables values within a subroutine.
Regards!
set retligneKeynote to 0
set ligneKeynote to 0
set retItemNo to 0
set itemNo to 0
set i to ligneKeynote + 1
repeat while i < 9
my setperformer(ligneKeynote, itemNo)
---****
--set ligneKeynote to ligneKeynote + 1
--set ItemNo to ItemNo + 1
--display dialog "PERFORMER RowInfo: " & RowInfo & " eveTYPE: " & eveTYPE & " ligneKeynote: " & ligneKeynote & " ItemNo: " & ItemNo
--tell text item ItemNo of current slide
-- set tt to its object text
-- set tt to my replaceTxt(tt, "Performer" & ligneKeynote & "$$", "")
-- set its object text to tt
--end tell
--set ItemNo to ItemNo + 1
--display dialog "REGION RowInfo: " & RowInfo & " eveTYPE: " & eveTYPE & " ligneKeynote: " & ligneKeynote & " ItemNo: " & ItemNo
--tell text item ItemNo of current slide
-- set tt to its object text
-- set tt to my replaceTxt(tt, "Region" & ligneKeynote & "$$", " ")
-- set its object text to tt
--end tell
---****
set i to i + 1
end repeat
to setperformer(ligneKeynote, itemNo)
tell application "Keynote"
tell front document
set ligneKeynote to ligneKeynote + 1
set itemNo to itemNo + 1
display dialog "PERFORMER RowInfo: " & RowInfo & " eveTYPE: " & eveTYPE & " ligneKeynote: " & ligneKeynote & " ItemNo: " & itemNo
tell text item itemNo of current slide
set tt to its object text
set tt to my replaceTxt(tt, "Performer" & ligneKeynote & "$$", "")
set its object text to tt
end tell
set itemNo to itemNo + 1
display dialog "REGION RowInfo: " & RowInfo & " eveTYPE: " & eveTYPE & " ligneKeynote: " & ligneKeynote & " ItemNo: " & itemNo
tell text item itemNo of current slide
set tt to its object text
set tt to my replaceTxt(tt, "Region" & ligneKeynote & "$$", " ")
set its object text to tt
return {retligneKeynote, retitemNo}
end tell
end tell
end tell
end setperformer
-- Substituing text in a keynote slide
to replaceTxt(tt, f, r)
--display dialog "tt: " & tt & " f: " & f & " r: " & r
set AppleScript's text item delimiters to f
set tt to tt's text items
set AppleScript's text item delimiters to r
set tt to tt's text items as text
set AppleScript's text item delimiters to ""
return tt
end replaceTxt