[Samurize] Text Wrap


Recommended Posts

in all sweetness i got my surfrepot to show up on my wonderful desktop...one problem!

the text is on long ass line and doesnt wrap the box like i want it to. please someone answer my cries for help....im soo close!

'------------------------------------------------------------------------

' Internet Script Template (v1.0)

'------------------------------------------------------------------------

'

' *** SCRIPT REQUEST ***

'

' A customisable template that should allow you to effectively write your

' own scripts with very little (or no) VBscripting knowledge. All you

' have to do is examine the HTML source for the page you want to get

' data from and change the six variables below.

'

' The script is already set up to work with FilePlanet.com, so if you

' want to have a good idea as to how this script works, I advise that

' you examine the source of the fileplanet.com website as well.

'

' PLEASE NOTE: I will provide very little (if any) support for this

' ------------ script. I only made it because I was asked by a user of my

' portal for a Script Template so he could have a go at

' making his own scripts.

'

' There are quite a few things that could go wrong with it

' (as far as wetting the variables below is concerned) so

' only attempt to use it if you have *SOME* idea of what

' you are doing ;)

'

'

' - NeM

'------------------------------------------------------------------------

' Stop by NeM Portal at http://samurize.breezeland.com/

'------------------------------------------------------------------------

'=========================================================================

' VARIABLES TO CHANGE:

'=========================================================================

'=========================================================================

' The name of the temp file you want to use for the script (needed for

' the GetInfoTempFile() function only)

'=========================================================================

TMP_FILE = "surfing.tmp"

'=========================================================================

'=========================================================================

' The url of the site you want to get your data from

'=========================================================================

SITE_URL = "http://newsmyrna.com/index.php?p=surfing"

'=========================================================================

'=========================================================================

' A string in the HTML source to verify that you have got the right page

' (eg. use the page title)

'=========================================================================

PAGE_CHECK = "<title>Welcome to"

'=========================================================================

'=========================================================================

' String to search for first - to advance to a spot just before each

' data item you want to extract.

' (NOTE: text containing quote marks (") must have two " marks to signify

' a " in the text.)

'=========================================================================

FIRST_CHECK = "bgcolor=""6492EB""> "

'=========================================================================

'=========================================================================

' String marking the end of all text before the text you are interested in

' (eg. if you were interested in the text of a hyperlink:

'

' <a href="somesite">My Text</a>

'

' you would set this to "somesite"">" for example.

'=========================================================================

FIRST_CHECK2 = "</b> -"

'=========================================================================

'=========================================================================

' String marking the end of the text you are interested in. eg. if you

' were interested in the text of a hyperlink:

'

' <a href="somesite">My Text</a>

'

' you would set this to "</a>"

'=========================================================================

END_CHECK = "<br />"

'=========================================================================

'=========================================================================

' DO NOT MODIFY ANYTHING PAST HERE UNLES YOU KNOW WHAT YOU ARE DOING!

'=========================================================================

Function GetInfo()

dim htmlResult,output,newsItem,mainFeature

htmlResult = ReturnHTML(SITE_URL)

output = NULL

startPos = instr(htmlResult, PAGE_CHECK)

if startPos > 0 then

Do While instr(startPos, htmlResult, FIRST_CHECK)>0

posOne = instr( startPos, htmlResult, FIRST_CHECK)

posOne = instr( posOne, htmlResult, FIRST_CHECK2) + Len(FIRST_CHECK2)

posTwo = instr( posOne, htmlResult, END_CHECK)

if posOne > 0 AND posTwo > posOne Then

'grab the name of the news item

newsItem = right(mid( htmlResult, posOne, posTwo-posOne ), posTwo-posOne)

end if

' new start position

startPos = posTwo

'append the user to the list and put a newline char after it

output = output & newsItem

' don't add a newline to the last item

If instr(startPos, htmlResult, FIRST_CHECK)>0 Then

output = output & (Chr(13) & Chr(10))

End If

Loop

else

output = "Could not obtain data."

end if

GetInfo = TrimHTML(output)

End Function

Function GetInfoTempFile()

set fs=CreateObject("Scripting.FileSystemObject")

set f=fs.CreateTextFile(TMP_FILE,true)

