我是靠谱客的博主 大气大叔,最近开发中收集的这篇文章主要介绍SciTE的二次开发,用COM接口调用相关功能Programmatically interact with the SciTE editor via COM objects,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

Programmatically interact with the SciTE editor via COM objects

 September 20, 2015 - 6:15 amAutoHotKey, COM, GUI, Office Automation, Regular Expressions / RegEx, SciTE, Text Manipulation

SciTE editor via COM objects

SciTE editor via COM objects

SciTE is a great IDE that I use with AutoHotKey, SPSS, SQL, Python, XML, HTML, etc.   I love being able to use regular expressions in it to manipulate text and it has some very cool capabilities.  This video is one of my favorite demonstrations how powerful SciTE can be at manipulating text.

Here is a short tutorial and demonstration on how to manipulate SciTE editor via COM objects and Windows commands with AutoHotKey.

 

SciTE commands

 

SciTE editor via COM objects- Editor Windows Commands

 

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

;~ http://www.scintilla.org/SciTEDoc.html  ;SciTE commands

;~ http://www.scintilla.org/SciTEDirector.html  SciTE Director Interface

;~ http://www.scintilla.org/ScintillaDoc.html  ;SciTE documentation

;~ https://www.youtube.com/watch?v=upPtaEghnRM

#SingleInstance, Force                  

RAlt::Reload

RControl::

;************SciTE editor via COM objects- Editor Windows Commands************************************************

oSci := ComObjActive("SciTE4AHK.Application") ;get pointer to active SciTE editor window

;~ MsgBox % oSci.Selection ;Text that is selected

;~ MsgBox % oSci.Document ;get entire SciTE document

;~ MsgBox % oSci.CurrentFile ;path to current file

;~ MsgBox % oSci.SciTEHandle ;window handle

;~ MsgBox % oSci.ActivePlatform ;

;~ MsgBox % oSci.UserDir

;~ MsgBox % oSci.Version

;~ MsgBox % oSci.IsPortable ;I'm guessing blank means not portable. Prob a 1=portable

;~ MsgBox % oSci.SciTEDir

;~ oSci.ReloadProps() ;Reload property files

;~ oSci.OpenFile("C:temptest.ahk")

;~ oSci.DebugFile("C:temptest.ahk")

;***********tabs*******************

;~ MsgBox %  oSci.Tabs.count

;~ oSci.SwitchToTab(1) ;Switch to tab (zero based)

;~ MsgBox % oSci.Tabs.List ;list of open tabs

;~ for Tab_Path in oSci.Tabs.Array ;path to each open Tab

  ;~ MsgBox % "tab " A_Index a_tab Tab_Path

;~ oSci.InsertText("my Text") ;insert my Text

;~ oSci.InsertText(";my Text",30) ;insert my Text at position 30

;~ oSci.Message(0x111,420)  ;Clear output

;~ oSci.Output("hello world")

;***********Send DirectoryMessage*******************

