Dreamweaver DOM getCurrentLine() - api

I'm currently trying to create a small panel extension that recreates the 'minimap' feature on the Sublime Text 2 code editor, but for Dreamweaver. I've successfully created the view but I want to click anywhere in the minimap and the current page will scroll down to the current line that was clicked.
Unfortunately, I can only find the 'getCurrentLines()' code function for the Dreamweaver DOM that returns character offsets rather that line numbers. Does anyone know how I can return the current line number from the document?
I can scroll down the user document by hard-coding a value in using the theDOM.source.setCurrentLine(200); code, but it's getting that number which is stumping me! Any help is much appreciated.

There is dom.getLineFromOffset() can take one of the offsets and find the associated line, however, that should work only in the document window, not sure if that will assist in taking a selection in this "view" (by which I assume you mean panel) to move that into the document being edited.

Related

SSRS Report Builder Design Layout Issues

I can't seem to figure out why the design aspect of Report Builder/Report Designer is so messed up. Either I don't understand why it is doing this (most likely) or this is just the way it is.
Every Element I add to my report seems to not show up, align or look correct in the actual preview. If I add a line that snaps to another line which looks correct in design, looks totally incorrect in the final version. This is just one example of many, see below for images showing this behavior.
If I have a field (text box) tied to a data set and I position it in a certain area, it creates weird white space, is centered wrong or worse, when re-positioning the aforementioned line element, it seems to move other nearby elements in some erratic way. In the obfuscated example, the carrier fields are all basically stacked on top of each other, while in the preview they are spaced properly, but further down in the document if I do the same thing it ends up looking drastically different.
Is this a bug? Is this how RDL and Report Designer work? Is there some trick to element positioning? Is it relative to other elements, based off of foreground vs back ground elements? Does copying a text box to create more text boxes affect them in some way vs. creating a new element each time? I can't figure it out and do not know what to search for to find the answer to this.
This seems to be a "quirk" of how Report Designer works and I just haven't found the secret to it yet. If there is some exact positioning dialog available, I would prefer to use it instead of my mouse and these issues as I have a down-to-the-MM spec document for how this should be designed, but I cannot figure it out.
I am using Report Builder 14 for SQL Server 2016. It is a one page form (an ASN label) held within a table and all elements are within a rectangle element.
Is there an online resource or Report Designer guru who can point me in the right direction when it comes to this?
Example of the vertical line element looking incorrect in Preview/Final
Example of the vertical line element looking correct in Design View
EDIT: Like HOW does this even make sense?
SSRS renders so that the elements do not overlapp. In addition every element get enough space, vertical and horizontal. Basically you cant control this but there is a workaround.
If you put a rectangle in your report and place textboxes in that rectangle, they get rendered like you placed them. This also works in a tablix cell.
Another solution for your problem would be to display everything in one tablix cell. Your expression would be looking like this:
="Ship to: " & Fields!Adress.Value & ". Postal Code: " & Fields!PostalCode.Value
You even can add line breaks and tabs into that expression.

VBA MSHTML TextInput Click Failed

I've worked on multiple web-scraping projects using Excel VBA before, but I haven't encountered this problem before. I've been googling the issue for the past few hours, but I haven't found a solution yet.
Scenario:
My webpage consists of a list-box and a text box that acts as a filter/search. Unfortunately, I can't disclose the webpage information, but somewhere in the list box elements I saw the word "JQuery". After creating an HTMLInputElement, I set it to text box object and changed its value to "TEXT". I expected the list to get update, but nothing happened. I tried to use different approaches, but they all failed.
Text_Field.Focus
Text_Field.FireEvent "onclick"
Text_Field.Value = "TEXT"
Text_Field.Click
I managed to put the text in the text box, but the clicking part does not work. When I do it manually, as soon as I type the phrase into the text box, the list gets updated immediately. Any thoughts or suggestions?
I tried to simulate the "enter key" press, but it didn't work either.
Your help will be appreciated.
Best,
Arman
Event won't fire when you operate elements programmatically. you have to simulate the events too, using document.createEventObject/inputElement.fireEvent (IE8 or lower) or document.createEvent/inputElement.dispatchEvent (IE9+).
What event you need to fire depends on what the script is interested in (onkeypress, onblur, onpaste, etc).

.Click on an a tag does not work

