Sign in to follow this  
Followers 0
zaini

Display ini file in HTML

5 posts in this topic

I have a problem how to dispalay all item in INI file to HTML...

Can anybody please help me here???

This is my INI file item..

[Smiley]
:)=<img src = "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/1.gif">
:(=<img src = "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/2.gif">
:D=<img src = "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/4.gif">
:-/=<img src = "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/7.gif">
:x=<img src = "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/8.gif">
:">=<img src = "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/9.gif">
:P=<img src = "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/10.gif">
:-*=<img src = "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/11.gif">
:-O=<img src = "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/13.gif">
X(=<img src = "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/14.gif">
:>=<img src = "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/15.gif">
B-)=<img src = "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/16.gif">
:-S=<img src = "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/17.gif">
:|=<img src = "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/22.gif">
/:=<img src = "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/23.gif">
:?=<img src = "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/39.gif">
|hug|=<img src = "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/6.gif">
|whew|=<img src = "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/18.gif">
|wave|=<img src = "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/103.gif">
|thumb|=<img src = "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/113.gif">
|laungh|=<img src = "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/21.gif">
|crying|=<img src = "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/20.gif">
|winking|=<img src = "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/3.gif">
|broken|=<img src = "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/12.gif">
|rolling|=<img src = "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/24.gif">
|eyelashes|=<img src = "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/5.gif">
|no talking|=<img src = "http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/33.gif">

This is my autoit script..

#include <GUIConstants.au3>
#include <IE.au3>
$commentini = @ScriptDir & "\button\editor\Editor setting.ini"
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 218, 591, 684, 85, -1, BitOR($WS_EX_TOOLWINDOW,$WS_EX_WINDOWEDGE))
$main = _IECreateEmbedded()
$main_gui = GUICtrlCreateObj($main, 8, 8, 201, 553)
_IENavigate($main, "about:blank")
$s = IniReadSection($commentini,"Smiley")
    For $i = 1 To $s[0][0]
        _IEDocWriteHTML($main,$s[$i][0] &" = "&$s[$i][1])
    Next

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

Share this post


Link to post
Share on other sites



Hi.

Nice URL for the emoticons muttley

QND, to pack it into a HTML document. (a table would be even better, that's up to you...)

#include <array.au3>

Dim $ini="c:\temp\smiley.ini"
Dim $Section="Smiley"
Dim $SmileyHtml="C:\Smiley.html"
$SmileyArr=IniReadSection($ini,$Section)
_ArrayDisplay($SmileyArr)

$handle=FileOpen($SmileyHtml,2)
FileWriteLine($handle,"<html>")
FileWriteLine($handle,"<head>")
FileWriteLine($handle,"<title>Smiley Explanation</title>")
FileWriteLine($handle,"</head>")
FileWriteLine($handle,"<body>")
FileWriteLine($handle,"<h3>This is a brief explanations of ""Smileys""</h3>")

for $i=1 to $SmileyArr[0][0]
    FileWriteLine($handle,$SmileyArr[$i][0] & " = " & $SmileyArr[$i][1] & "<br>")
Next
FileWriteLine($handle,"</body>")
FileWriteLine($handle,"</html>")
FileClose($handle)

run(@ComSpec & " /c start iexplore.exe " & $SmileyHtml)

Regards, Rudi.


Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

#include <GuiConstants.au3>
#include <WindowsConstants.au3>
#include <IE.au3>

$fIni = "editor_setting.ini"
$nSection = "Smiley"

#Region ### START Koda GUI section ### Form=
$hForm = GUICreate("Smiley Explanation", 225, 430, -1, -1, -1, BitOR($WS_EX_TOOLWINDOW,$WS_EX_WINDOWEDGE))
$oMain = _IECreateEmbedded()
$lMainGUI = GUICtrlCreateObj($oMain, 8, 8, 209, 400)
$lLabelWarning = GUICtrlCreateLabel("This is a brief explanations of ""Smileys""", 8, 408)

_IENavigate($oMain, "about:blank")
$nSmiley = IniReadSection($fIni, $nSection)

$sString = ""
For $i = 1 To $nSmiley[0][0]
    $sString = $sString & $nSmiley[$i][0] & " = " & $nSmiley[$i][1] & "<br>"
Next

_IEDocWriteHTML($oMain, $sString)

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

Here is the code that you were start off on based off of _IECreateEmbedded(). The numer one thing you did wrong with editing it was you wrote _IEDocWriteHTML as many times as however many items were in the file since then it deletes and rewrites. Also do note the main focus is the last item showing.

Edited by TerarinKerowyn

Contact via MSN: [email=terarink_msn@hotmail.com]terarink_msn@hotmail.com[/email], yahoo: terarink_yah

Share this post


Link to post
Share on other sites

Hi.

Nice URL for the emoticons muttley

QND, to pack it into a HTML document. (a table would be even better, that's up to you...)

#include <array.au3>

Dim $ini="c:\temp\smiley.ini"
Dim $Section="Smiley"
Dim $SmileyHtml="C:\Smiley.html"
$SmileyArr=IniReadSection($ini,$Section)
_ArrayDisplay($SmileyArr)

$handle=FileOpen($SmileyHtml,2)
FileWriteLine($handle,"<html>")
FileWriteLine($handle,"<head>")
FileWriteLine($handle,"<title>Smiley Explanation</title>")
FileWriteLine($handle,"</head>")
FileWriteLine($handle,"<body>")
FileWriteLine($handle,"<h3>This is a brief explanations of ""Smileys""</h3>")

for $i=1 to $SmileyArr[0][0]
    FileWriteLine($handle,$SmileyArr[$i][0] & " = " & $SmileyArr[$i][1] & "<br>")
Next
FileWriteLine($handle,"</body>")
FileWriteLine($handle,"</html>")
FileClose($handle)

run(@ComSpec & " /c start iexplore.exe " & $SmileyHtml)

Regards, Rudi.

thank you, you really help me much..

its work.. :)


Share this post


Link to post
Share on other sites

#include <GuiConstants.au3>
#include <WindowsConstants.au3>
#include <IE.au3>

$fIni = "editor_setting.ini"
$nSection = "Smiley"

#Region ### START Koda GUI section ### Form=
$hForm = GUICreate("Smiley Explanation", 225, 430, -1, -1, -1, BitOR($WS_EX_TOOLWINDOW,$WS_EX_WINDOWEDGE))
$oMain = _IECreateEmbedded()
$lMainGUI = GUICtrlCreateObj($oMain, 8, 8, 209, 400)
$lLabelWarning = GUICtrlCreateLabel("This is a brief explanations of ""Smileys""", 8, 408)

_IENavigate($oMain, "about:blank")
$nSmiley = IniReadSection($fIni, $nSection)

$sString = ""
For $i = 1 To $nSmiley[0][0]
    $sString = $sString & $nSmiley[$i][0] & " = " & $nSmiley[$i][1] & "<br>"
Next

_IEDocWriteHTML($oMain, $sString)

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

Here is the code that you were start off on based off of _IECreateEmbedded(). The numer one thing you did wrong with editing it was you wrote _IEDocWriteHTML as many times as however many items were in the file since then it deletes and rewrites. Also do note the main focus is the last item showing.

thanks TerarinKerowyn you really helpme...

thanks again to all autoit member.... muttley


Share this post


Link to post
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
Sign in to follow this  
Followers 0