Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to select and make this page active on screen 1

Status
Not open for further replies.

Scubilion

Programmer
Apr 10, 2007
9
0
0
FR
Hello,
I'm trying to programm a search/replace tool and I can't change the active page in order to display the text selected by my search tool.
How can I do that ? I tried to use the function "Mydocument.select(mypage)", with mypage=myselection.parent.textframes(1).index , but it doesn't works. myselection is a range of Indesign.text
Thank you for your help.
Br. Scubilion
 
I have tried to solve exactly the same problem without success. However, these are two different codes from two different projects that could be useful. Using Windows XP, Indesign CS, Visual Basic (not a script, but independent executable programs).

1. This code runs throughout the bookmarks of a document, obtains the number of the page of each one of them and prints it to a file (Print 1) . This part could be useful to obtain the page. Obviously this is different with just selected text, and that is the problem, but maybe it could help.

For thismarknum = 1 To mydoc(thisdocnum).Bookmarks.Count
Set thismark = mydoc(thisdocnum).Bookmarks.Item(thismarknum)
a = thismark.ShowBookmark
Set myframepage = thismark.Destination.DestinationText.ParentTextFrame.Parent
markname = thismark.Name: myframepagename = myframepage.Name
Print #1, "The Bookmark "; markname; " is in page"; myframepagename
marks = marks + 1
marksname(marks) = markname: markspage(marks) = myframepagename
Next 'thismarknum


2. This code is executes when pageminusbutton is clicked. Serves to go to the previous page and update a textbox in a VBform that indicates the current page.

Private Sub pageminusbutton_Click()
Set myindesign = CreateObject("InDesign.Application.CS")
Set mydoc = myindesign.ActiveDocument
Set currentpage = myindesign.ActiveWindow.ActivePage
numpag = currentpage.DocumentOffset
myindesign.ActiveWindow.ActivePage = mydoc.Pages.Item(numpag - 1)
Set currentpage = myindesign.ActiveWindow.ActivePage
namebox.Text = currentpage.Name
End

So far the code.
If I obtain new information about this issue I'll let you know. However, sometimes trying to change the approach to the probles serves, for instance, searching first page by page, then frame by frame inside the page, and then word by word inside the paragraph, in this mode you always know in which page/frame you are, instead of trying to obtain the parent.

Guillermo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top