Avatar billede twg Nybegynder
09. juni 2000 - 14:31 Der er 4 kommentarer og
1 løsning

<a href="X">X</a>

Er der nogen der vil/kan videreudvikle scriptet i dettte spørsmål http://www.eksperten.dk/spm.asp?id=40

Sådan at man bare vælger en *.txt fil på harddisken og så den ændre alle linieskift til <br> og sætter <a href="X">X</a> om:
http://www.domæne.dk
http://domæne.dk
www.domæne.dk
domæne.dk
og <a href="mailto:X">X</a> om alle mail adresser.

og derefter gemmer den filen som X.html
Avatar billede erikjacobsen Ekspert
09. juni 2000 - 14:41 #1
Det skal laves om til X.html ??? Hvad med at bruge et andet sprog, Perl, f.eks?
Der kan det gøres på én linie, i stedet for de gigantiske kodestumper i
bemeldte spørgsmål...
Avatar billede twg Nybegynder
09. juni 2000 - 14:50 #2
Det skal helts være i asp
Avatar billede phylox2 Nybegynder
09. juni 2000 - 15:13 #3
Sådan her, får du hentet en *.txt fil ind i scriptet, men jeg kan ikke lige på stående fod gennemskue www.domaine.dk og domaine.dk highlightningen :)


<%