I'm trying to navigate into a web page automatically with VBA to scrape some values from different product ID's. The problem is that when I get to this intermediate page: http://www.siicex-caaarem.org.mx/Bases/TIGIE2007.nsf/4caa80bd19d9258006256b050078593c/$searchForm?SearchView (search for code 11081201, for example), where I'm supposed to click on the only "a" tag there, the program keeps crashing with
Object variable or With block variable not set
on the line that should click on the element:
objIE.document.getElementsByTagName("a")(0).Click
I have been using similar working lines of code for the same purpose on different pages (ussualy with a for each loop, which doesnt work here either), so I'm unsure why it doesn't work here. I appreciate your help with this.
The solution for this was adding DoEvents before the line that clicks on the element.

PDF Markers visible on Document

Is there a way to add a marker on to a PDF that is not contained within the Bookmark panel and visible on the PDF itself. So that our client can just click on the marker to bring him to a specific point in the document. These will be changes that are revisions and not necessarily to do with the structure of the document. I feel like I have seen this in the past but unsure how to go about creating it. Any advisement you may have to offer is greatly appreciated.
I am running AA XI Pro.
Thank you,
You can create floating toolbar using the code below as an example. cExec is the JavaScript expression string to evaluate when the button is clicked. oIcon, which is optional, is a document level icon that you would have previously added to the document using...
this.addIcon("iconName", "iconPath");
You can just run the code to add the icon from the console since you only need to do it once.
Add the code below to a Document JavaScript so that it loads every time the document is opened.
app.addToolButton({
cName: "goToPage",
oIcon: util.iconStreamFromIcon(this.getIcon("LinkIcon")), // Needs to already be a document level Icon object in the document
cExec: "this.pageNum=41",
cTooltext: "Got To Page 42",
cEnable: true,
});
You can add as many buttons as you like but each cName needs to be unique. Also, This will only work in the desktop versions of the Adobe viewers.
You can find a working example of the code above here

VBA script to insert anchor position for autoshapes in Microsoft Word 2007

I'm beyond the limits of my kindergarten-level VBA skills so would like to ask if anyone here can help me write a VBA script to help me work stepwise through my Word document and adjust the anchoring position of all the AutoShapes in the document.
I have a 400-page book in Microsoft Word with at least one and sometimes several marginalia (sidenote) on each page in a thin column to the left of the main body text column. These sidenotes are a concise 'pointer' to a particular point made in the body text and need to appear directly to that point's left.
Each sidenote is in its own AutoShape (within a textbox in that shape). The AutoShapes were placed by the author in an inconsistent way. Mostly they are anchored to a position on the page.
However, I need to repaginate. This will cause the body text to flow differently and I need the sidenotes to flow with it (approximately or exactly)!
So before I repaginate I want to make sure I anchor each AutoShape to the paragraph it belongs to and not to the page it is currently on.
I don't know if that can be done automatically, since I don't know how Word could deduce a purely spatial relationship between an AutoShape and a paragraph.
So I'm guessing I have to make do with a "semi-automatic" process. Something like this:
Press a button to start VBA script
Select next AutoShape
Prompt for user to enter cursor in body text where anchor is to be placed
Resume macro
Place anchor for that AutoShape in that position
Change vertical position paramater of AutoShape to "relative to paragraph"
and "0 mm"
(Alternative, not 0 mm but another value deduced to more
accurately position AutoShape)
Change width parameter of AutoShape to
a particular fixed value 37 mm (some of them were a little
inaccurately drawn)
End cycle and go back to beginning to
Select next AutoShape
Hope that is all understandable.
I've tried to record a VBA script to do some of this but have no idea how to build in the user prompt.
Any help much appreciated!
Craig
You may be better off creating a macro that works on one shape at a time, or anchor all the shapes manually (which you're almost doing anyway) and then write a macro to take care of the various parameters and settings you want.
If you really want to prompt the user while the macro is running you'll need to look into modeless dialogs (not possible on the Mac). See this link: http://www.bettersolutions.com/vba/VXV113/SE846743531.htm
Basically, you'd have to create your own dialog and then show it modelessly so that the user could still place the cursor before hitting OK. If you're new to VBA, this could be difficult to set up.
While searching for solutions to this, I found a post on another forum from someone trying to do something very similar. He was developing a set of tools for editors using Word and until I find the ultimate solution I am using his "Shapes" tool which allows me to change parameters on each AutoShape I select at-a-click instead of opening up and closing a dialogue box each time, plus selecting a different tab each time... His tools can be downloaded at his Editors' Toolkit website.