[VBS] {+} werkt niet *

Pagina: 1
Acties:

  • GewoonNico
  • Registratie: April 2003
  • Laatst online: 01:29
Hallo,

ik ben (voor de 1e keer) bezig met een scriptje als uitbreiding op FMA, een programma om je Sony Ericsson T630 te verbinden met je computer.

Nu kun je via bluetooth allerlei leuke dingen besturen op je computer.
Mijn idee, was om een plugin te maken waarmee ik mijn tv programma mee kan besturen.

Ik ben ver gekomen, hang alleen vast op 1 stukje.

[vbs]
Sub VolumeDown
If WinTVOpen Then Shell.SendKeys "{-}"
am.Update
End Sub
Sub VolumeUp
If WinTVOpen Then Shell.SendKeys "{+}"
am.Update
End Sub
[/vbs]
Dit werkt niet, waarschijnlijk omdat de - en de + niet herkend worden... ofzo?
De rest van mijn scriptje werkt wel.

Wie weet hoe je een + of een - verstuurd met de functie Shell.Sendkeys?

[ Voor 2% gewijzigd door GewoonNico op 31-08-2004 21:52 . Reden: Wilde titel veranderen maar kan niet meer :S ]


  • F_J_K
  • Registratie: Juni 2001
  • Niet online

F_J_K

Moderator CSA/PB

Front verplichte underscores

[google=vbs SendKeys] --> http://www.jsiinc.com/SUBF/Tip2500/rh2531.htm
{+} zou inderdaad moeten werken. Heb je het getest met bijv, kladblok? Misschien iets specifiek van FTA; met de hand werkt het wel en de focus is goed?

Code kan trouwens tussen [ code ] tags. Ik pas ook je topictitel iets aan.

'Multiple exclamation marks,' he went on, shaking his head, 'are a sure sign of a diseased mind' (Terry Pratchett, Eric)


  • GewoonNico
  • Registratie: April 2003
  • Laatst online: 01:29
Nou,

De rest werkt wel perfect.

Dit is het hele script
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
'FMA Script Framework Plugin
'CinergyTv
'Lets you control Cinergy TV

