AppleScript for marking up footnotes in MS Word
Hello. I'm trying to write a script for marking up footnotes in MS Word (2008) that takes this:
and does this to it:
Any suggestions, pointers welcome, even if they don't amount to a full solution.
Here is what I have. At the moment it handles one replacement at a time (so I have to run it several times to go through a document full of footnotes), and not very well. It replaces the superscript footnote reference number with "\footnote{}<footnote text>" -- so puts the text after rather than within the two braces.
tell application "Microsoft Word"
set myFind to find object of selection
clear formatting of myFind
set style of myFind to "Footnote Reference"
set content of myFind to ""
execute find myFind -- replace replace all
if found of myFind is true then
copy object text object of footnote 1 of selection
set superscript of font object of selection to false
set style of selection to "normal"
type text selection text "\\footnote{"
set myRange to collapse range text object of selection direction collapse start
paste special myRange data type paste text
type text selection text "}"
end if
end tell
[footnote 1 of the selection should always be the footnote text corresponding to the footnote reference number selected by a find -- that bit seems to work]
Hi,
mephisto8 wrote:
I would be happy if I could get the whole script to either i) find italicized text in footnotes and replace it with \emph{italicized text}.
This works
tell application "Microsoft Word"
set {tStart, tEnd} to {start of content, end of content} of text object of selection
set oldSel to create range (active document) start tStart end tEnd
select first character of text object of footnote 1 of active document
move range (text object of selection) by a character item count -1
set myFind to find object of selection
clear formatting of myFind
set italic of font object of myFind to true
set content of myFind to ""
clear formatting replacement of myFind
set content of replacement of myFind to "\\emph{^&}"
set italic of font object of replacement of myFind to false
execute find myFind replace replace all
select oldSel
clear formatting of myFind
set style of myFind to "Footnote Reference"
repeat while execute find myFind
tell selection
set x to end of content of text object of footnote 1
copy object text object of footnote 1
set superscript of font object to false
set style to "normal"
type text text "\\footnote{"
paste special (collapse range text object direction collapse start) data type paste text
delete first character -- remove the space before the pasted text
move range (text object) by a character item count (x - 2)
type text text "}"
end tell
end repeat
end tell
Similar Messages
-
AppleScript for marking messages read in specific mailboxes
Hello
I'd like to ask whether there is someone out there with a good AppleScript knowledge who could help me out with this problem.
As far as I know, Mail currently does not support subscribing / unsubscribing to IMAP folders, which is why my "spam" folders are also being used to show the total number of unread messages in my mailboxes.
My idea is to use a script to mark all messages from specific mailboxes (namely "INBOX/spam" on all accounts) as read, as soon as they are received. All the spam mails are filtered by my provider and put into the "spam" mailbox with a subject containing "*SPAM*" automatically.
Anybody an idea?
Regards
Peter.
Message was edited by: peschehimselfTry this:
tell application "Mail"
repeat with each_account in accounts
tell each_account
repeat with each_mailbox in mailboxes
if name of each_mailbox contains "spam" then
set (read status of messages of each_mailbox whose subject contains "*SPAM*") to true
end if
end repeat
end tell
end repeat
end tell
But if you have a lot of '*SPAM*' messages in those folders it will still have to evaluate all of them and may be slow as a result.
H -
Does anyone know how to exclude footnotes from the word count in the Pages for iPad app?
If I create a doc on pages for ipad, then view it on the iMac, the word count is lower. I figured out that this is because Pages counts all the words in the footnotes. Does anyone know how to make it exclude footnotes from the word count?
I see the exact same behavior on my IPAD(s) and IPHONE(s). This isn't the loss of titles already identified in other posts. Every movie that wasn't purchased from iTunes, meaning all my movies of my kids, shows it sync in iTunes, but doesn't show up anywhere on the devices.
Help Apple! Please un-break the feature that was functional before. -
Automator/Applescript for Pages
Does anyone know of a good reference for Automator Actions or Applescripts for Pages? I've looked at all the usual websites and no one has any. All I'm trying to do is use a script to automate the process of opening Word docs and save them as Pages files.
I do not think there is anything really well written and exhaustive on the matter. I have three main sources:
1. Pages script dictionary (available in ScriptEditor through Open Dictionary > Pages).
2. This page with a script that goes the opposite way: http://pagesfaq.blogspot.com/2006/11/i-have-one-thousand-pages-documents-to.html
3. Searching Google for the string "tell application Pages". -
Is it wise to keep the Nikon camera files "DSC's" after downloading them and converting to DNG files via Adobe converter for lightroom use. In other words do the DNG files have all the raw data I would ever need in processing or should I save the camera's DSC files?
DNG files do not contain some metadata supplied by the camera, which can be used by the manufacturer's software. Thus, if you don't keep the original Raw photo, you will lose this information.
If your 1000% sure you're never going to use the manufacturer's software, then this isn't a problem. But who can be sure what software you will be using 10 years from now? -
While generating reports in Oracle BI Publisher in pdf format, the generated pdf reports have hindi इ matra displaced by one character. For example, रिपोर्ट is printed as रपेिोरट. Word file generated of the same report have correct hindi इ matra position and also pdf generated from this word file also contains the same.
-
Help with a simple applescript for combining Artist text with Track name
Hi all,
I'd like to put together a simple script that takes the artist names from a list of tracks in iTunes and copies the text to the start of the Title name, followed by " - ".
This is because, e.g. on a classical album, I want the artist names to all be "Classic Collection Gold" but I'd like to keep the artist name contained with the track name. This means when I browse by artist I don't get millions of artists...
I found this script, which does something kinda similar, but I'm new to script writing so not sure how to do it?
So I'd like to change:
Name
Planets: Mars
Artist
Gustav Holst
Ambum:
Simply Classical Gold (Disc 2)
To be:
Gustav Holst - Planets: Mars
Artist
Gustav Holst - Planets: Mars OR BETTER Simply Classical Gold (Disc 2)
Album
Simply Classical Gold (Disc 2)
This script has some ideas in, but I'm not sure how to tweak it....
"Artist - Name Corrector" for iTunes
written by Doug Adams
[email protected]
v1.6 May 17, 2004
-- removed ref to selection
v1.5 April 11 2004
checks if separator string is in name
v1.0 April 2 2004
Get more free AppleScripts and info on writing your own
at Doug's AppleScripts for iTunes
http://www.malcolmadams.com/itunes/
property separator : " - "
tell application "iTunes"
if selection is not {} then
set sel to selection
repeat with aTrack in sel
tell aTrack
if (get name) contains separator then
set {artist, name} to my texttolist(get name, separator)
end if
end tell
end repeat
end if
end tell
-- == == == == == == == == == == == == == == == ==
on texttolist(txt, delim)
set saveD to AppleScript's text item delimiters
try
set AppleScript's text item delimiters to {delim}
set theList to every text item of txt
on error errStr number errNum
set AppleScript's text item delimiters to saveD
error errStr number errNum
end try
set AppleScript's text item delimiters to saveD
return (theList)
end texttolist
Message was edited by: ChipstixI'm not sure what that script thinks it's doing, but it's essentially doing nothing, so scrub that and start afresh.
The first thing you need is a way to identify the tracks to change - you don't want to do all tracks in the library (they might have already been munged). A good option is to work on the selected tracks:
tell application "iTunes"
if selection is not {} then
set sel to selection
You then need to iterate through those items, changing them one-by-one:
repeat with aTrack in sel
Now comes the easy part - build a list of the elements you want (in this case you want the name, artist, and album of each track:
set trackName to name of aTrack
set trackArtist to artist of aTrack
set trackAlbum to album of aTrack
Now you have the information you need, so reset the fields as appropriate:
set name of aTrack to trackArtist & " - " & trackName
set artist of aTrack to trackAlbum -- or to trackArtist & " - " & trackName, depending on your choice
Now clean up by closing off the repeat and tell blocks:
end repeat
end tell
Putting it all together you get:
tell application "iTunes"
if selection is not {} then
set sel to selection
repeat with aTrack in sel
set trackName to name of aTrack
set trackArtist to artist of aTrack
set trackAlbum to album of aTrack
set name of aTrack to trackArtist & " - " & trackName
set artist of aTrack to trackAlbum -- or to trackArtist & " - " & trackName, depending on your choice
end repeat
end tell -
I have a brand new macbook pro 15" with latest Lion. Can anyone tell me why, when I open word or preview etc that multiple files open?For eg if I open a word doc, the last 1-3 docs that I have worked previously on all open. Can anyone tell me why?
You have a choice as to whether or not applications in Lion like Word or Preview (or even Safari) save and re-open previous documents or windows... just hold down the option key while quitting a program and when you re-open it you won't get the previous documents or windows when you re-open the application. You can see this by selecting the open program in the menu bar and when holding down the option key the quit function will change to quit and discard open windows. This feature in Lion is referred to as "Resume" and is great if you want to restart an app and return to what you're doing (for example in Safari re-opening existing windows and tabs from your previous session). You still have the option to close individual windows within an app before quitting and they will not re-open when the app is launched again.
This Resume function is not related to saving your work (a word or text document for example). This is handled by Lion's "Auto-Save" and "Versions" functions. See http://www.apple.com/ca/macosx/whats-new/auto-save.html
Hopefully this is the complete answer you're looking for. -
Help Needed: Automator Applescript for Folder Action - Encode Video
Hi !
I have created an Automator Applescript for a Folder Action to do the following:
When a new video file is moved to the target folder (i.e. Download of Vuze is done), automatically launch the Applescript Action that does the followin g(Applescripted):
1) Using "run shell script" and FFMPEG on a UNIX command line, determine Width/Height, Framerate, Bitrate
2) Calculate encoding parameters (slightly reduced bitrate, reduced Aspect etc.)
3) Using "run shell script" with ffmpeg on the command line and the calculated parameters to encode the video file
At the same time, the action is written to a log file so I know if a file is recognized, when encoding started etc.
It works fine if I save this Action as an .app, make an alias on the Desktop and drop video files on it.
It also works fine if I attach the script to a folder as a folder action and drag a video file in there.
However, when I attach the script as a folder action to the Vuze download folder, it encodes only some video files, i.e. if there was a download of 5 files, chances are good that it will not encode 1 or 2 files out of those 5.
If for example a second download finishes while the encoding for the first download is still going on, sometimes the second file starts encoding after the first encode finishes, sometimes it does not, the file does not make the log file at all, i.e. the folder action missed it or the automator action dropped it because it was still encoding. Still, sometimes it happens, sometimes not.
As I need a solution that is 100% accurate, I would like to ask if there are any ideas on how to do this better maybe? As I am not an Applescript Guru, I would need some help to know what works and what doesn't and what the syntax is.
My main idea right now:
Similar to how ffmpegX works with its "process" application, have a second script (as .app) that receives the files to be encoded from the automator action and puts them in a queue, then proceeds to encode this queue while the main automator action is free to receive the next file.
Writing this second app is quite straightforward (a modified version of my current script) but I have some questions I need help with:
1) How do I call another applescript from within an existing applescript that launches the new applescript in a new process?
2) How do I pass parameters to this new applescript?
3) In case of this "Queueing" Idea, once I called the external applescript the first time, how do I make sure when I call next time, that I don't open a second instance of this script but rather pass another queue item to the original instance to be processed?
Or in general: Is there a better way to achieve this automatic encoding solution that I have not thought about?
Alternatively:
Does anyone know how to call the "process" application that comes with the ffmpegX package with the correct parameters to use as a queueing / processing tool?
Thanks!
Joe
Message was edited by: Joe15000
Message was edited by: Joe15000To do this, I created an Automator workflow with an Applescript snippet to change the 'media kind'.
Here is the 'Run Applescript' workflow step code:
on run {input, parameters}
tell application "iTunes"
set video kind of (item 1 of input) to movie
end tell
return input
end run
Prior to this running, I have an 'Import Files into iTunes' workflow step.
You can switch out 'movie' with: 'TV show', 'music video', or anything in ITLibMediaItemMediaKind.
Good luck,
Glenn -
Function module for converting the foreign currency to words
hi,
can anybody tell me about the function module for converting the foreign currency to words format.
Like 25.50 USD
should be "Twenty Five Dollar & Fifty Sents."
foreign currency can be anyone like USD, JPY, EUR etc.
Regards
Nitin VarshneyHi,
Try using the FM SPELL_AMOUNT
Check this wiki
[SPELL_AMOUNT|https://wiki.sdn.sap.com/wiki/display/Snippets/SpelltheAmountenteredin+words]
Regards
Sarves -
I paid for the convertion from pdf to word and its not letting me???
I paid for the convertion from PDF to word i received a confirmation number, but it is not converting, Why?????????
Hi Rosa,
I'd like to assist! Are you receiving a particular error message? I see you have verified your subscription...
There is also this handy 'getting started' guide that may help.
Looking forward to hearing back from you!
Regards, Stacy -
Change selection criteria or check allowance for marking
Hi,
I have executed the costing in CK11N and saved the result. The costing run was successful without any error.
When I want to Mark the cost in CK24, I am getting the below error. Kindly help to resolve this issue.
Change selection criteria or check allowance for marking
Message no. CKCC140
Diagnosis
No data was selected for marking.
Possible causes:
There is insufficient data in the selection screen to select the required cost estimates.
The organizational measure was not carried out, or it was issued with a different costing variant to that of the cost estimates ( Marking Allowance).
All the cost estimates contain errors.
The cost estimates have already been marked or released.
For detailed information, call up the log.
thanks and regards
MurugesanDear Murugesan,
First ensure in CK11N,you have saved the cost estimate without any error,the signal showing with green colour.
Then in CK24,first take a test run for marking and then without the check box for test run.
Before Executing this T Code for marking,click on marking allowance and ensure for the period,company code and the same
costing variant and costing version,it shows green colour which indicates alloed for marking and release,otherwise,just click on
your company code,enter the costing variant and costing version and save the datas.
This should be done only once during the period begining.
Once after doing this,ensure you have complete authorization for marking and release.
Check and revert back.
Regards
Mangalraj.S -
Looking for an App that will hold Word Docs and allow editing
Does Pages satisify this need?
You are welcome. Glad I could help. Thanks for marking my reply with the solved check mark.
Allan -
It's posible change default image for mark interactive button / not UI
When in indesgin convert a object to button appears in background a hand with a finger pointing to a button. It's posible to change this?
I need to use several icons if it's posible in the same document.
Thanks !I make a UI for mark custom buttons for custom export in xml, is for iPad but is a for a private format, not ePub, and i need to show diferents types of buttons, (events, buttons, etc...) I need to mark the elements with a custom icon.
My actual solution is put my icon, (non printable) in the top left corner of the element (textFrame, Rectangle...) ,group it and store all event information in a JSON object, but isn't a good solution.
the user can delete the item ....
I think is imposible to make a custom mark for items without insert a new item.
The Flag icon is for mark, when the user is building the publication. This item launches an interactive event
thank for any idea -
When I install adobe acrobat XI PRO, it converts everything on my computer to an adobe icon, and when I try to open it, it open adobe acrobat. For example, I can't open word, excel, internet explorer, or any other document or program because it thinks its acrobat.
Hi Kate,
Please refer to this KB doc. for the solution Application, file icons change to Acrobat/Reader icon
Let me know if the issue persist.
Regards,
Aadesh
Maybe you are looking for
-
Network works; Internet does not
I apologize if this is a repost, I looked through everything and couldn't find anything exactly appropiate to me. I connect on a university's LAN, no password or anything like that. All the network settings are basically "plug-and-play," if you will.
-
Why can't I download updates for my ipod touch 4G?
I have a pretty old windows XP. I'm not sure what year exactly, but we've had it a long long time. We have it on a wifi connection, with our router in the basement, but internet connection never seems to be an issue so it's not that my internet is qu
-
I designed a PDF form for a client. The form was sent by email to a group of people, completed by these people, and returned by email. I combined all of the completed forms into a single PDF, and the combined PDF was posted to their web site. The cli
-
TS1368 download large videos in pieces?
so when ever i try downloading, hunger games, it is about 2 gigs. and i let my computer stay on over night. my isp kills my connection because i am using it too heavily . but that not the problem. the problem comes then i get some error and itunes a
-
We are on SAP 4.6C and Vertex Q Series 3.1 I had to put in several exceptions for a North Dakota max tax, which was optional. We are taxing at item level and for these ND transactions I need the tax to be calculated at an invoice level. Is there a wa