Re: Right click on text vs. right click on hyperlink



Well, I don't seek to automate my breakfast, but I do like reducing
frequently performed computer tasks from three steps to one. For
example, I have a .vbs file that toggles the display of the file
extensions in Explorer. I just click a Winkey combo, and it's done. If
I were to do that the built-in Windows way, I have to go down about
three levels in a menu. N.G.

Yes, you're right, what I'm talking about is right-clicking on an IE
window that is displaying an archive page in my blog. the menu that
appears is the IE context menu, to which I've added several button via
the Registry.

However, your discussion is a bit beyond me and I'm going to have to
work harder at understanding this. I'll back back later.

Thanks for the continuing help.

Larry


"mayayana" <mayaXXyana1a@xxxxxxxxxxxxxxxx> wrote in message
news:C1NDe.14745$aY6.9797@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> That's very clever. I'm guessing that you're the
> sort of person who has figured out automated ways
> to get your morning paper, make some toast, and put the
> coffee on, so that you need only show up and
> enjoy. :)
>
> I have a hard time following your example. I'm not
> familiar with Word, but also I don't understand where
> the "Edit Entry" menu is happening. You say you
> right click on an entry "in my blog". You're clicking
> a webpage in the software you're using and that shows
> the Edit Entry menu? But it's not IE or Word? The code
> you have for getting the URL looks like the page is
> being clicked in IE. If that's the case then the code I posted
> should work. That is, if you're clicking on a copy
> of your blog (or your RSS page?) that's hosted in
> IE, then in order to get the page associated with a clicked
> link you need to do something like add a
> document_onmouseup sub, check for the right click in
> that sub, get the event source element and check for
> tagName, then get the HREF attribute of the tag if it's an
> "A" tag. (I'm not positive but offhand I think you could use
> getAttribute on the "A" element to get the URL value
> of the HREF attribute.)
>
> --
> Larry <larry328NOSPAM@xxxxxxx> wrote in message
> news:e1CGCPajFHA.708@xxxxxxxxxxxxxxxxxxxxxxx
> >
> > Thanks very much. There's a lot here and I will absorb it and get
back
> > to you. In the meantime, to make it clearer what I want, below is
the
> > htm source file that I want to modify. What this script does is
allow
> > me to open in one step the editing page of any archive page in my
blog.
> > (The software I currently have does not allow for this.) Here's the
way
> > it works. I right click on an archive page in my blog, click a
button
> > on the context menu called "Edit Entry," and it runs the htm file
that
> > contains the below Windows script. The script extracts the url of
the
> > web page, opens Word, copies the url into Word, then runs a macro in
> > Word called EntryEditPageOpen which changes the url of the archive
page
> > into the url of the editing page for that that archive page, then
runs
> > that url and opens the editing page.
> >
> > Now what I want to do is to make this also work when I am not in the
> > archive page that I want to edit, but in another page (say the home
> > page) and am clicking on a hyperlink to that archive page. In that
> > event, I want the script to recognize that I have clicked on a
hyperlink
> > instead of the text area of web page and to extract the url from the
> > hyperlink instead of (as in the other instance I described)
extracting
> > the url of the current web page.
> >
> > Now here's the script
> >
> >
> > <html>
> > <head>
> >
> > <script language="VBScript"><!--
> >
> > ' Click in a blog archive page and click the button "edit entry
&open"
> > and
> > ' the editing page for that page will open.
> > ' Now I need to modify this so that I can do the same thing for
clicking
> > on a
> > ' shortcut to an archive page.
> >
> >
> > ' Added these two lines for purpose of opening e-mail.
> > Dim WSH
> > Set WSH = CreateObject ("WScript.shell")
> >
> > Dim oWindow, oDocument, docAddress, oSelectRange
> > Set oWindow=window.external.menuArguments
> > Set oDocument=oWindow.document
> > docAddress=oDocument.URL
> > 'docTitle=oDocument.Title
> > If docTitle = "" Then
> > docTitle = "(no document title)"
> > End If
> > 'Set oSelect=oDocument.selection
> > 'Set oSelectRange=oSelect.createRange()
> > 'oSelectRange.execCommand("Copy")
> >
> >
> > Dim oWd, doc
> > On Error Resume Next
> > Set oWd = GetObject(, "Word.Application")
> > If TypeName(oWd) <> "Application" Then
> > Set oWd = CreateObject("Word.Application")
> > End If
> >
> > ' moving invisible thing here so that Word won't be seen if it's
being
> > normalized.
> > oWd.Visible = False
> > Set doc = oWd.documents.add
> > ' Make Word invisible so I don't see Word do its thing,
> > ' which also seems to make the script work faster.
> > 'oWd.Visible = False
> > oWd.Activate
> > ' new line added to normalize window
> > oWd.WindowState = 0
> >
> > oWd.Selection.TypeParagraph
> > oWd.Selection.TypeText(docAddress)
> >
> > ' run a macro that changes url of page into url of editing page
> > oWd.Run "EntryEditPageOpen"
> > oWd.ActiveDocument.Close wdDoNotSaveChanges
> >
> > ' Make Word visible again
> > oWd.Visible = True
> >
> > --></script>
> > </head>
> > </html>
> >
> >
> >
> >
> >
> >
> > mayayana wrote:
> > > I am assuming that you want to do this
> > > in a webpage opened in Internet Explorer,
> > > so the code I posted is showing how to do
> > > it with the Internet Explorer Document Object
> > > model.
> > > Any page in IE is a document object. There is
> > > also an implied window object, where the document
> > > resides. In the document, every HTML tag is an
> > > Element. So you can access the page that way.
> > > Example: A IMG tag is an element. It's tagName
> > > property is "IMG". If a tag contains the IMG tag then
> > > that's its parentElement. You can find out and do just
> > > about anything you want to through that system.
> > >
> > > By the "click sub" I meant the click event sub for the
> > > document. There actually isn't any right-click sub but
> > > you can do it like this:
> > >
> > > Sub document_onmouseup()
> > > If (Document.parentWindow.event.Button = 2) Then '--right
button.
> > > '-- right mouse up.
> > > Else
> > > '-- left mouse up.
> > > End If
> > > End Sub
> > >
> > > That sub would provide a way to catch all link
> > > clicks and deal with them.
> > > You can also do it per-link by giving an ID to the A tag.
> > > If you use something like:
> > > <A HREF="somewhere.com.index.html" ID="A1"></A>
> > >
> > > then you can catch the right- click with the onmouseup
> > > event of the tag itself by using the following sub in the
> > > HEAD of the page:
> > >
> > > Sub A1_onmouseup()
> > >
> > > Either way you need to handle events in order to catch
> > > the click. I'm not sure what you mean by the "application
> > > key" and "shortcut menu". You mean the context menu
> > > that shows when you right click? You need to catch the
> > > event. Either you would want to use the onkeypress or
> > > onkeyup events, or you could use the oncontextmenu
> > > event. The only problem with the latter is that it doesn't
> > > work in IE4. In IE5 and 6 you can actually block the context
> > > menu from showing by adding this:
> > >
> > > Function document_oncontextmenu()
> > > On Error Resume Next
> > > document_oncontextmenu = False
> > > End Function
> > >
> > > You can then show your own menu or message, or
> > > do something else, but it doesn't work in IE4 and
> > > I think it doesn't work in IE6 XP SP2. (I think Microsoft
> > > finally realized, to some extent, that they never should
> > > have let web masters control the browser functions in
> > > the first place!)
> > >
> > > You saids you wanted to do something when a link
> > > was clicked. If what you actually want to do is to take
> > > an action when the context menu shows then that's
> > > different. But whatever you want to do, you have to
> > > deal with the related events.
> > >
> > > The Document Object Model (DOM) is very complex
> > > and somewhat convoluted. It helps to have documentation,
> > > but the only complete and usable docs I know of are to
> > > have a local copy of MSDN. MSDN online is nearly useless
> > > for finding things and takes far too long to load if you need
> > > to jump around to a lot of pages. Ant the IE DOM is just
> > > too big to put into a normal help file.
> > >
> > > If you want to get more into it you could check this
> > > download:
> > > http://www.jsware.net/jsware/scripts.html#domed
> > >
> > > It might be of some use for reference. The download is
> > > a full scale "WYSIWYG" HTML editor powered only by
> > > VBScript in IE windows. The whole point of it is to
> > > demonstrate how to accomplish various things using
> > > the IE DOM.
> > >
> > > Sorry this answer is so rambling, but I'm not sure
> > > exactly what it is that you need to know.
> > > --
> > > > Also, you refer to a click event sub. I know click events from
> > > > forms in Word VBA. But what does that mean here? Is it a file
> > > > separate from the source code of the htm file?
> > > >
> > > >
> > > >
> > > > "Larry" <larry328NOSPAM@xxxxxxx> wrote in message
> > > > news:e86HffUjFHA.2904@xxxxxxxxxxxxxxxxxxxxxxx
> > > > >
> > > > > I'm happy to hear that this is possible to do. But is this
code
> > > > > sufficient to set it up? What I mean is, does the script
> > > > > recognize
> > > > "A"
> > > > > as meaning that a hyperlink has been clicked on and "IMG" as
> > > > > meaning that an image has been clicked on?
> > > > >
> > > > > Also, what if I don't right click on the page, but simply
press
> > > > > the application key on my keyboard which makes the shortcut
menu
> > > > > appear?
> > > > If
> > > > > the focus is on the page would opening the menu via the
> > > > > application
> > > > key
> > > > > have the same effect as right clicking on the page? In other
> > > > > words, would the code read it as "Case Else," neither a
> > > > > hyperlink, nor an image, but just plain text?
> > > > >
> > > > > Thanks.
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > "mayayana" <mayaXXyana1a@xxxxxxxxxxxxxxxx> wrote in message
> > > > > news:7FsDe.14331$aY6.11404@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> > > > > > In the click event sub you can use something
> > > > > > like the following:
> > > > > >
> > > > > > sTag = window.event.srcElement.tagName
> > > > > >
> > > > > > Select Case sTag
> > > > > >
> > > > > > Case "A" 'link was clicked.
> > > > > >
> > > > > > Case "IMG"
> > > > > > if window.event.srcElement.parentElement.tagName =
"A"
> > > > > > then '-- it's an image link
> > > > > > end if
> > > > > >
> > > > > > Case Else
> > > > > > '-- do code for non-tag.
> > > > > >
> > > > > > End Select
> > > > > >
> > > > > > --
> > > > > > --
> > > > > > Larry <larry328NOSPAM@xxxxxxx> wrote in message
> > > > > > news:#LA4Y#OjFHA.3936@xxxxxxxxxxxxxxxxxxxxxxx
> > > > > > > Is there a way that Windows script can tell whether the
mouse
> > > > > > > has
> > > > > right
> > > > > > > clicked on the text area of a web page, or whether it has
> > > > > > > right
> > > > > clicked
> > > > > > > on a hyperlink on the webpage? I have a Windows script in
an
> > > > > > > htm
> > > > > file
> > > > > > > that I want to behavior differently depending on whether
the
> > > > > > > first condition or the second condition exists .
> > > > > > >
> > > > > > > Thanks,
> > > > > > > Larry
> >
> >
>
>


