Advertisement
astrema

My LibreOffice Macro

Sep 5th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Sub Macro1
  2.  
  3.     Dim searchre as Integer
  4.     Dim doc as object
  5.     Dim my_cell as object
  6.     Dim TimingInfo
  7.     Dim start_hour as Integer
  8.     Dim start_min as Integer
  9.     Dim start_sec as Integer
  10.     Dim start_milsec as Integer
  11.     Dim end_hour as Integer
  12.     Dim end_min as Integer
  13.     Dim end_sec as Integer
  14.     Dim end_milsec as Integer
  15.     Dim startmin_insecs as Integer
  16.     Dim starthour_insecs as Integer
  17.     Dim endhour_insecs as Integer
  18.     Dim endmin_insecs as Integer
  19.     Dim start_totalsecs as Integer
  20.     Dim end_totalsecs as Integer
  21.     Dim startunformtime as String
  22.     Dim startformtime as String
  23.     Dim endunformtime as String
  24.     Dim endformtime as String
  25.     Dim row
  26.     Dim Truncell
  27.     Dim my_celllen as Integer
  28.     Dim num_cell
  29.    
  30.     row = 0
  31.     doc = ThisComponent
  32.     my_sheets = doc.Sheets(0)
  33.     my_cell = my_sheets.getCellByPosition(1,row)
  34.     TimingInfo = my_sheets.getCellByPosition(2,row)
  35.    
  36.    
  37.    
  38.     Do Until my_cell.String = ""  
  39.         my_cell = my_sheets.GetCellByPosition(1,row)
  40.         Truncell = my_sheets.GetCellByPosition(3,row)
  41.         num_cell = my_sheets.GetCellByPosition(0,row)
  42.         searchre = InStr(my_cell.String, "Dialogue")
  43.         TimingInfo = my_sheets.getCellByPosition(7,row)
  44.         start_hour = Mid(my_cell.String, 13, 1)
  45.         start_min = Mid(my_cell.String, 15, 2)
  46.         start_sec = Mid(my_cell.String, 18, 2)
  47.         start_milsec = Mid(my_cell.String, 21, 2)
  48.    
  49.         end_hour = Mid(my_cell.String, 24, 1)
  50.         end_min = Mid(my_cell.String, 26, 2)
  51.         end_sec = Mid(my_cell.String, 29, 2)
  52.         end_milsec = Mid(my_cell.String, 32, 2)
  53.    
  54.         startmin_insecs = start_min * 60
  55.         starthour_insecs = start_hour * 3600
  56.    
  57.         endhour_insecs = end_hour * 3600
  58.         endmin_insecs = end_min *60
  59.    
  60.         start_totalsecs = start_sec + startmin_insecs + starthour_insecs
  61.         end_totalsecs = end_sec + endmin_insecs + endhour_insecs
  62.    
  63.         startunformtime = start_totalsecs & "." & start_milsec
  64.         startformtime = Format(startunformtime, "#####.000000")
  65.    
  66.         endunformtime = end_totalsecs & "." & end_milsec
  67.         endformtime = Format(endunformtime, "#####.000000")
  68.         If searchre = 0 Then
  69.             Else
  70.                 TimingInfo.String = startformtime & "   " & endformtime & " " & num_cell.String
  71.                 my_celllen = Len(my_cell.String)
  72.                 my_cell.String = Mid(my_cell.String, 51, my_celllen - 50)
  73.         End If
  74.         Row = Row + 1
  75.         my_cell = my_sheets.GetCellByPosition(1,Row)
  76.     Loop   
  77. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement