Look for prefix, if no match display alert.
Look for prefix, if no match display alert.
- Subject: Look for prefix, if no match display alert.
- From: Jan Bultereys <email@hidden>
- Date: Fri, 25 Aug 2006 17:27:59 +0200
- Thread-topic: Look for prefix, if no match display alert.
Title: Look for prefix, if no match display alert.
HI, does anyone knows how to make this shorter and faster?
Let me explain what it does and what I want:
If a page starts with GF1 then there should be ‘content’ in the page that has a GF1- prefix
If there is other content (prefix) like GF2, AF7, YF2 ...... Display it on screen.
This example is only covering a page that starts with GF1, of course I want to cover also GF2,GF3...AF1,YF3.... Pages
In a nutshell if a page starts with a certain ‘prefix’ (always the first 3 characters) the content should be the same meaning no other prefix is allowed IN the page....
I hope I was able to explain what I meant... :)
Example naming convention of the pages:
GF6F06-051
AFHF06-003
KF9F06-008
....
set source to choose folder
set source_list to list folder source without invisibles
--- PREFIX SETTER --
set prefixGF1 to "GF1"
set prefixGF2 to "GF2"
set prefixGF3 to "GF3"
set prefixGF4 to "GF4"
set prefixGF5 to "GF5"
set prefixGF6 to "GF6"
set prefixGF7 to "GF7"
set prefixGF8 to "GF8"
set prefixGF9 to "GF9"
set prefixAF1 to "AF1"
set prefixAF1 to "AF1"
set prefixAF2 to "AF2"
set prefixAF3 to "AF3"
set prefixAF4 to "AF4"
set prefixAF5 to "AF5"
set prefixAF6 to "AF6"
set prefixAF7 to "AF7"
set prefixAF8 to "AF8"
set prefixAF9 to "AF9"
set prefixAFD to "AFD"
set prefixAFH to "AFH"
set prefixAFN to "AFN"
set prefixYF1 to "YF1"
set prefixYF1 to "YF1"
set prefixYF2 to "YF2"
set prefixYF3 to "YF3"
set prefixYF4 to "YF4"
set prefixYF5 to "YF5"
set prefixYF6 to "YF6"
set prefixYF7 to "YF7"
set prefixYF8 to "YF8"
set prefixYF9 to "YF9"
set prefixYFD to "YFD"
set prefixYFH to "YFH"
set prefixYFN to "YFN"
set prefixKF1 to "KF1"
set prefixKF1 to "KF1"
set prefixKF2 to "KF2"
set prefixKF3 to "KF3"
set prefixKF4 to "KF4"
set prefixKF5 to "KF5"
set prefixKF6 to "KF6"
set prefixKF7 to "KF7"
set prefixKF8 to "KF8"
set prefixKF9 to "KF9"
set prefixKFD to "KFD"
set prefixKFH to "KFH"
set prefixKFN to "KFN"
---- END PRFIX SETTER ---
repeat with anyfile in source_list
set anyfile2 to source & anyfile as text
set anyfile2_string to anyfile as text
tell application "QuarkXPress Passport"
activate
open file anyfile2
tell document 1
tell every text box
-- START GF1 --
if anyfile2_string starts with "GF1" then
try
set counterGF2 to count (every word where it = prefixGF2)
if counterGF2 ≥ 1 then
display dialog "JE HEBT " & counterGF2 & " GF2 PREFIX(EN) OP PAGINA " & anyfile2_string & " "
end if
end try
try
set counterGF3 to count (every word where it = prefixGF3)
if counterGF3 ≥ 1 then
display dialog "JE HEBT " & counterGF3 & " GF3 PREFIX(EN) OP PAGINA " & anyfile2_string & " "
end if
end try
try
set counterGF4 to count (every word where it = prefixGF4)
if counterGF4 ≥ 1 then
display dialog "JE HEBT " & counterGF4 & " GF4 PREFIX(EN) OP PAGINA " & anyfile2_string & " "
end if
end try
try
set counterGF5 to count (every word where it = prefixGF5)
if counterGF5 ≥ 1 then
display dialog "JE HEBT " & counterGF5 & " GF5 PREFIX(EN) OP PAGINA " & anyfile2_string & " "
end if
end try
try
set counterGF6 to count (every word where it = prefixGF6)
if counterGF6 ≥ 1 then
display dialog "JE HEBT " & counterGF6 & " GF6 PREFIX(EN) OP PAGINA " & anyfile2_string & " "
end if
end try
try
set counterGF7 to count (every word where it = prefixGF7)
if counterGF7 ≥ 1 then
display dialog "JE HEBT " & counterGF7 & " GF7 PREFIX(EN) OP PAGINA " & anyfile2_string & " "
end if
end try
try
set counterGF8 to count (every word where it = prefixGF8)
if counterGF8 ≥ 1 then
display dialog "JE HEBT " & counterGF8 & " GF8 PREFIX(EN) OP PAGINA " & anyfile2_string & " "
end if
end try
try
set counterGF9 to count (every word where it = prefixGF9)
if counterGF9 ≥ 1 then
display dialog "JE HEBT " & counterGF9 & " GF9 PREFIX(EN) OP PAGINA " & anyfile2_string & " "
end if
end try
--- EINDE FOUTE G-PREFIXEN ---
--- START FOUTE A-PREFIXEN ---
try
set counterAF1 to count (every word where it = prefixAF1)
if counterAF1 ≥ 1 then
display dialog "JE HEBT " & counterAF1 & " AF1 PREFIX(EN) OP PAGINA " & anyfile2_string & " "
end if
end try
try
set counterAF2 to count (every word where it = prefixAF2)
if counterAF2 ≥ 1 then
display dialog "JE HEBT " & counterAF2 & " AF2 PREFIX(EN) OP PAGINA " & anyfile2_string & " "
end if
end try
try
set counterAF3 to count (every word where it = prefixAF3)
if counterAF3 ≥ 1 then
display dialog "JE HEBT " & counterAF3 & " AF3 PREFIX(EN) OP PAGINA " & anyfile2_string & " "
end if
end try
try
set counterAF4 to count (every word where it = prefixAF4)
if counterAF4 ≥ 1 then
display dialog "JE HEBT " & counterAF4 & " AF4 PREFIX(EN) OP PAGINA " & anyfile2_string & " "
end if
end try
try
set counterAF5 to count (every word where it = prefixAF5)
if counterAF5 ≥ 1 then
display dialog "JE HEBT " & counterAF5 & " AF5 PREFIX(EN) OP PAGINA " & anyfile2_string & " "
end if
end try
try
set counterAF6 to count (every word where it = prefixAF6)
if counterAF6 ≥ 1 then
display dialog "JE HEBT " & counterAF6 & " AF6 PREFIX(EN) OP PAGINA " & anyfile2_string & " "
end if
end try
try
set counterAF7 to count (every word where it = prefixAF7)
if counterAF7 ≥ 1 then
display dialog "JE HEBT " & counterAF7 & " AF7 PREFIX(EN) OP PAGINA " & anyfile2_string & " "
end if
end try
try
set counterAF8 to count (every word where it = prefixAF8)
if counterAF8 ≥ 1 then
display dialog "JE HEBT " & counterAF8 & " AF8 PREFIX(EN) OP PAGINA " & anyfile2_string & " "
end if
end try
try
set counterAF9 to count (every word where it = prefixAF9)
if counterAF9 ≥ 1 then
display dialog "JE HEBT " & counterAF9 & " AF9 PREFIX(EN) OP PAGINA " & anyfile2_string & " "
end if
end try
try
set counterAFD to count (every word where it = prefixAFD)
if counterAFD ≥ 1 then
display dialog "JE HEBT " & counterAFD & " AFD PREFIX(EN) OP PAGINA " & anyfile2_string & " "
end if
end try
try
set counterAFH to count (every word where it = prefixAFH)
if counterAFH ≥ 1 then
display dialog "JE HEBT " & counterAFH & " AFH PREFIX(EN) OP PAGINA " & anyfile2_string & " "
end if
end try
try
set counterAFN to count (every word where it = prefixAFN)
if counterAFN ≥ 1 then
display dialog "JE HEBT " & counterAFN & " AFN PREFIX(EN) OP PAGINA " & anyfile2_string & " "
end if
end try
--- EINDE FOUTE A-PREFIXEN ---
--- START FOUTE Y-PREFIXEN ---
try
set counterYF1 to count (every word where it = prefixYF1)
if counterYF1 ≥ 1 then
display dialog "JE HEBT " & counterYF1 & " YF1 PREFIX(EN) OP PAGINA " & anyfile2_string & " "
end if
end try
try
set counterYF2 to count (every word where it = prefixYF2)
if counterYF2 ≥ 1 then
display dialog "JE HEBT " & counterYF2 & " YF2 PREFIX(EN) OP PAGINA " & anyfile2_string & " "
end if
end try
try
set counterYF3 to count (every word where it = prefixYF3)
if counterYF3 ≥ 1 then
display dialog "JE HEBT " & counterYF3 & " YF3 PREFIX(EN) OP PAGINA " & anyfile2_string & " "
end if
end try
try
set counterYF4 to count (every word where it = prefixYF4)
if counterYF4 ≥ 1 then
display dialog "JE HEBT " & counterYF4 & " YF4 PREFIX(EN) OP PAGINA " & anyfile2_string & " "
end if
end try
try
set counterYF5 to count (every word where it = prefixYF5)
if counterYF5 ≥ 1 then
display dialog "JE HEBT " & counterYF5 & " YF5 PREFIX(EN) OP PAGINA " & anyfile2_string & " "
end if
end try
try
set counterYF6 to count (every word where it = prefixYF6)
if counterYF6 ≥ 1 then
display dialog "JE HEBT " & counterYF6 & " YF6 PREFIX(EN) OP PAGINA " & anyfile2_string & " "
end if
end try
try
set counterYF7 to count (every word where it = prefixYF7)
if counterYF7 ≥ 1 then
display dialog "JE HEBT " & counterYF7 & " YF7 PREFIX(EN) OP PAGINA " & anyfile2_string & " "
end if
end try
try
set counterYF8 to count (every word where it = prefixYF8)
if counterYF8 ≥ 1 then
display dialog "JE HEBT " & counterYF8 & " YF8 PREFIX(EN) OP PAGINA " & anyfile2_string & " "
end if
end try
try
set counterYF9 to count (every word where it = prefixYF9)
if counterYF9 ≥ 1 then
display dialog "JE HEBT " & counterYF9 & " YF9 PREFIX(EN) OP PAGINA " & anyfile2_string & " "
end if
end try
try
set counterYFD to count (every word where it = prefixYFD)
if counterYFD ≥ 1 then
display dialog "JE HEBT " & counterYFD & " YFD PREFIX(EN) OP PAGINA " & anyfile2_string & " "
end if
end try
try
set counterYFH to count (every word where it = prefixYFH)
if counterYFH ≥ 1 then
display dialog "JE HEBT " & counterYFH & " YFH PREFIX(EN) OP PAGINA " & anyfile2_string & " "
end if
end try
try
set counterYFN to count (every word where it = prefixYFN)
if counterYFN ≥ 1 then
display dialog "JE HEBT " & counterYFN & " YFN PREFIX(EN) OP PAGINA " & anyfile2_string & " "
end if
end try
--- EINDE FOUTE Y-PREFIXEN ---
--- START FOUTE K-PREFIXEN ---
try
set counterKF1 to count (every word where it = prefixKF1)
if counterKF1 ≥ 1 then
display dialog "JE HEBT " & counterKF1 & " KF1 PREFIX(EN) OP PAGINA " & anyfile2_string & " "
end if
end try
try
set counterKF2 to count (every word where it = prefixKF2)
if counterKF2 ≥ 1 then
display dialog "JE HEBT " & counterKF2 & " KF2 PREFIX(EN) OP PAGINA " & anyfile2_string & " "
end if
end try
try
set counterKF3 to count (every word where it = prefixKF3)
if counterKF3 ≥ 1 then
display dialog "JE HEBT " & counterKF3 & " KF3 PREFIX(EN) OP PAGINA " & anyfile2_string & " "
end if
end try
try
set counterKF4 to count (every word where it = prefixKF4)
if counterKF4 ≥ 1 then
display dialog "JE HEBT " & counterKF4 & " KF4 PREFIX(EN) OP PAGINA " & anyfile2_string & " "
end if
end try
try
set counterKF5 to count (every word where it = prefixKF5)
if counterKF5 ≥ 1 then
display dialog "JE HEBT " & counterKF5 & " KF5 PREFIX(EN) OP PAGINA " & anyfile2_string & " "
end if
end try
try
set counterKF6 to count (every word where it = prefixKF6)
if counterKF6 ≥ 1 then
display dialog "JE HEBT " & counterKF6 & " KF6 PREFIX(EN) OP PAGINA " & anyfile2_string & " "
end if
end try
try
set counterKF7 to count (every word where it = prefixKF7)
if counterKF7 ≥ 1 then
display dialog "JE HEBT " & counterKF7 & " KF7 PREFIX(EN) OP PAGINA " & anyfile2_string & " "
end if
end try
try
set counterKF8 to count (every word where it = prefixKF8)
if counterKF8 ≥ 1 then
display dialog "JE HEBT " & counterKF8 & " KF8 PREFIX(EN) OP PAGINA " & anyfile2_string & " "
end if
end try
try
set counterKF9 to count (every word where it = prefixKF9)
if counterKF9 ≥ 1 then
display dialog "JE HEBT " & counterKF9 & " KF9 PREFIX(EN) OP PAGINA " & anyfile2_string & " "
end if
end try
try
set counterKFD to count (every word where it = prefixKFD)
if counterKFD ≥ 1 then
display dialog "JE HEBT " & counterKFD & " KFD PREFIX(EN) OP PAGINA " & anyfile2_string & " "
end if
end try
try
set counterKFH to count (every word where it = prefixKFH)
if counterKFH ≥ 1 then
display dialog "JE HEBT " & counterKFH & " KFH PREFIX(EN) OP PAGINA " & anyfile2_string & " "
end if
end try
try
set counterKFN to count (every word where it = prefixKFN)
if counterKFN ≥ 1 then
display dialog "JE HEBT " & counterKFN & " KFN PREFIX(EN) OP PAGINA " & anyfile2_string & " "
end if
end try
--- EINDE FOUTE K-PREFIXEN ---
end if
-- END GF1 --
end tell
end tell
try
close document anyfile2_string without saving
end try
end tell
end repeat
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden