https://neowiki.neooffice.org/index.php?title=ClipArt_Code&action=history&feed=atomClipArt Code - Revision history2024-03-28T19:52:01ZRevision history for this page on the wikiMediaWiki 1.10.1https://neowiki.neooffice.org/index.php?title=ClipArt_Code&diff=6323&oldid=prevJake: updating to V0.1 a3 code2006-08-06T21:22:49Z<p>updating to V0.1 a3 code</p>
<table border='0' width='98%' cellpadding='0' cellspacing='4' style="background-color: white;">
<tr>
<td colspan='2' width='50%' align='center' style="background-color: white;">←Older revision</td>
<td colspan='2' width='50%' align='center' style="background-color: white;">Revision as of 21:22, 6 August 2006</td>
</tr>
<tr><td colspan="2" align="left"><strong>Line 7:</strong></td>
<td colspan="2" align="left"><strong>Line 7:</strong></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">-- this will install a folder into the 'gallery' of OO.o</td><td> </td><td style="background: #eee; font-size: smaller;">-- this will install a folder into the 'gallery' of OO.o</td></tr>
<tr><td colspan="2"> </td><td>+</td><td style="background: #cfc; font-size: smaller;">-- Version 0.1 a.3 -6 August 2006</td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">on run</td><td> </td><td style="background: #eee; font-size: smaller;">on run</td></tr>
<tr><td colspan="2" align="left"><strong>Line 17:</strong></td>
<td colspan="2" align="left"><strong>Line 18:</strong></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">end idle</td><td> </td><td style="background: #eee; font-size: smaller;">end idle</td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr>
<tr><td colspan="2"> </td><td>+</td><td style="background: #cfc; font-size: smaller;">-- the list of file types which will be processed</td></tr>
<tr><td colspan="2"> </td><td>+</td><td style="background: #cfc; font-size: smaller;">-- eg: {"PICT", "JPEG", "TIFF", "GIFf"}</td></tr>
<tr><td colspan="2"> </td><td>+</td><td style="background: #cfc; font-size: smaller;">property type_list : {"ZIP"}</td></tr>
<tr><td colspan="2"> </td><td>+</td><td style="background: #cfc; font-size: smaller;">-- since file types are optional in Mac OS X,</td></tr>
<tr><td colspan="2"> </td><td>+</td><td style="background: #cfc; font-size: smaller;">-- check the name extension if there is no file type</td></tr>
<tr><td colspan="2"> </td><td>+</td><td style="background: #cfc; font-size: smaller;">-- NOTE: do not use periods (.) with the items in the name extensions list</td></tr>
<tr><td colspan="2"> </td><td>+</td><td style="background: #cfc; font-size: smaller;">-- eg: {"txt", "text", "jpg", "jpeg"}, NOT: {".txt", ".text", ".jpg", ".jpeg"}</td></tr>
<tr><td colspan="2"> </td><td>+</td><td style="background: #cfc; font-size: smaller;">property extension_list : {"zip"}</td></tr>
<tr><td colspan="2"> </td><td>+</td><td style="background: #cfc; font-size: smaller;"></td></tr>
<tr><td colspan="2"> </td><td>+</td><td style="background: #cfc; font-size: smaller;">-- This droplet processes files dropped onto the applet</td></tr>
<tr><td colspan="2"> </td><td>+</td><td style="background: #cfc; font-size: smaller;">-- checks file type, only processes ZIP files</td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">on open names</td><td> </td><td style="background: #eee; font-size: smaller;">on open names</td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;"> checkPref()</td><td> </td><td style="background: #eee; font-size: smaller;"> checkPref()</td></tr>
<tr><td>-</td><td style="background: #ffa; font-size: smaller;"> <del style="color: red; font-weight: bold; text-decoration: none;">openFiles</del>(names)</td><td>+</td><td style="background: #cfc; font-size: smaller;"> <ins style="color: red; font-weight: bold; text-decoration: none;">openTheseItems</ins>(names)</td></tr>
<tr><td>-</td><td style="background: #ffa; font-size: smaller;"><del style="color: red; font-weight: bold; text-decoration: none;"> display dialog "You have installed " & names & "!"</del></td><td>+</td><td style="background: #cfc; font-size: smaller;"></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;"> quit</td><td> </td><td style="background: #eee; font-size: smaller;"> quit</td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">end open</td><td> </td><td style="background: #eee; font-size: smaller;">end open</td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">---- subroutines ----</td><td> </td><td style="background: #eee; font-size: smaller;">---- subroutines ----</td></tr>
<tr><td colspan="2"> </td><td>+</td><td style="background: #cfc; font-size: smaller;"></td></tr>
<tr><td colspan="2"> </td><td>+</td><td style="background: #cfc; font-size: smaller;">-- openTheseItems</td></tr>
<tr><td colspan="2"> </td><td>+</td><td style="background: #cfc; font-size: smaller;">-- goes through each to make sure they are .zip files</td></tr>
<tr><td colspan="2"> </td><td>+</td><td style="background: #cfc; font-size: smaller;">-- processes the zip files</td></tr>
<tr><td colspan="2"> </td><td>+</td><td style="background: #cfc; font-size: smaller;"></td></tr>
<tr><td colspan="2"> </td><td>+</td><td style="background: #cfc; font-size: smaller;">on openTheseItems(these_items)</td></tr>
<tr><td colspan="2"> </td><td>+</td><td style="background: #cfc; font-size: smaller;"> repeat with i from 1 to the count of these_items</td></tr>
<tr><td colspan="2"> </td><td>+</td><td style="background: #cfc; font-size: smaller;"> set this_item to item i of these_items</td></tr>
<tr><td colspan="2"> </td><td>+</td><td style="background: #cfc; font-size: smaller;"> set the item_info to info for this_item</td></tr>
<tr><td colspan="2"> </td><td>+</td><td style="background: #cfc; font-size: smaller;"> if (folder of the item_info is false) and ¬</td></tr>
<tr><td colspan="2"> </td><td>+</td><td style="background: #cfc; font-size: smaller;"> (alias of the item_info is false) and ¬</td></tr>
<tr><td colspan="2"> </td><td>+</td><td style="background: #cfc; font-size: smaller;"> ((the file type of the item_info is in the type_list) or the name extension of the item_info is in the extension_list) then</td></tr>
<tr><td colspan="2"> </td><td>+</td><td style="background: #cfc; font-size: smaller;"> set theFilePath to " \"" & (POSIX path of this_item) & "\""</td></tr>
<tr><td colspan="2"> </td><td>+</td><td style="background: #cfc; font-size: smaller;"> set theFileInfo to (info for this_item)</td></tr>
<tr><td colspan="2"> </td><td>+</td><td style="background: #cfc; font-size: smaller;"> unzipFile(theFilePath)</td></tr>
<tr><td colspan="2"> </td><td>+</td><td style="background: #cfc; font-size: smaller;"> display dialog "You have installed " & this_item & "!"</td></tr>
<tr><td colspan="2"> </td><td>+</td><td style="background: #cfc; font-size: smaller;"> else</td></tr>
<tr><td colspan="2"> </td><td>+</td><td style="background: #cfc; font-size: smaller;"> display dialog (this_item as text) & " is not a ZIP file"</td></tr>
<tr><td colspan="2"> </td><td>+</td><td style="background: #cfc; font-size: smaller;"> end if</td></tr>
<tr><td colspan="2"> </td><td>+</td><td style="background: #cfc; font-size: smaller;"> end repeat</td></tr>
<tr><td colspan="2"> </td><td>+</td><td style="background: #cfc; font-size: smaller;"> </td></tr>
<tr><td colspan="2"> </td><td>+</td><td style="background: #cfc; font-size: smaller;">end openTheseItems</td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">-- unzipFile</td><td> </td><td style="background: #eee; font-size: smaller;">-- unzipFile</td></tr>
<tr><td colspan="2" align="left"><strong>Line 32:</strong></td>
<td colspan="2" align="left"><strong>Line 65:</strong></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;"> </td><td> </td><td style="background: #eee; font-size: smaller;"> </td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;"> set gallery to pathToGallery()</td><td> </td><td style="background: #eee; font-size: smaller;"> set gallery to pathToGallery()</td></tr>
<tr><td>-</td><td style="background: #ffa; font-size: smaller;"> display dialog gallery</td><td>+</td><td style="background: #cfc; font-size: smaller;"> <ins style="color: red; font-weight: bold; text-decoration: none;">--</ins>display dialog gallery</td></tr>
<tr><td>-</td><td style="background: #ffa; font-size: smaller;"> display dialog f</td><td>+</td><td style="background: #cfc; font-size: smaller;"> <ins style="color: red; font-weight: bold; text-decoration: none;">--</ins>display dialog f</td></tr>
<tr><td>-</td><td style="background: #ffa; font-size: smaller;"> set thisscript to "unzip " & f & " -d " & gallery</td><td>+</td><td style="background: #cfc; font-size: smaller;"> set thisscript to "unzip <ins style="color: red; font-weight: bold; text-decoration: none;">-o </ins>" & f & " -d " & gallery</td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;"> --set rmscript to "rm -r" & gallery & "/__MACOSX"</td><td> </td><td style="background: #eee; font-size: smaller;"> --set rmscript to "rm -r" & gallery & "/__MACOSX"</td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;"> do shell script thisscript with administrator privileges</td><td> </td><td style="background: #eee; font-size: smaller;"> do shell script thisscript with administrator privileges</td></tr>
<tr><td colspan="2" align="left"><strong>Line 66:</strong></td>
<td colspan="2" align="left"><strong>Line 99:</strong></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;"> return m</td><td> </td><td style="background: #eee; font-size: smaller;"> return m</td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">end pathToGallery</td><td> </td><td style="background: #eee; font-size: smaller;">end pathToGallery</td></tr>
<tr><td>-</td><td style="background: #ffa; font-size: smaller;"></td><td colspan="2"> </td></tr>
<tr><td>-</td><td style="background: #ffa; font-size: smaller;">-- openFiles</td><td colspan="2"> </td></tr>
<tr><td>-</td><td style="background: #ffa; font-size: smaller;">-- taken from openoffice.org.app applescript LPGL</td><td colspan="2"> </td></tr>
<tr><td>-</td><td style="background: #ffa; font-size: smaller;">-- goes through any dropped files and addes them to the gallery</td><td colspan="2"> </td></tr>
<tr><td>-</td><td style="background: #ffa; font-size: smaller;"></td><td colspan="2"> </td></tr>
<tr><td>-</td><td style="background: #ffa; font-size: smaller;">on openFiles(fileList)</td><td colspan="2"> </td></tr>
<tr><td>-</td><td style="background: #ffa; font-size: smaller;"> if (count of fileList) > 0 then</td><td colspan="2"> </td></tr>
<tr><td>-</td><td style="background: #ffa; font-size: smaller;"> repeat with i from 1 to the count of fileList</td><td colspan="2"> </td></tr>
<tr><td>-</td><td style="background: #ffa; font-size: smaller;"> set theDocument to (item i of fileList)</td><td colspan="2"> </td></tr>
<tr><td>-</td><td style="background: #ffa; font-size: smaller;"> set theFilePath to " \"" & (POSIX path of theDocument) & "\""</td><td colspan="2"> </td></tr>
<tr><td>-</td><td style="background: #ffa; font-size: smaller;"> set theFileInfo to (info for theDocument)</td><td colspan="2"> </td></tr>
<tr><td>-</td><td style="background: #ffa; font-size: smaller;"> unzipFile(theFilePath)</td><td colspan="2"> </td></tr>
<tr><td>-</td><td style="background: #ffa; font-size: smaller;"> end repeat</td><td colspan="2"> </td></tr>
<tr><td>-</td><td style="background: #ffa; font-size: smaller;"> end if</td><td colspan="2"> </td></tr>
<tr><td>-</td><td style="background: #ffa; font-size: smaller;">end openFiles</td><td colspan="2"> </td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">-- getZipNames</td><td> </td><td style="background: #eee; font-size: smaller;">-- getZipNames</td></tr>
<tr><td colspan="2" align="left"><strong>Line 126:</strong></td>
<td colspan="2" align="left"><strong>Line 144:</strong></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">on writePref(t)</td><td> </td><td style="background: #eee; font-size: smaller;">on writePref(t)</td></tr>
<tr><td>-</td><td style="background: #ffa; font-size: smaller;"> display dialog t</td><td colspan="2"> </td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;"> set officePref2 to (((path to me) as text) & "Contents:Resources:pref.txt")</td><td> </td><td style="background: #eee; font-size: smaller;"> set officePref2 to (((path to me) as text) & "Contents:Resources:pref.txt")</td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;"> set officePref2 to officePref2 as alias</td><td> </td><td style="background: #eee; font-size: smaller;"> set officePref2 to officePref2 as alias</td></tr>
<tr><td colspan="2" align="left"><strong>Line 133:</strong></td>
<td colspan="2" align="left"><strong>Line 150:</strong></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;"> write t to prefFile</td><td> </td><td style="background: #eee; font-size: smaller;"> write t to prefFile</td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;"> close access officePref2</td><td> </td><td style="background: #eee; font-size: smaller;"> close access officePref2</td></tr>
<tr><td colspan="2"> </td><td>+</td><td style="background: #cfc; font-size: smaller;"> display dialog "You have set your preference to: " & t</td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;"> return true</td><td> </td><td style="background: #eee; font-size: smaller;"> return true</td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">end writePref</td><td> </td><td style="background: #eee; font-size: smaller;">end writePref</td></tr>
<tr><td colspan="2" align="left"><strong>Line 150:</strong></td>
<td colspan="2" align="left"><strong>Line 168:</strong></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;"> end if</td><td> </td><td style="background: #eee; font-size: smaller;"> end if</td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">end checkPref</td><td> </td><td style="background: #eee; font-size: smaller;">end checkPref</td></tr>
<tr><td colspan="2"> </td><td>+</td><td style="background: #cfc; font-size: smaller;"></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;"></pre></td><td> </td><td style="background: #eee; font-size: smaller;"></pre></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;">[[Category:NeoOffice]][[Category:Contributing]]</td><td> </td><td style="background: #eee; font-size: smaller;">[[Category:NeoOffice]][[Category:Contributing]]</td></tr>
</table>Jakehttps://neowiki.neooffice.org/index.php?title=ClipArt_Code&diff=6032&oldid=prevSardisson: categories2006-08-04T05:24:47Z<p>categories</p>
<table border='0' width='98%' cellpadding='0' cellspacing='4' style="background-color: white;">
<tr>
<td colspan='2' width='50%' align='center' style="background-color: white;">←Older revision</td>
<td colspan='2' width='50%' align='center' style="background-color: white;">Revision as of 05:24, 4 August 2006</td>
</tr>
<tr><td colspan="2" align="left"><strong>Line 152:</strong></td>
<td colspan="2" align="left"><strong>Line 152:</strong></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;"></pre></td><td> </td><td style="background: #eee; font-size: smaller;"></pre></td></tr>
<tr><td colspan="2"> </td><td>+</td><td style="background: #cfc; font-size: smaller;">[[Category:NeoOffice]][[Category:Contributing]]</td></tr>
</table>Sardissonhttps://neowiki.neooffice.org/index.php?title=ClipArt_Code&diff=6003&oldid=prevJake: added quoted forms2006-08-04T02:41:15Z<p>added quoted forms</p>
<table border='0' width='98%' cellpadding='0' cellspacing='4' style="background-color: white;">
<tr>
<td colspan='2' width='50%' align='center' style="background-color: white;">←Older revision</td>
<td colspan='2' width='50%' align='center' style="background-color: white;">Revision as of 02:41, 4 August 2006</td>
</tr>
<tr><td colspan="2" align="left"><strong>Line 57:</strong></td>
<td colspan="2" align="left"><strong>Line 57:</strong></td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;"> -- if statement to decide Neo or OO.o</td><td> </td><td style="background: #eee; font-size: smaller;"> -- if statement to decide Neo or OO.o</td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;"> tell application "Finder" to set j to POSIX path of (application file id "org.neooffice.neooffice" as string)</td><td> </td><td style="background: #eee; font-size: smaller;"> tell application "Finder" to set j to POSIX path of (application file id "org.neooffice.neooffice" as string)</td></tr>
<tr><td>-</td><td style="background: #ffa; font-size: smaller;"> set m to j & k -- for neo</td><td>+</td><td style="background: #cfc; font-size: smaller;"> set m to <ins style="color: red; font-weight: bold; text-decoration: none;">quoted form of </ins>j & k -- for neo</td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;"> else if qq = "OpenOffice.org" then</td><td> </td><td style="background: #eee; font-size: smaller;"> else if qq = "OpenOffice.org" then</td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;"> tell application "Finder" to set j to POSIX path of (application file id "org.openoffice.script" as string)</td><td> </td><td style="background: #eee; font-size: smaller;"> tell application "Finder" to set j to POSIX path of (application file id "org.openoffice.script" as string)</td></tr>
<tr><td>-</td><td style="background: #ffa; font-size: smaller;"> set m to j & l -- for oo.o</td><td>+</td><td style="background: #cfc; font-size: smaller;"> set m to <ins style="color: red; font-weight: bold; text-decoration: none;">quoted form of </ins>j & l -- for oo.o</td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;"> else</td><td> </td><td style="background: #eee; font-size: smaller;"> else</td></tr>
<tr><td> </td><td style="background: #eee; font-size: smaller;"> display dialog "Your Preferences are not set"</td><td> </td><td style="background: #eee; font-size: smaller;"> display dialog "Your Preferences are not set"</td></tr>
</table>Jakehttps://neowiki.neooffice.org/index.php?title=ClipArt_Code&diff=6002&oldid=prevJake at 23:07, 3 August 20062006-08-03T23:07:01Z<p></p>
<p><b>New page</b></p><div>(will make this pretty later - the white rabbit)<br />
<pre><br />
-- clipart.applescript<br />
-- clipart<br />
<br />
-- Created by Jacob Haddon on 7/31/06.<br />
<br />
-- this will install a folder into the 'gallery' of OO.o<br />
<br />
on run<br />
writePref(userPref())<br />
--display dialog readPref()<br />
end run<br />
<br />
on idle<br />
(* Add any idle time processing here. *)<br />
end idle<br />
<br />
on open names<br />
checkPref()<br />
openFiles(names)<br />
display dialog "You have installed " & names & "!"<br />
quit<br />
end open<br />
<br />
---- subroutines ----<br />
<br />
-- unzipFile<br />
-- this unzips the .zip file into the gallery<br />
-- input f is name of .zip file<br />
on unzipFile(f)<br />
<br />
set gallery to pathToGallery()<br />
display dialog gallery<br />
display dialog f<br />
set thisscript to "unzip " & f & " -d " & gallery<br />
--set rmscript to "rm -r" & gallery & "/__MACOSX"<br />
do shell script thisscript with administrator privileges<br />
<br />
end unzipFile<br />
<br />
-- pathToGallery<br />
-- gets the path to the gallery<br />
-- this is where the output of the unzip will go<br />
<br />
on pathToGallery()<br />
-- path to neo<br />
-- set gallery to "/Applications/NeoOffice.app/Contents/share/gallery"<br />
-- path to oo.ox11<br />
-- set gallery to "/Applications/OpenOffice.org\\ 2.0.app/Contents/openoffice.org2.0/share/gallery"<br />
<br />
--tell application "Finder" to set j to POSIX path of (application file id "org.neooffice.neooffice" as string)<br />
set k to "/Contents/share/gallery"<br />
set l to "/Contents/openoffice.org2.0/share/gallery"<br />
set qq to readPref()<br />
if qq = "NeoOffice" then<br />
-- if statement to decide Neo or OO.o<br />
tell application "Finder" to set j to POSIX path of (application file id "org.neooffice.neooffice" as string)<br />
set m to j & k -- for neo<br />
else if qq = "OpenOffice.org" then<br />
tell application "Finder" to set j to POSIX path of (application file id "org.openoffice.script" as string)<br />
set m to j & l -- for oo.o<br />
else<br />
display dialog "Your Preferences are not set"<br />
end if<br />
return m<br />
end pathToGallery<br />
<br />
-- openFiles<br />
-- taken from openoffice.org.app applescript LPGL<br />
-- goes through any dropped files and addes them to the gallery<br />
<br />
on openFiles(fileList)<br />
if (count of fileList) > 0 then<br />
repeat with i from 1 to the count of fileList<br />
set theDocument to (item i of fileList)<br />
set theFilePath to " \"" & (POSIX path of theDocument) & "\""<br />
set theFileInfo to (info for theDocument)<br />
unzipFile(theFilePath)<br />
end repeat<br />
end if<br />
end openFiles<br />
<br />
-- getZipNames<br />
-- this gets the names of the zip files in the app<br />
<br />
on getZipNames()<br />
set a to POSIX path of (path to me) as string<br />
--display dialog a<br />
set next to "Contents/Resources/zipfiles"<br />
set test to (do shell script "ls " & a & next as string)<br />
tell application "Finder" to set gallery to POSIX path of (application file id "org.neooffice.neooffice" as string)<br />
--display dialog gallery<br />
end getZipNames<br />
<br />
-- userPref<br />
-- takes user input and returns it as a string<br />
-- asks which office suite (Neo or OO.o) they want to use<br />
<br />
on userPref()<br />
set whichOffice to {"NeoOffice", "OpenOffice.org"}<br />
set thisOffice to (choose from list whichOffice with prompt "Select Office Suite" without multiple selections allowed) as text<br />
--display dialog thisOffice<br />
return thisOffice as text<br />
end userPref<br />
<br />
<br />
-- readPref<br />
-- read the preference stored in /contents/resources/pref.txt<br />
-- default "none"<br />
-- "NeoOffice" or "OpenOffice.org" after run<br />
<br />
on readPref()<br />
--set officePref to (choose file with prompt "Select a file to read:" of type {"TEXT"})<br />
set officePref to (((path to me) as text) & "Contents:Resources:pref.txt")<br />
set officePref to officePref as alias<br />
open for access officePref<br />
set xx to (read officePref)<br />
close access officePref<br />
return xx<br />
end readPref<br />
<br />
-- writePref<br />
-- writes the preference to /contents/resources/pref.txt<br />
-- input is value to be written<br />
<br />
on writePref(t)<br />
display dialog t<br />
set officePref2 to (((path to me) as text) & "Contents:Resources:pref.txt")<br />
set officePref2 to officePref2 as alias<br />
set prefFile to open for access officePref2 with write permission<br />
set eof of prefFile to 0<br />
write t to prefFile<br />
close access officePref2<br />
return true<br />
end writePref<br />
<br />
-- checkPref<br />
-- this checks to see if preferences have been set<br />
-- does file say "NeoOffice" or "OpenOffice.org"?<br />
-- yes, end, no, go to pref dialog<br />
<br />
on checkPref()<br />
set y to readPref()<br />
if y = "NeoOffice" or y = "OpenOffice.org" then<br />
--display dialog "Yo!"<br />
return true<br />
else<br />
writePref(userPref())<br />
end if<br />
end checkPref<br />
<br />
</pre></div>Jake