Jump to content

SciEdToYahoo.au3


ValeryVal
 Share

Recommended Posts

This script SciEdToYahoo.au3 can help you write out syntax highlighting of source on Yahoo.

How it is highlighted by Yahoo see here

How it works:

1. Write AutoIt script by Scied editor.

2. Export it as HTML

3. Open this html file in any simple text editor (Notepad or other)

4. Start this SciEdToYahoo.au3. Script has three Hotkeys - {Ctrl-g}- call func Convert, {Alt-m} - call func Message and Esc - exit.

5. Return into editor window. Select all content and press {Ctrl-g}. New content of text editor will be converted into form recognized by Yahoo rich text editor. Don't close this window.

6. Start new message for Yahoo group. Select mode Yahoo rich text editor and check on View HTML Source.

7. Now you can paste curent content of clipboard (for Yahoo rich text editor) - {Ctrl-v}. If clipboard was changed then you can get rich text of script from window of simple editor (See 5. Above) - {Ctrl-a} and paste it for Yahoo.

;===================================

; Convert SCIED html text from clipboard

; to Yahoo html text

Global $T,$S,$Ts

HotKeySet("^g", "Convert")

HotKeySet("{ESC}", "Terminate")

HotKeySet("!m", "Message") ;Alt-m

CreateTemplate()

while 1

Sleep(100)

wEnd

func Terminate()

Exit 0

endfunc

func Message()

MsgBox(4096,"","It works.")

endfunc

;===================================

; Convert text of clipboard to Yahoo HTML code

func Convert()

local $Content

local $Start = '<body bgcolor="#FFFFFF">'

local $End = '</body>'

Send("^c")

$Content = ClipGet()

$x = 1

if StringInStr($Content,$Start) then $x = StringInStr($Content, $Start) + StringLen($Start)

$y = StringLen(StringTrimLeft($Content, $x))

if StringInStr($Content, $End) then $y = StringInStr(StringTrimLeft($Content, $x), $End)

$Content = StringMid($Content, $x, $y)

$Content = StringReplace($Content, "<span>", $Ts)

for $i = 1 to $S[0]

$Content = StringReplace($Content, 'class="S' & $S[$i] & '">', 'style="' & $T[$i] & ';">')

next

ClipPut($Content)

Send("^v")

endfunc

;===================================

; Make conversion template

func CreateTemplate()

$Tc = ""

$Tc &= "color: rgb(0, 0, 0)/"

$Tc &= "font-style: italic; color: rgb(0, 153, 51)/"

$Tc &= "font-style: italic; color: rgb(102, 153, 0)/"

$Tc &= "font-style: italic; font-weight: bold; color: rgb(172, 0, 169)/"

$Tc &= "font-style: italic; font-weight: bold; color: rgb(0, 0, 144)/"

$Tc &= "font-weight: bold; color: rgb(0, 0, 255)/"

$Tc &= "font-weight: bold;color: rgb(255, 51, 255)/"

$Tc &= "font-weight: bold; color: rgb(153, 153, 204)/"

$Tc &= "font-weight: bold; color: rgb(255, 0, 0)/"

$Tc &= "font-weight: bold; color: rgb(170, 0, 0)/"

$Tc &= "font-style: italic; color: rgb(240, 0, 255)/"

$Tc &= "font-style: italic;color: rgb(160, 15, 240)/"

$Tc &= "font-style: italic; color: rgb(160, 15, 240/"

$Tc &= "font-style: italic; font-weight: bold; color: rgb(0, 0, 255)/"

$Tc &= "font-style: italic; font-weight: bold; color: rgb(111, 111, 179)"

$T = StringSplit($Tc,"/")

$S = StringSplit("0,1,2,3,4,5,6,7,8,9,11,12,14,15",",")

$Ts = "<span style=""font-family: 'Courier New'; color: rgb(0, 0, 0); font-size: 10pt;"">"

endfunc

Valery

The point of world view

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...