Home > Default > How do I move a graphic-box in a document I imported from AppleWorks?

How do I move a graphic-box in a document I imported from AppleWorks?

October 11Hits:0
Advertisement
I imported a book which I wrote in AppleWorks without problems into Pages '08. On one page of this book I had created a box, using the graphics tool, and moved it to the back so I could read the text inside it. It is now in the Pages '08 version of my book, but because of editing and additional writing which I've done, it appears on page 295, not 297 where it belongs. In AppleWorks I could simply select it and drag it into place. In Pages '08 I can't figure out how to select it. It's just there.
Help desperately needed.

Answers

Here is an AppleScript which, in a single call will
• extract the embedded picture files
• strip the annoying description of the 'background' pictures from the Index.xml file.
So, we may open the Pages document, it will be free of the oddity and the picture files are available in the folder "importés_sétropmi" on the desktop.
--(SCRIPT recupPictures]
Save the script as an Application (Bundle Application if you want to use it on a MacIntel)
Store it on the Desktop.
Drag and drop the icon of a Pages document imported from AppleWorks on the script's icon.
The script will move the embedded picture files in a folder named "importés_sétropmi" on the desktop.
Then it will strip the Index.xml file from the block of datas describing the embedded pictures.
Yvan KOENIG (FRANCE 7 juillet 2008)
property typePages : "com.apple.iwork.pages.pages"
property baliseDebut : "<sl:drawables>"
property baliseFin : "</sl:drawables>"
property return2 : return & return
property line_Feed : ASCII character 10
property line_Feed2 : line_Feed & line_Feed
property monDossier : "importés_sétropmi"
property withSeconds : true
--=========
on run (*
lignes exécutées si on double clique sur l'icône du script application
• lines executed if one double click the application script's icon *)
tell application "System Events" to set docIwork to (choose file of type typePages)
my commun(docIwork) (* un alias *)
end run
--=========
on open (sel) (*
sel contient une liste d'alias des élémentsqu'on a déposés sur l'icône du script (la sélection)
• sel contains a list of aliases of the items dropped on the script's icon (the selection) *)
set item1 to item 1 of sel
tell application "System Events" to set typeID to (type identifier of item1) as Unicode text
if typeID is not typePages then return
my commun(item1) (* un alias *)
end open
--=========
on commun(thePack)
local typeID, p2d, p2dd, liste, path2Index, texteXML, lafin
set p2d to path to desktop as Unicode text
set p2dd to p2d & monDossier & ":"
tell application "Finder"
set liste to files of thePack whose name starts with "file"
if liste is {} then return (* no picture file so nothing to do *)
if exists folder p2dd then set name of folder p2dd to (monDossier & my horoDateur(modification date of (item p2dd)))
make new folder at folder p2d with properties {name:monDossier}
repeat with f in liste
move f as alias to folder p2dd
end repeat
end tell -- to Finder
try
set path2Index to (thePack as Unicode text) & "Index.xml"
set texteXML to my lis_Index(path2Index)
if texteXML contains baliseDebut then
set liste to my decoupe(texteXML, baliseDebut)
set lafin to my decoupe(item 2 of liste, baliseFin)
set texteXML to item 1 of liste & lafin
if texteXML contains return2 then
set texteXML to my recolle(my decoupe(texteXML, return2), return)
end if
if texteXML contains line_Feed2 then
set texteXML to my recolle(my decoupe(texteXML, line_Feed2), line_Feed)
end if
my enregistre(texteXML, path2Index)
end if
on error error_message number error_number
if the error_number is not -128 then my affiche(error_message)
end try
end commun
--=========
on affiche(msg)
tell application "Finder"
activate
display dialog msg buttons {"Cancel"} default button 1 ¬
giving up after 120
end tell
end affiche
--=========
on lis_Index(cheminXML0)
local cheminXML0, cheminXMLgz, txtXML
set cheminXMLgz to cheminXML0 & ".gz"
tell application "System Events"
if exists file cheminXMLgz then
if exists file cheminXML0 then delete file cheminXML0 (*
un curieux à pu dé-gzipper le fichier
• someone may have gunzipped the file *)
my expand(cheminXMLgz)
set txtXML to my lisIndex_xml(cheminXML0)
else if exists file cheminXML0 then
set txtXML to my lisIndex_xml(cheminXML0)
else
error "Index.xml missing"
end if
end tell -- to System Events
return txtXML
end lis_Index
--=========
on expand(f)
do shell script "gunzip " & quoted form of (POSIX path of (f))
end expand
--=========
on lisIndex_xml(f)
local t
try
set t to ""
set t to (read file f)
end try
return t
end lisIndex_xml
--=========
on enregistre(leTexte, nDoc)
local aliasNDoc
set aliasNDoc to nDoc as alias
write leTexte to aliasNDoc starting at 0
do shell script "gzip " & quoted form of POSIX path of aliasNDoc
end enregistre
--=========
on decoupe(t, d)
local l
set AppleScript's text item delimiters to d
set l to text items of t
set AppleScript's text item delimiters to ""
return l
end decoupe
--=========
on recolle(l, d)
local t
set AppleScript's text item delimiters to d
set t to l as text
set AppleScript's text item delimiters to ""
return t
end recolle
(* =============
• Build a stamp from the modification date_time
on horoDateur(dt)
local annee, mois, jour, lHeure, lesSecondes, lesMinutes
set annee to year of dt
set mois to month of dt as number (* existe depuis 10.4 *)
set jour to day of dt
set lHeure to time of dt
set lesSecondes to (lHeure mod 60)
set lHeure to round (lHeure div 60)
set lesMinutes to (lHeure mod 60)
set lHeure to round (lHeure div 60)
if withSeconds is true then
return "_" & annee & text -2 thru -1 of ("00" & mois) & text -2 thru -1 of ("00" & jour) & "-" & text -2 thru -1 of ("00" & lHeure) & text -2 thru -1 of ("00" & lesMinutes) & text -2 thru -1 of ("00" & lesSecondes)
else
return "_" & annee & text -2 thru -1 of ("00" & mois) & text -2 thru -1 of ("00" & jour) & "-" & text -2 thru -1 of ("00" & lHeure) & text -2 thru -1 of ("00" & lesMinutes)
end if (*
• Here, the stamp is "_YYYYMMDD-hhmm" or "_YYYYMMDD-hhmmss" *)
end horoDateur
--=========
-- [/SCRIPT]
Yvan KOENIG (from FRANCE lundi 7 juillet 2008 20:27:47)

Read other 6 answers

Tags:

Related Articles

Copyright (C) 2019 wisumpire.com, All Rights Reserved. webmaster#wisumpire.com 14 q. 0.678 s.