Re: UI scripting: Problematic removal of unwanted Word footnote returns
Re: UI scripting: Problematic removal of unwanted Word footnote returns
- Subject: Re: UI scripting: Problematic removal of unwanted Word footnote returns
- From: KOENIG Yvan <email@hidden>
- Date: Thu, 10 Nov 2011 08:44:15 +0100
Le 10 nov. 2011 à 00:59, Roy McCoy a écrit :
>
> 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]
I don't use Word but I guess that you would be able to trigger the button "Replace All" in the Find Replace dialog.
CAUTION, using the names of UI elements would restrict your scripts to English speaking users.
Add the instruction :
tell application "Word" to activate just before the code posted above.
Yvan KOENIG (VALLAURIS, France) jeudi 10 janvier 2011 08:43:48
_______________________________________________
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