Announcement

Collapse
No announcement yet.

Scripting Question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Scripting Question

    Below is a subroutine to create movie theater names. It places the word "Theater" in front of the actual movie theater name. For example, if the theater was called "Loews", the subroutine would create "Theater Loews". I want to remove the word "Theater" before the actual movie theater name. Can I simply remove the word "Theater" below in i = GetEventID("Theater " & name)and i = hs.NewEvent("Theater " & name)?

    Sub CreateNewEvent (name, vrString, scriptname, misc)
    Dim i
    Dim ev
    Dim strGroup

    strGroup = "Theater"

    i = GetEventID("Theater " & name)

    if i = 0 then
    ' create new event since event was not already found
    i = hs.NewEvent("Theater " & name)
    end if

    set ev = hs.GetEvent(i)
    ev.vcmd = vrString
    ev.scripts = scriptname
    ev.group = strGroup
    ev.misc = misc

    end Sub

    #2
    You stated:
    <BLOCKQUOTE class="ip-ubbcode-quote"><font size="-1">quote:</font><HR> Below is a subroutine to create movie theater names. It places the word "Theater" in front of the actual movie theater name. For example, if the theater was called "Loews", the subroutine would create "Theater Loews". I want to remove the word "Theater" before the actual movie theater name. <HR></BLOCKQUOTE>

    I'm confused which isn't all that hard to do. If the function adds theater in front of the name and you want to remove it, why not just not run the function?

    -Rupp
    💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

    Comment


      #3
      Because it also creates the theater name. I think you still need that part of it, but I'm not sure. This is part of the movie vbs script. I want to eliminate the word "Theater" in front of the real theater name, so when the virtual devices are populated, they don't include "Theater" in the beginning of the title. I think I may also have to change something in the theater 2.txt doc as well. Who knows. I can't understand anything.

      Comment


        #4
        You should be able to replace what you have with the below.

        <pre class="ip-ubbcode-code-pre">
        Sub CreateNewEvent (name, vrString, scriptname, misc)
        Dim i
        Dim ev
        Dim strGroup

        strGroup = "Theater"

        i = GetEventID(name)

        if i = 0 then
        ' create new event since event was not already found
        i = hs.NewEvent(name)
        end if

        set ev = hs.GetEvent(i)
        ev.vcmd = vrString
        ev.scripts = scriptname
        ev.group = strGroup
        ev.misc = misc

        end Sub
        </pre>

        Doing this also assumes no other scripts are expecting the work Theater to precede the actual theater name.

        Comment


          #5
          Actually, Renegade, I think there might be one more area that uses the "Theater" in front. Take a look at this:


          'Find the device that has stored this theater's info

          if fromDatabase Then
          rstTable.Filter = "MovieDeviceTheaterName='" & mid(TheaterName, len("Theater ")) & "'"
          if not (rstTable.EOF and rstTable.BOF) Then
          Page = rstTable.Fields("MovieDeviceString")
          else
          Page = ""
          end if
          else
          uc = 1
          Page = ""
          Do while uc &lt;= NumberTheater
          if InStr(1,hs.DeviceString(TheaterHouseCode & cstr(uc)),TheaterName,vbTextCompare) &lt;&gt; 0 Then
          Page = hs.DeviceString(TheaterHouseCode & cstr(uc))
          Exit Do
          End if
          uc = uc + 1
          Loop
          End if

          if Page = "" Then
          hs.writelog "Theater Showtimes", TheaterName & " Not recorded in device " & TheaterHouseCode & " 1 through " & cstr(NumberTheater) 'mmcs 9-15-01 A,v2.2
          Exit Sub
          End if

          VoiceString = GetShownames(Page) 'uc)

          Comment


            #6
            What Renegade posted should answer your question. The Theater was placed in the start of the event name so all events related to the Movies package would be togther on the GUI. What I suggest doing rather than changing the name of the event, is to change the code in Theater Showtimes 2 that finds the event and remove the Theater prefix there.

            Theatername = hs.GetLastEvent

            would change to

            Theatername = Mid(hs.GetLastEvent,len("Theater ")+1)

            Comment

            Working...
            X