Class CinergyTV
    
    Private m_Self
    Private mainMenu
    Private tvRemoteMenu
    
    'Some info about the plugin
    Public Property Get SHOWABLE 'Do I have a menu?
        SHOWABLE    = True
    End Property
    Public Property Get TITLE 'What's my name?
        TITLE       = "Cinergy TV"
    End Property
    Public Property Get DESCRIPTION 'What's my purpose?
        DESCRIPTION = "Lets you control Cinergy TV"
    End Property
    Public Property Get AUTHOR 'Who created me?
        AUTHOR      = "Nico Habets"
    End Property
    Public Property Get URL 'Were can I be found? Where can you get more information?
        URL = "http://fma.xinium.com/"
    End Property
    
    'Who am I?
    Public Property Let Self (s)
        m_Self = s
        ' Some init stuff here:
        If IsEmpty(Settings(Me, "Title")) or Settings(Me, "Title") = "" Then Settings(Me, "Title") = "Cinergy Control"
        If IsEmpty(Settings(Me, "Exe"))   or Settings(Me, "Exe")   = "" Then Settings(Me, "Exe")   = "E:\Program Files\TerraTec\CinergyTV\TerraTV App.exe"
        
        'MainMenu items will be put every time Show() is called
        Set mainMenu = New ManagedMenu
        
        'RatingMenu items are static. We can initialize them once
        Set tvRemoteMenu = New ManagedMenu
        Dim tempList, bi
        Set tempList = New LinkedList
        bi = tempList.BackInserter
        bi.Item = Array("Button 1", s & ".Button1")
        bi.Item = Array("Button 2", s & ".Button2")
        bi.Item = Array("Button 3", s & ".Button3")
        bi.Item = Array("Button 4", s & ".Button4")
        bi.Item = Array("Button 5", s & ".Button5")
        bi.Item = Array("Button 6", s & ".Button6")
        bi.Item = Array("Button 7", s & ".Button7")
        bi.Item = Array("Button 8", s & ".Button8")
        bi.Item = Array("Button 9", s & ".Button9")
        bi.Item = Array("Button 0", s & ".Button0")
        tvRemoteMenu.SetList tempList
        tvRemoteMenu.Title = "TV - Remote"
    End Property
    Public Property Get Self
        Self = m_Self
    End Property
    
    'Display me. Eventually put a menu on the screen
    Sub Show()
        '--> Init Menu
        Set llist = New LinkedList
        Dim bi
        bi = llist.BackInserter
        If WinTVOpen Then
            bi.Item = Array("Channel Up",   Self & ".ChannelUp")
            bi.Item = Array("Channel Down", Self & ".ChannelDown")
            bi.Item = Array("Volume Up",    Self & ".VolumeUp")
            bi.Item = Array("Volume Down",  Self & ".VolumeDown")
            bi.Item = Array("Fullscreen",   Self & ".Fullscreen")
            bi.Item = Array("Close",        Self & ".Close")
        Else
            bi.Item = Array("Launch",       Self & ".Launch")
        End If
        mainMenu.SetList llist
        mainMenu.Title = TITLE
        mainMenu.ShowMenu
    End Sub
    
    Function WinTVOpen
        WinTVOpen = Shell.AppActivate(Settings(Me, "Title"))
    End Function
    
    Sub Launch
        If Fso.FileExists(Settings(Me, "Exe")) Then
            Shell.Exec Settings(Me, "Exe")
            Util.WaitForAppLoad Settings(Me, "Title"), 10000 'Give WinTV max. 10 secs to load
        Else
            Debug.ErrorMsg Self & " - Launch: File not found: " & Settings(Me, "Exe")
        End If
        Show
    End Sub
    
    Sub Close
        If WinTVOpen Then
            Shell.SendKeys "%{F4}"
            Util.Sleep 3000 'Give Cinergy TV 3secs to close itself
        End If
        Show
    End Sub
    Sub Button1
        If WinTVOpen Then    Shell.SendKeys 1
        am.Update
    End Sub
    Sub Button2
        If WinTVOpen Then    Shell.SendKeys 2
        am.Update
    End Sub
    Sub Button3
        If WinTVOpen Then    Shell.SendKeys 3
        am.Update
    End Sub
    Sub Button4
        If WinTVOpen Then    Shell.SendKeys 4
        am.Update
    End Sub
    Sub Button5
        If WinTVOpen Then    Shell.SendKeys 5
        am.Update
    End Sub
    Sub Button6
        If WinTVOpen Then    Shell.SendKeys 6
        am.Update
    End Sub
    Sub Button7
        If WinTVOpen Then    Shell.SendKeys 7
        am.Update
    End Sub
    Sub Button8
        If WinTVOpen Then    Shell.SendKeys 8
        am.Update
    End Sub
    Sub Button9
        If WinTVOpen Then    Shell.SendKeys 9
        am.Update
    End Sub
    Sub Button0
        If WinTVOpen Then    Shell.SendKeys 0
        am.Update
    End Sub

    Sub ChannelDown
        If WinTVOpen Then Shell.SendKeys "{DOWN}"
        am.Update
    End Sub
    Sub ChannelUp
        If WinTVOpen Then Shell.SendKeys "{UP}"
        am.Update
    End Sub
    Sub VolumeDown
        If WinTVOpen Then Shell.SendKeys "{-}"
        am.Update
    End Sub
    Sub VolumeUp
        If WinTVOpen Then Shell.SendKeys "{+}"
        am.Update
    End Sub
    Sub Fullscreen
        If WinTVOpen Then Shell.SendKeys "{F11}"
        am.Update
    End Sub

End Class


Ik wil een + en een - verzenden die op het numpad staan.
Ik heb google gezocht, heb handige sites gevonden maar hier staat overal niks over het numpad.

  • Spider.007
  • Registratie: December 2000
  • Niet online

Spider.007

* Tetragrammaton

partypas, ik verplaats je topic even naar het juiste subforum; namelijk PW. Het neerplempen van je code wordt alleen niet echt gewaardeerd op GoT omdat het wel heel erg erop lijkt dat je wilt dat wij je code gaan debuggen. :) Vertel even wat je zelf allemaal al hebt geprobeerd zodat we geen dingen dubbel hoeven doen.

SA > PW

---
Prozium - The great nepenthe. Opiate of our masses. Glue of our great society. Salve and salvation, it has delivered us from pathos, from sorrow, the deepest chasms of melancholy and hate


  • GewoonNico
  • Registratie: April 2003
  • Laatst online: 01:29
Ik heb geprobeerd:


{NUM +}
{NUMPAD +}
{+}
Zie regel 156

Maar werkte allemaal niet.
De rest van de code is prima, omdat ik dit heb getest.

Het enige probleem is het verzenden van een + en een - vanuit het Numerieke Toetsenbord (numpad)

[ Voor 4% gewijzigd door GewoonNico op 31-08-2004 22:30 ]