SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 2 of 2
  1. #1
    Member
    Join Date
    May 2001
    Location
    Des Moines, Iowa, USA
    Posts
    65
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Using shared module for TP Events

    I have the below code that I am working on. It tells me what the browser window caption is when I click anywhere on a web page. I would like
    to put the MouseWait() portion into a shared module. However, when I do this, I run into errors because TP barks at me about not recognizing the TEventGroup when I have this in a module. It works fine as long as both are
    in a script.

    My question is why? How can I get this to work in a shared module?

    -----------------
    Sub Main()


    Do Until bRun = True
    MouseWait
    Loop

    End Sub

    Private Sub MouseWait()
    Dim monitor As TEventGroup
    Dim condition As TMouseEvent

    Set monitor = CreateTEventGroup("Event Monitor")
    Set condition = MakeMouseEvent(True, "Application=IEXPLORER.EXE",
    tpMouseLeft)

    ' Add the condition to the monitor.
    monitor.AddCondition condition

    ' Wait for it to fire.
    If monitor.Wait(30000) Then
    MsgBox "Mouse fired!"

    ' HTMLBrowser("Caption='*'").Attach

    MsgBox HTMLBrowser ("Caption='*'").Caption

    bRun = True

    End If

    End Sub
    --------------------------------------------------

    Any help would be greatly appreciated...

    Thanks!
    Mike

  2. #2
    Member
    Join Date
    Nov 2004
    Location
    UK
    Posts
    57
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Using shared module for TP Events

    You need to put the function in a shared module in the same project as your script (probably best to put it into the Common project).

    And you also need to give the sub routine the scope of public e.g.

    ------------------------------------------------
    Public Sub MouseWait()
    Dim monitor As TEventGroup
    Dim condition As TMouseEvent

    Set monitor = CreateTEventGroup("Event Monitor")
    Set condition = MakeMouseEvent(True, "Application=IEXPLORER.EXE",
    tpMouseLeft)

    ' Add the condition to the monitor.
    monitor.AddCondition condition

    ' Wait for it to fire.
    If monitor.Wait(30000) Then
    MsgBox "Mouse fired!"

    ' HTMLBrowser("Caption='*'").Attach

    MsgBox HTMLBrowser ("Caption='*'").Caption

    bRun = True

    End If

    End Sub
    --------------------------------------------------

    The reason it is complaining is that you have defined the sub routine as Private i.e.

    Private Sub MouseWait()

    Regards

    Bob

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 11.54%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 04:18 PM.

Copyright BetaSoft Inc.