AppleScript/xCode interface

Joined
Oct 13, 2013
Messages
1
Reaction score
0
Points
1
Hi,
I made an AppleScript code that changes some words in a document Pages. Now I want to make an interface for this script , but it fails to give order modify text the words, for exemple: word " nrcontract " for Pages Template with the text introduced by me in the head word of text.
Please help me to make it work
This is the script:

set NrContract to display dialog "Acest contract are numărul" default answer "A000001" with title "Număr Contract" buttons {"Next"} default button "Next"
set rasNrContract to result's text returned
------------------->
set {year:y, month:m, day:d} to (current date)
------------------->
set Sex to display dialog "Contractantul este de sex" with title "Sex" buttons {"Feminin", "Masculin"}
set rasSex to button returned of result
------------------->
set Nume to display dialog "Numele Contractantului" default answer "" with title "Numele Contreactantului" buttons {"Next"} default button "Next"
set rasNume to result's text returned
------------------->
set Judet to display dialog "Județ" default answer "" with title "Adresă" buttons {"Next"} default button "Next"
set rasJudet to result's text returned
------------------->
set Adresa to display dialog "Adresă" default answer "" with title "Adresă" buttons {"Next"} default button "Next"
set rasAdresa to result's text returned
------------------->
set SerieCI to display dialog "Seria Cărții de Identitate" default answer "MZ" with title "Identificare" buttons {"Next"} default button "Next"
set rasSerieCI to result's text returned

------------------->
set NrCI to display dialog "Număr CI" default answer "000000" with title "NrCI" buttons {"Next"} default button "Next"
set rasNrCI to result's text returned
------------------->
set Telefon to display dialog "Nr. telefon" default answer "" with title "Nr. telefon" buttons {"Next"} default button "Next"
set rasTelefon to result's text returned
------------------->
set Email to display dialog "Adresa de e-mail" default answer "" with title "e-mail" buttons {"Next"} default button "Next"
set rasEmail to result's text returned
------------------->
set Remuneratie to display dialog "Artistul va fi remunerat cu sumă fixă sau % din încasări" with title "Remunerație" buttons {"Sumă", "%"}
set rasRemuneratie to button returned of result
if rasRemuneratie = "%" then ------------->răspuns PROCENTE
set codProcent to display dialog "Care este procentul cu care Artistul va fi remunerat" default answer "" with title "Remunerație" buttons {"Next"} default button "Next"
set rascodProcent to result's text returned
else if rasRemuneratie = "Sumă" then ------------->răspuns SUMĂ FIXĂ
set codSuma to display dialog "Care este suma cu care Artistul va fi remunerat" default answer "" with title "Remunerație" buttons {"Next"} default button "Next"
set rascodSuma to result's text returned
end if
------------------->
------------------->
------------------->
------------------->

tell application "Pages"
activate
set thisDocument to ¬
make new document with properties {document template:template "Contract Prestări Artistice - Actor"}
tell thisDocument
tell body text
set (every word whose it = "codNrContract") to rasNrContract ------------------>Nr. Contact
set (every word whose it = "codDataCurentă") to ({d, ".", m, ".", y} as string) ------------------>Data
if rasSex = "Feminin" then ------------------>Dl/D-na
set (every word whose it is "codSex") to "D-na"
set (every word whose it is "codDomiciliat") to "domiciliată"
set (every word whose it is "codIdentificat") to "identificată"
set (every word whose it is "codNumit") to "numită"
else if rasSex = "Masculin" then
set (every word whose it is "codSex") to "Dl"
set (every word whose it is "codDomiciliat") to "domiciliat"
set (every word whose it is "codIdentificat") to "identificat"
set (every word whose it is "codNumit") to "numit"
end if
set (every word whose it = "codNume") to rasNume ------------------>Numele
set (every word whose it is "codJudeț") to rasJudet ------------------>Adresă județ
set (every word whose it is "codAdresă") to rasAdresa ------------------>Adresă completă
set (every word whose it = "codSerieCI") to rasSerieCI ------------------>Serie CI
set (every word whose it = "codNrCI") to rasNrCI ------------------>Nr. CI
set (every word whose it = "codTelefon") to rasTelefon ------------------>Telefon
set (every word whose it = "codEmail") to rasEmail ------------------>e-mail
------------------>Artist
------------------>Prestația
------------------>Proiectul
------------------> Remunerație
------------------> Fel remunerație
if rasRemuneratie = "%" then
set (every word whose it = "codProcent") to (rascodProcent & "%")
else if rasRemuneratie = "Sumă" then
set (every word whose it = "codSumăFixă") to (rascodSuma & "lei")
end if
end tell
end tell
end tell
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top