Function WebString (Pstr)
    StartPos = 0
    Pstr = " " & Pstr & " "
    SearchString1 = "http://"
    SearchString2 = " "
    SearchString3 = "&quot;"
    SearchString4 = ")"
    SearchString5 = "'"
    SearchString6 = ","
    SearchString7 = "\"
    SearchString8 = Chr(10)
    SearchString9 = "&lt;"
    SearchString10 = "&gt;"
    Insert1 = "<A HREF=""#"" OnClick=""window.open('"
    Insert2 = "','NettetStartSide','toolbar=no,location=no,status=yes,menubar=no,scrollbars=yes,width=600,height=400,resizable=yes');"">"
    Insert3 = "</A>"
    Do
        PstrLen = Len(Pstr)
        ' Find Link start
    StartPos = InStr(StartPos + 1, Pstr, SearchString1)
        ' Find Link slut
    EndPos1 = InStr(StartPos + Len(SearchString1), LCase(Pstr), SearchString2)
        EndPos2 = InStr(StartPos + Len(SearchString1), LCase(Pstr), SearchString3)
        EndPos3 = InStr(StartPos + Len(SearchString1), LCase(Pstr), SearchString4)
        EndPos4 = InStr(StartPos + Len(SearchString1), LCase(Pstr), SearchString5)
        EndPos5 = InStr(StartPos + Len(SearchString1), LCase(Pstr), SearchString6)
        EndPos6 = InStr(StartPos + Len(SearchString1), LCase(Pstr), SearchString7)
        EndPos7 = InStr(StartPos + Len(SearchString1), LCase(Pstr), SearchString8)
        EndPos8 = InStr(StartPos + Len(SearchString1), LCase(Pstr), SearchString9)
        EndPos9 = InStr(StartPos + Len(SearchString1), LCase(Pstr), SearchString10)
    ' Tilintetgør dem der er 0
        If EndPos1 = 0 Then EndPos1 = PstrLen + 1
        If EndPos2 = 0 Then EndPos2 = PstrLen + 1
        If EndPos3 = 0 Then EndPos3 = PstrLen + 1
        If EndPos4 = 0 Then EndPos4 = PstrLen + 1
        If EndPos5 = 0 Then EndPos5 = PstrLen + 1
        If EndPos6 = 0 Then EndPos6 = PstrLen + 1
        If EndPos7 = 0 Then EndPos7 = PstrLen + 1
        If EndPos8 = 0 Then EndPos8 = PstrLen + 1
        If EndPos9 = 0 Then EndPos9 = PstrLen + 1
    ' Find den EndPos som er tættest på StartPos
        EndPos = 0
        If EndPos1 < EndPos2 And EndPos1 < EndPos3 And EndPos1 < EndPos4 And EndPos1 < EndPos5 And EndPos1 < EndPos6 And EndPos1 < EndPos7 And EndPos1 < EndPos8 And EndPos1 < EndPos9 Then EndPos = EndPos1
        If EndPos2 < EndPos1 And EndPos2 < EndPos3 And EndPos2 < EndPos4 And EndPos2 < EndPos5 And EndPos2 < EndPos6 And EndPos2 < EndPos7 And EndPos2 < EndPos8 And EndPos2 < EndPos9 Then EndPos = EndPos2
        If EndPos3 < EndPos1 And EndPos3 < EndPos2 And EndPos3 < EndPos4 And EndPos3 < EndPos5 And EndPos3 < EndPos6 And EndPos3 < EndPos7 And EndPos3 < EndPos8 And EndPos3 < EndPos9 Then EndPos = EndPos3
        If EndPos4 < EndPos1 And EndPos4 < EndPos2 And EndPos4 < EndPos3 And EndPos4 < EndPos5 And EndPos4 < EndPos6 And EndPos4 < EndPos7 And EndPos4 < EndPos8 And EndPos4 < EndPos9 Then EndPos = EndPos4
        If EndPos5 < EndPos1 And EndPos5 < EndPos2 And EndPos5 < EndPos3 And EndPos5 < EndPos4 And EndPos5 < EndPos6 And EndPos5 < EndPos7 And EndPos5 < EndPos8 And EndPos5 < EndPos9 Then EndPos = EndPos5
        If EndPos6 < EndPos1 And EndPos6 < EndPos2 And EndPos6 < EndPos3 And EndPos6 < EndPos4 And EndPos6 < EndPos5 And EndPos6 < EndPos7 And EndPos6 < EndPos8 And EndPos6 < EndPos9 Then EndPos = EndPos6
        If EndPos7 < EndPos1 And EndPos7 < EndPos2 And EndPos7 < EndPos3 And EndPos7 < EndPos4 And EndPos7 < EndPos5 And EndPos7 < EndPos6 And EndPos7 < EndPos8 And EndPos7 < EndPos9 Then EndPos = EndPos7
        If EndPos8 < EndPos1 And EndPos8 < EndPos2 And EndPos8 < EndPos3 And EndPos8 < EndPos4 And EndPos8 < EndPos5 And EndPos8 < EndPos6 And EndPos8 < EndPos7 And EndPos8 < EndPos9 Then EndPos = EndPos8
        If EndPos9 < EndPos1 And EndPos9 < EndPos2 And EndPos9 < EndPos3 And EndPos9 < EndPos4 And EndPos9 < EndPos5 And EndPos9 < EndPos6 And EndPos9 < EndPos7 And EndPos9 < EndPos8 Then EndPos = EndPos9
    '
        LinkLen = EndPos - StartPos
        If StartPos <> 0 And EndPos <> 0 And LinkLen <> Len(SearchString1) Then
            Link = Mid(Pstr, StartPos, EndPos - StartPos)
            Pstr = Left(Pstr, StartPos-1) & Insert1 & Mid(Pstr, StartPos, EndPos + Len(SearchString2) - StartPos - 1) & Insert2 & Mid(Pstr, StartPos, EndPos + Len(SearchString2) - StartPos - 1) & Insert3 & Right(Pstr, Len(Pstr) - (EndPos + Len(SearchString2) - 2))
            StartPos = StartPos + Len(Insert1) + LinkLen + Len(Insert2) + LinkLen + Len(Insert3)
        End If
    Loop While StartPos <> 0
    Pstr = Mid(Pstr,2,Len(Pstr)-2)
    WebString = Pstr
End Function

If Request("readfile") = "" Then
Response.Write "<form method='post' action='string.asp'><input type='file' name='readfile'>&nbsp;&nbsp;<input type='submit' value='Send'></form>"
End If

If Request("readfile") <> "" Then

Set filesys = CreateObject("Scripting.FileSystemObject")
Set txtfile = filesys.OpenTextFile(Request("readfile"),1,0)

Do

Line = txtfile.ReadLine
Response.Write WebString(Line) & "<br>"

Loop Until txtfile.AtEndOfStream
txtfile.close
End If
%>
Avatar billede philiph Nybegynder
09. juni 2000 - 19:02 #4
>> phylox2: Du har godt hørt om arrays og løkker, ikke ;o)
Avatar billede phylox2 Nybegynder
09. juni 2000 - 23:29 #5
Nope :) Men spørgsmålet går ud på, at "omskrive" et andet script ... det er så det, jeg gør :)
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester