Forums
New posts
Articles
Product Reviews
Policies
FAQ
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Menu
Log in
Register
Install the app
Install
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
AppleScript/xCode interface
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="sagaeu" data-source="post: 1674603" data-attributes="member: 312666"><p>Hi,</p><p>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.</p><p>Please help me to make it work </p><p>This is the script:</p><p></p><p>set NrContract to display dialog "Acest contract are numărul" default answer "A000001" with title "Număr Contract" buttons {"Next"} default button "Next"</p><p>set rasNrContract to result's text returned</p><p>-------------------></p><p>set {year:y, month:m, day:d} to (current date)</p><p>-------------------></p><p>set Sex to display dialog "Contractantul este de sex" with title "Sex" buttons {"Feminin", "Masculin"}</p><p>set rasSex to button returned of result</p><p>-------------------></p><p>set Nume to display dialog "Numele Contractantului" default answer "" with title "Numele Contreactantului" buttons {"Next"} default button "Next"</p><p>set rasNume to result's text returned</p><p>-------------------></p><p>set Judet to display dialog "Județ" default answer "" with title "Adresă" buttons {"Next"} default button "Next"</p><p>set rasJudet to result's text returned</p><p>-------------------></p><p>set Adresa to display dialog "Adresă" default answer "" with title "Adresă" buttons {"Next"} default button "Next"</p><p>set rasAdresa to result's text returned</p><p>-------------------></p><p>set SerieCI to display dialog "Seria Cărții de Identitate" default answer "MZ" with title "Identificare" buttons {"Next"} default button "Next"</p><p>set rasSerieCI to result's text returned</p><p></p><p>-------------------></p><p>set NrCI to display dialog "Număr CI" default answer "000000" with title "NrCI" buttons {"Next"} default button "Next"</p><p>set rasNrCI to result's text returned</p><p>-------------------></p><p>set Telefon to display dialog "Nr. telefon" default answer "" with title "Nr. telefon" buttons {"Next"} default button "Next"</p><p>set rasTelefon to result's text returned</p><p>-------------------></p><p>set Email to display dialog "Adresa de e-mail" default answer "" with title "e-mail" buttons {"Next"} default button "Next"</p><p>set rasEmail to result's text returned</p><p>-------------------></p><p>set Remuneratie to display dialog "Artistul va fi remunerat cu sumă fixă sau % din încasări" with title "Remunerație" buttons {"Sumă", "%"}</p><p>set rasRemuneratie to button returned of result</p><p>if rasRemuneratie = "%" then ------------->răspuns PROCENTE</p><p> 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"</p><p> set rascodProcent to result's text returned</p><p>else if rasRemuneratie = "Sumă" then ------------->răspuns SUMĂ FIXĂ</p><p> 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"</p><p> set rascodSuma to result's text returned</p><p>end if</p><p>-------------------></p><p>-------------------></p><p>-------------------></p><p>-------------------></p><p></p><p>tell application "Pages"</p><p> activate</p><p> set thisDocument to ¬</p><p> make new document with properties {document template:template "Contract Prestări Artistice - Actor"}</p><p> tell thisDocument</p><p> tell body text</p><p> set (every word whose it = "codNrContract") to rasNrContract ------------------>Nr. Contact</p><p> set (every word whose it = "codDataCurentă") to ({d, ".", m, ".", y} as string) ------------------>Data</p><p> if rasSex = "Feminin" then ------------------>Dl/D-na</p><p> set (every word whose it is "codSex") to "D-na"</p><p> set (every word whose it is "codDomiciliat") to "domiciliată"</p><p> set (every word whose it is "codIdentificat") to "identificată"</p><p> set (every word whose it is "codNumit") to "numită"</p><p> else if rasSex = "Masculin" then</p><p> set (every word whose it is "codSex") to "Dl"</p><p> set (every word whose it is "codDomiciliat") to "domiciliat"</p><p> set (every word whose it is "codIdentificat") to "identificat"</p><p> set (every word whose it is "codNumit") to "numit"</p><p> end if</p><p> set (every word whose it = "codNume") to rasNume ------------------>Numele</p><p> set (every word whose it is "codJudeț") to rasJudet ------------------>Adresă județ</p><p> set (every word whose it is "codAdresă") to rasAdresa ------------------>Adresă completă</p><p> set (every word whose it = "codSerieCI") to rasSerieCI ------------------>Serie CI</p><p> set (every word whose it = "codNrCI") to rasNrCI ------------------>Nr. CI</p><p> set (every word whose it = "codTelefon") to rasTelefon ------------------>Telefon</p><p> set (every word whose it = "codEmail") to rasEmail ------------------>e-mail</p><p> ------------------>Artist</p><p> ------------------>Prestația</p><p> ------------------>Proiectul</p><p> ------------------> Remunerație</p><p> ------------------> Fel remunerație</p><p> if rasRemuneratie = "%" then</p><p> set (every word whose it = "codProcent") to (rascodProcent & "%")</p><p> else if rasRemuneratie = "Sumă" then</p><p> set (every word whose it = "codSumăFixă") to (rascodSuma & "lei")</p><p> end if</p><p> end tell</p><p> end tell</p><p>end tell</p></blockquote><p></p>
[QUOTE="sagaeu, post: 1674603, member: 312666"] 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 [/QUOTE]
Verification
Post reply
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
AppleScript/xCode interface
Top