Total Commander Forum Index Total Commander
Форум поддержки пользователей Total Commander
Сайты: Все о Total Commander | Totalcmd.net | Ghisler.com | RU.TCKB
 
 RulesRules   SearchSearch   FAQFAQ   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Single Post  Topic: Script Request 
Author Message
Flasher



PostPosted: Wed Aug 17, 2011 19:10    Post subject: Reply with quote

Code:
' Отправить в буфер RGB-число

Do Until Main
Loop

Function Main
  Main = False
  L = vbNewLine
  A = InputBox(L&"      Введите через пробел три числа (0-255),"&_
  "            соответствующие своему цвету "& L & "      ""красный зелёный синий""",_
  "                          Конвертация в RGB-число","0 0 0")
If A = vbNullString Then WScript.Quit

  For i = 1 to Len(A)
    N = Mid(A,i,1)
    If N = " " Then Sp = Sp & N
  Next
  If Len(Sp) <> 2 Then
    MsgBox "Необходимо указать 3 числа с 2-мя пробелами !", vbExclamation,_
    "                            Конвертация в RGB-число"
    Exit Function
  End If

  R = Left(A, Instr(A," ")-1)
  C = Mid(A,Len(R)+2)
  G = Left(C, Instr(C," ")-1)
  B = Mid(A, InstrRev(A," ")+1)

  For Each E in Array(R,G,B)
    If IsNumeric(E)=False Then
      MsgBox "Все значения должны быть числовыми !", vbExclamation,_
      "                     Конвертация в RGB-число"
      Exit Function
    End if
    If E<0 Or E>255 Then
      MsgBox "Все числа должны лежать в диапазоне [0-255] !", vbExclamation,_
      "                             Конвертация в RGB-число"
      Exit Function
    End If
  Next
  Main = True

  Dim WSH
  Set WSH = CreateObject("WScript.Shell")
  P = "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3\1407"
  A = WSH.RegRead(P)
  If A > 0 Then WSH.RegWrite P, 0, "REG_DWORD"
  With CreateObject("InternetExplorer.Application")
    .Navigate("about:blank")
    .document.parentWindow.clipboardData.setData "text", Trim(RGB(R, G, B))
    .Quit
  End With
  If A > 0 Then WSH.RegWrite P, A, "REG_DWORD"
  Set WSH = Nothing

  WScript.Quit
End Function


Last edited by Flasher on Fri Aug 19, 2011 22:38; edited 1 time in total
View user's profile Send private message


Powered by phpBB © 2001, 2005 phpBB Group