• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
UI scripting: Problematic removal of unwanted Word footnote returns
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

UI scripting: Problematic removal of unwanted Word footnote returns


  • Subject: UI scripting: Problematic removal of unwanted Word footnote returns
  • From: Roy McCoy <email@hidden>
  • Date: Thu, 10 Nov 2011 00:59:27 +0100

[previously posted to AppleScripting InDesign Yahoo Group,
http://tech.groups.yahoo.com/group/applescriptingindesign]


Bret and I have been discussing in indesign-talk how to deal with a problem I've had recently with Word's adding unwanted footnote returns that strangely can't be removed using Replace All. None of the three QuicKeys macro sequences I created for this could handle it; we found that Keyboard Maestro could, but the only repeat function I could find in that program couldn't run the sequence faster than once per second, which meant it took over a half hour to remove the returns in all the 1900 footnotes of the book concerned. The job involved has already been done twice and I hope the second time was the last, but for possible future occasions I'm still interested in the UI-scripting possibility suggested by Bret.

Fortunately I've quickly found a helpful introductory article on the subject athttp://www.mactech.com/articles/mactech/Vol.21/21.06/UserInterfaceScripting/index.html.
It's good that the writer of this article especially likes the click and keystroke commands, as these are the two I used in my Keyboard Maestro sequence. I may not even need to rerecord the click or redetermine its location.

"UI Element Inspector", hmm. Don't have anything with that name on my disk, and it's not downloadable at the indicated URL. It seems its name is now Accessibility Inspector... and it says I'm now an Apple Developer, yay... I have to download the Developer Tools to get the Inspector, but the download is 4.14 GB, yikes. I'll let it download, I guess, but don't know if I'll install it afterwards since that's a pretty whopping footprint for one function that I probably won't be using much. Hopefully I won't need it. Let's see how it goes here without it.

The article winds up saying there's a third-party program available that does the same thing that Apple's Inspector does only better. There's a free 30-day demo athttp://pfiddlesoft.com/uibrowser/index.html, which will win out over the 4GB+ option for the time being (particularly since Safari is saying that the rest of the SDK download will take 17 hours and 27 minutes). [...] I've downloaded, installed and launched this "UI Browser" program and it indeed seems very helpful and perhaps even essential. I couldn't, however, get a script working. This works to change the first of the pesky footnote returns:

tell application "System Events"
 tell process "Microsoft Word"
   set frontmost to true
   keystroke "H" using {command down, shift down}
   tell group 1 of tab group 1 of window 1
     tell button "Find Next" to click
     tell button "Replace" to click
   end tell
 end tell
end tell

But I can't get the process to repeat. If I command-home to the top of the Word doc (http://dl.dropbox.com/u/1107821/la danghera lingvo_ee+ (exp returns).doc, 2.8MB), open the Find and Replace dialog, and click on "Find Next" and "Replace", I can continue clicking on "Find Next" and "Replace", thus getting rid of the unwanted returns. (This is how I did it - manually - a couple of nights ago, 1903 times, ouch.) But if I run the above script, clicking on "Find Next" afterwards yields the alert "Word has finished the document. The search item was not found." - sometimes also with an additional scripting alert about some index thing. It's like doing the same two click commands via a script screwed things up somehow.

It seems like such a simple thing to do, but it's being so obstinately resistant. Anybody know how to make it work?


Thanks,

Roy


P.S. The Find and Replace dialog needs to be set with

Find what:    ^p
Format:       Style: Fußnotentext

Replace with: [nothing]


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: UI scripting: Problematic removal of unwanted Word footnote returns
      • From: Axel Luttgens <email@hidden>
    • Re: UI scripting: Problematic removal of unwanted Word footnote returns
      • From: KOENIG Yvan <email@hidden>
  • Prev by Date: Re: AppleScript-Users Digest, Vol 8, Issue 515 - Disregard
  • Next by Date: Re: UI scripting: Problematic removal of unwanted Word footnote returns
  • Previous by thread: Re: AppleScript-Users Digest, Vol 8, Issue 515 - Disregard
  • Next by thread: Re: UI scripting: Problematic removal of unwanted Word footnote returns
  • Index(es):
    • Date
    • Thread