f.write(GetInfo())

f.close

set f=nothing

set fs=nothing

GetInfoTempFile = "OK!"

End Function

Private Function ReturnHTML(sURL)

Dim objXMLHTTP,HTML

Set objXMLHTTP = CreateObject("Microsoft.XMLHTTP")

objXMLHTTP.Open "GET", sURL, False

objXMLHTTP.Send

HTML = objXMLHTTP.responseBody

Set objRS = CreateObject("ADODB.Recordset")

objRS.Fields.Append "txt", 200, 45000, &H00000080

objRS.Open

objRS.AddNew

objRS.Fields("txt").AppendChunk HTML

ReturnHTML = objRS("txt").Value

objRS.Close

Set objRS = Nothing

Set objXMLHTTP = Nothing

End Function

' ******************************

' Following function by Alderaic

' ******************************

'very simple function that will remove all html tags

Private Function TrimHTML(str)

pos_deb = InStr(1, str, "<")

Do Until pos_deb = 0

pos_fin = InStr(pos_deb, str, ">")

part_d = Mid(str, 1, pos_deb - 1)

part_f = Mid(str, pos_fin + 1, Len(str) - pos_fin)

str = part_d & part_f

pos_deb = InStr(1, str, "<")

Loop

TrimHTML = str

End Function

Link to comment
https://www.neowin.net/forum/topic/103453-samurize-text-wrap/
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Brave Browser 1.91.172 is out.
    • Any Video Converter Free 9.2.3 by Razvan Serea Any Video Converter is an All-in-One video converting tool with an easy-to-use graphical interface, fast converting speed and excellent video quality. Any Video Converter supports all popular video formats and converts your videos to different video formats including MP4, MOV, MKV, M2TS, M4V, MPEG, AVI, WMV, ASF, OGV, WEBM, and more. It supports converting videos to customized percent (50%, 100%, 200%, and more) or resolution (480p, 720p, 1080p, 4K, and more); It supports encoding videos into x264, x265, h263p, xvid, mpeg, wmv, and more. Any Video Converter Free key features: Compatible with Windows 11/10/8.1/8/7 (32-64bit) User interface are available in 14 languages Convert all kinds of video formats including high-definition videos Extract audio from any videos and save as MP3/WMA for your mp3 player Take snapshot from any videos and build your own picture collection Support high-definition for both input and output Batch add videos from hard drive and batch convert Customize output parameters completely as you like Manage your output videos files by group or output profile Merge several video files into a single and long one Clip a video into segments Free Audio Filter: Adjust audio volume and add audio effects Crop frame size to remove black bars and retain what you want only Adjust the brightness, contrast, saturation Rotate or flip or add noise/sharpen effects Produce output video with subtitles of your own dialogue and much, much more... Any Video Converter Free 9.2.3 changelog: Fixed video download engine auto-update failures. Added custom speed control support in the speed change tool. Added support for downloading YouTube AI-generated subtitles. Added support for preserving original audio stream in the format convert tool (e.g., Dolby Atmos, DTS:X). Fixed other bugs and improved overall performance. Download: Any Video Converter Free 9.2.3 | 7.6 MB (Freeware) View: Any Video Converter Free Home Page | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • Not sure what country you’re in but in many countries you can absolutely jail the sellers behind businesses… in fact I’d say in most countries you can do that
    • I guess we are done since you refuse to read my comment you replied to or my other comment in another thread you were also a part of here.
    • I hate Slack, but Teams is much worse - maybe they've already optimized it, but it was a huge slog the last time I've checked about half a year ago. I miss my Skype.
  • Recent Achievements

    • Dedicated
      jordanspringer earned a badge
      Dedicated
    • Rookie
      Rimplesnort went up a rank
      Rookie
    • One Year In
      Markus94287 earned a badge
      One Year In
    • One Month Later
      Markus94287 earned a badge
      One Month Later
    • Week One Done
      Markus94287 earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      505
    2. 2
      +Edouard
      175
    3. 3
      PsYcHoKiLLa
      155
    4. 4
      ATLien_0
      90
    5. 5
      Steven P.
      79
  • Tell a friend

    Love Neowin? Tell a friend!