Can anyone help me with the right syntax to call the scripts once added to the .Net program as resources?
Maybe an example of what I'm trying to do would explain better than I can. Here's code that runs in a WinForm just fine:
Code: Select all
Imports AutoHotkey.Interop
Public Class Form1
Public ahkWord As Object
Public iOp = AutoHotkeyEngine.Instance
Public ahk = CreateObject("AutoHotkey.Script")
Private Sub btnWord_Click(sender As Object, e As EventArgs) Handles btnWord.Click
SendAHKeys()
End Sub
Sub SendAHKeys()
'Dim ahkWord As Object
ahk.ahktextdll("ahkWord := ComObjCreate(""Word.Application"")" & vbLf &
"ahkWord.Documents.Add" & vbLf &
"ahkWord.Visible := 1, ahkWord.Activate" & vbLf &
"FilePath := ""C:\test\AHK_test\WL-RTF.docx""" & vbLf &
"oDoc := ComObjGet(FilePath)" & vbLf &
"Sleep, 100" & vbLf &
"oDoc.Range.FormattedText.Copy" & vbLf &
"oDoc.Close(0)" & vbLf &
"WinActivate, ahkWord" & vbLf &
"Send, ^v" & vbLf &
"Send, {Backspace}")
End Sub
End Class
instead of typing it in the VS code as above:
Code: Select all
ahkWord := ComObjCreate(""Word.Application"") ; do I still need the double quotes if I'm calling the script from .resx?
ahkWord.Documents.Add
ahkWord.Visible := 1, ahkWord.Activate
FilePath := ""?????????""" ;what do I use for the filepath? My.Resources.RTFFile? Does it need quotes?
oDoc := ComObjGet(FilePath)
Sleep, 100
oDoc.Range.FormattedText.Copy
oDoc.Close(0)
WinActivate, ahkWord
Send, ^v
Send, {Backspace}
I know I'm asking a lot here, and I really appreciate you taking the time to look at it.