;~ oSci.SendDirectorMsg("close:") ;close (lots of director messages to send

;~ oSci.SendDirectorMsg("find:Joe") ;find the next instance of the word Joe

;~ oSci.SendDirectorMsg("replaceall:Joe00Bob") ;replace all occurrencees of Joe with Bob

;~ oSci.SendDirectorMsg(saveas)

;***********SendMessage*******************

;~ https://autohotkey.com/docs/misc/SendMessageList.htm    0x111 is WM_COMMAND

;~ https://msdn.microsoft.com/en-us/library/windows/desktop/ms647591(v=vs.85).aspx

;~ oSci.Message(0x111,101)  ;create new tab

;~ oSci.Message(0x111,102)  ;Open File

;~ oSci.Message(0x111,103)  ;Open selected file name

;~ oSci.Message(0x111,104)  ;Revert file

;~ oSci.Message(0x111,105)  ;Close file

;~ oSci.Message(0x111,106)  ;Save file

;~ oSci.Message(0x111,110)  ;Save As

;~ oSci.Message(0x111,111)  ;Export as HTML

;~ oSci.Message(0x111,112)  ;Export as RTF

;~ oSci.Message(0x111,113)  ;Export as PDF

;~ oSci.Message(0x111,115)  ;Export as LaTeX

;~ oSci.Message(0x111,116)  ;Save a copy

;~ oSci.Message(0x111,118)  ;Copy path of this file

;~ oSci.Message(0x111,130)  ;Page Setup

;~ oSci.Message(0x111,131)  ;Print

;~ oSci.Message(0x111,132)  ;Load Session

;~ oSci.Message(0x111,133)  ;Save current Session

;~ oSci.Message(0x111,140)  ;Quit SciTE

;~ oSci.Message(0x111,150)  ;clear encoding?

;~ oSci.Message(0x111,151)  ;UTF-16 Big Endian

;~ oSci.Message(0x111,152)  ;UTF-16 Little Endian encoding

;~ oSci.Message(0x111,153)  ;UTF-8 with BOM

;~ oSci.Message(0x111,154)  ;UTF-8

;~ oSci.Message(0x111,201)  ;Undo

;~ oSci.Message(0x111,202)  ;Redo?

;~ oSci.Message(0x111,203)  ;Cut

;~ oSci.Message(0x111,204)  ;Copy Highlighted text

;~ oSci.Message(0x111,205)  ;Paste?

;~ oSci.Message(0x111,206)  ;Delete

;~ oSci.Message(0x111,207)  ;Highlight all text in main window / Select All

;~ oSci.Message(0x111,208)  ;Paste text

;~ oSci.Message(0x111,230)  ;Match to brace (finds matching brace

;~ oSci.Message(0x111,232)  ;Show Calltip

;~ oSci.Message(0x111,234)  ;Complete word

;~ oSci.Message(0x111,240)  ;UPPERCASE selected text

;~ oSci.Message(0x111,241)  ;Lowercase selected text

;~ oSci.Message(0x111,242)  ;Block Comment (toggle ;~ on multiple lines)

;~ oSci.Message(0x111,244)  ;Stream comment */text/*

;~ oSci.Message(0x111,245)  ;Copy as RTF

;~ oSci.Message(0x111,246)  ;Box comment */ mutliple lines`n /*

;~ oSci.Message(0x111,248)  ;Join Paragraph

;~ oSci.Message(0x111,303)  ;run (F5)

;~ oSci.Message(0x111,304)  ;Stop

;~ oSci.Message(0x111,401)  ;output - verticle split- toggle

;~ oSci.Message(0x111,402)  ;View whitespace

;~ oSci.Message(0x111,403)  ;View End of Line

;~ oSci.Message(0x111,404)  ;???????????

;~ oSci.Message(0x111,405)  ;View extra space after number

;~ oSci.Message(0x111,406)  ;View Margin

;~ oSci.Message(0x111,407)  ;View linenumbers

;~ oSci.Message(0x111,408)  ;View Toolbar

;~ oSci.Message(0x111,409)  ;View output bar

;~ oSci.Message(0x111,410)  ;View Tab bar

;~ oSci.Message(0x111,411)  ;View statusbar

;~ oSci.Message(0x111,412)  ;View parameters

;~ oSci.Message(0x111,414)  ;Wrap

;~ oSci.Message(0x111,415)  ;Wrap output

;~ oSci.Message(0x111,420)  ;Clear output

;~ oSci.Message(0x111,421)  ;Switch pane

;~ oSci.Message(0x111,461)  ;Open SciTEUser.Properties filew

;~ oSci.Message(0x111,960)  ;Always on top

;~ oSci.Message(0x111,1118) ;Open new SciTE window

;~ oSci.Message(0x1000+2)   ;reload utilities?

;****** end of SciTE editor via COM objects*****

;***********use spy to find wm_command;*******************

;~ https://autohotkey.com/board/topic/90307-hotkeyp-spy-utility-for-detecting-wm-command-messages/

 

A specific version of the SciTE editor for AutoHotKey can be downloaded here and more generic documentation can be found here.

最后

以上就是大气大叔为你收集整理的SciTE的二次开发,用COM接口调用相关功能Programmatically interact with the SciTE editor via COM objects的全部内容,希望文章能够帮你解决SciTE的二次开发,用COM接口调用相关功能Programmatically interact with the SciTE editor via COM objects所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(69)

评论列表共有 0 条评论

立即
投稿
返回
顶部