您如何在bartender vb脚本中实现以下逻辑?
while
(
ReceiveNextEvent
(
0,
NULL,
0.001, // kEventDurationForever,
kEventRemoveFromQueue,
&theEvent
)
==
noErr
)
{
if (GetEventKind(theEvent) == kEventAppleEvent)
AEProcessEvent(theEvent);
SendEventToEventTarget(theEvent, theTarget);
ReleaseEvent(theEvent);
}
= 33 + 1 + 8 + 38 + 31 + 21 + 4 + 0 + 1 + 9 + 7 + 3 + 6 + 6 = 168
X18 VL40197366
,X=33
," "=38
。
现在上面的结果存储到名为“temp1”的变量中 其中temp1包含now = 168; `temp1中= 168``
我的代码如下。我知道我的代码不完整,如果我错了请纠正我
V=31, L=21
如何实现这一点!
提前致谢
答案 0 :(得分:0)
首先,我显然不明白你想要做什么。
但是,在您的情况下,您应该使用Dictionary类而不是声明单个变量。
Dim dicResult as new Dictionary(Of String, Decimal)
Dim arrSymballs() As String = {"A","B","C","D","E","F","G","H","I"} ''You can add more
Dim iValue As Decimal = 10
For i As Integer = 0 To arrSymballs.Length-1
dicResult.Add(arrSymballs(i), iValue)
iValue += 1
Next
''Function to get string from result
''I don't know how the result you will get the following logic is for "10,11,12,13,14,15"
Private Function getResultString(_result As String) As Decimal
Dim dNumResult As Decimal
For Each c As String in _result.Split(",")
dNumResult += dicResult(c)
Next
Return dNumResult
End Function
答案 1 :(得分:0)
您没有将变量声明为数字类型。编译器猜测您希望它们是字符串,因为Format
返回一个字符串。您必须将字符串值转换为数值。
Integer.Parse(文本)
temp6 = Integer.Parse(temp5) + x
当您拥有大量变量时,请考虑使用数组。
Dim iValues As Integer() = New Integer() {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}
temp6 = Integer.Parse(temp5)+ iValues(24)