hi all,
I uploaded the wrong script yesterday.  here is the one i have a problem with
' a stupid test script
' testing hotkey manager stuff

Dim myIni : myIni = ClientInformation.ScriptPath & "\stupid.ini"
Dim myXml : myXml = ClientInformation.ScriptPath & "\stupid.xml"
Dim myStrings : Set myStrings = Strings(myXml)
Dim RHK : Set RHK = CreateObject("Scripting.Dictionary")
' Client info stuff
ClientInformation.ScriptName = myStrings("sName")
ClientInformation.ScriptVersion = myStrings("versionNum")
' do the hotkey junk
If Not SharedObjects("com.GWMicro.GWToolkit.HotkeyManager") Is Nothing Then
Set hkm = SharedObjects("com.GWMicro.GWToolkit.HotkeyManager").NewDialog
If Not hkm Is Nothing Then
hkm.INIFileName = myIni
hkm.INISectionName = "hotkeys"
Set hkm.KeyStrings = myStrings
End If
End If

' register the hotkeys
Sub registerHotkeys()
If Not hkm Is Nothing Then
If UBound(Split(INIFile(myIni).GetSectionKeys(hkm.INISectionName), vbNullChar)) 
< 0 Then
hkm.Add "Key01", "control-Windows-c", "convert"
End If


If Not RHK Is Nothing Then
If RHK.Count > 0 Then
RHK.RemoveAll
End If
End If
'build array
Dim iniArray : iniArray = 
Split(IniFile(myIni).GetSectionKeys(hkm.INISectionName), vbNullChar)
Dim iniKeyID
For Each iniKeyID In iniArray
Dim details : details = Split(hkm.Data(iniKeyID), "||")

  Set RHK(iniKeyID) = Keyboard.RegisterHotkey(hkm.Key(iniKeyID), details(0), 
Nothing))
  Next
 End If
End Sub

' actually call hotkey manager
RegisterHotkeys


' now paste my script and get rid of the built in hotkey
Dim obj : Set obj = SharedObjects("com.GWMicro.GWToolkit.StandardHelpDialog")
Sub Convert()
Dialog "test.xml", "number", "DoDialog"
End Sub

' the dialog function
Function DoDialog(dLog, ddo, what, value)
DoDialog = False
Select Case what
Case "c2f"
if ddo = buttonClicked Then
cConv = dLog.Control("num")
mathc(cConv)
DoDialog = True
Exit Function
End If

Case "f2c"
If ddo = buttonClicked Then
FConv = dLog.Control("num")
mathF(fConv)
DoDialog = True

Exit Function
End If

Case "close"
If ddo = buttonClicked Then
dLog.close
Exit Function
End If
Case Else
If ddo = dialogCreated Then
DoDialog = True
Exit Function
End If
End Select
End Function
' convert Celcius to Farenheit

Function mathc(cConv)
result = (1.8*cConv)+32
speak " that works out to be" & result & "Farenheit"
End Function

' convert Farenheit to Celcius
Function mathF(fConv)
res = (fConv - 32)/1.8
speak fConv & "equals " & res
End Function
Function help()
If obj = SharedObjects("com.GWMicro.GWToolkit.StandardHelpDialog") Then
speak ClientInformation.ScriptHelp
End If
End Function

Reply via email to