.



Relevant Pages

  • Beamer, href{run:..., and Windows vs. Linux
    ... I've created lots of beamer slides that contained something like ... If I click the text during a presentation, Windows looks at ... the file extension and opens the file in the associated program ... After a bit of searching and experimenting, I created a script based on ...
    (comp.text.tex)
  • Capture display on remote (linux) server from (windows) browser
    ... I want to run this utility from a windows web browser and display ... I connect to the linux server from my windows desktop using RealVNC ... It opens a display, captures the ... But when I run the script from windows web browser ...
    (comp.os.linux.x)
  • PlainText ver - EXTREMELY USEFUL INFO - Printing Directory Listings
    ... Funny how often users need to do this, yet there's no simple way to accomplish the simple task through the Windows GUI. ... It would be nice to right-click on a folder in Windows Explorer and print a list of items in the folder, ... This is easy to do by first creating the following batch script using Notepad: ... This hack is cool, but it has a flaw when you implement it on XP: after you've implemented it, every time you try to open a folder using Windows Explorer, the Search Companion window opens instead of the folder you selected. ...
    (microsoft.public.windows.vista.general)
  • Re: A new problem
    ... MatchWindows = "There are no matching IE windows" ... blog entry page and the editing page for that blog entry. ... I use this script to make sure that I do not have two blog editing pages ... In the script you gave me yesterday, it would not count a public blog page ...
    (microsoft.public.scripting.vbscript)
  • How to open mozilla window?
    ... recently I prepared script for my colleauges, ... This script generally opens two windows in IE browses to ...
    (microsoft.public.scripting.jscript)