Advertisement
Guest User

Переходы по модулю.vbs

a guest
May 20th, 2025
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. '===========================================================================
  2. Sub GotoBeginOfMethod()
  3.     set doc = CommonScripts.GetTextDocIfOpened(0)
  4.     if doc is Nothing then Exit Sub
  5.  
  6.     ModuleText = split(doc.Text, vbCrLf)
  7.     for i = doc.SelStartLine to 0 step -1
  8.         sText = UCase(lTrim(ModuleText(i)))
  9.         if Instr(sText,"ПРОЦЕДУРА") > 0 or Instr(sText,"ФУНКЦИЯ") > 0 _
  10.         or Instr(sText,"SUB") = 1 or Instr(sText,"FUNCTION") =1 or Instr(sText,"PRIVATE") = 1 then
  11.             doc.MoveCaret i, 0
  12.             Exit For
  13.         end if
  14.     next
  15. End Sub ' GotoBeginOfMethod
  16.  
  17. '===========================================================================
  18. Sub GotoEndOfMethod()
  19.     set doc = CommonScripts.GetTextDocIfOpened(0)
  20.     if doc is Nothing then Exit Sub
  21.  
  22.     ModuleText = split(doc.Text, vbCrLf)
  23.     for i = doc.SelStartLine to UBound(ModuleText)
  24.         sText = UCase(lTrim(ModuleText(i)))
  25.         if Instr(sText,"КОНЕЦПРОЦЕДУРЫ") > 0 or Instr(sText,"КОНЕЦФУНКЦИИ") > 0 _
  26.         or Instr(sText,"END SUB") = 1 or Instr(sText,"END FUNCTION") =1 then
  27.             doc.MoveCaret i, 0
  28.             Exit For
  29.         end if
  30.     next
  31. End Sub ' GotoEndOfMethod                                                  
  32.  
  33. '=========================================================================
  34. Sub SelectProcedure()
  35.   set doc = CommonScripts.GetTextDocIfOpened(0)
  36.   if doc is Nothing then Exit Sub
  37.  
  38.   GotoBeginOfMethod()
  39.   l1 = Doc.SelStartLine
  40.   GotoEndOfMethod()
  41.   l2 = Doc.SelStartLine
  42.  
  43.   Doc.MoveCaret l1, 0, l2+1, 0
  44. End Sub
  45.  
  46. '========================================================================================
  47. Private Sub Init()
  48.     Set c = Nothing
  49.     On Error Resume Next
  50.     Set c = CreateObject("OpenConf.CommonServices")
  51.     On Error GoTo 0
  52.     If c Is Nothing Then
  53.         Message "Не могу создать объект OpenConf.CommonServices", mRedErr
  54.         Message "Скрипт " & SelfScript.Name & " не загружен", mInformation
  55.         Scripts.UnLoad SelfScript.Name
  56.         Exit Sub
  57.     End If
  58.     c.SetConfig(Configurator)
  59.     SelfScript.AddNamedItem "CommonScripts", c, False
  60. End Sub
  61. '========================================================================================
  62. Init
  63.  
  64.  
  65.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement