Sign in to follow this  
Followers 0
FrankwazHere

AStart

2 posts in this topic

#1 ·  Posted (edited)

Folks,

I have been working on a script that can add include files and a tagline to the top of your Au3 files on the fly.

you select what include files to add, type what the scriptname(filename) and yourname(Author) will be.

and it pulls an ascii art graphic, and add's your selected include files, it will generate an .au3 file on your desktop when you hit submit. let me know what you think/please.

What you need:

in the scriptdir you need a flist.txt file with the appropriate font names. like these:

3D%20Diagonal

4Max

Alpha

B1FF

Big

Binary

Block

Doh

Doom

Small

Isometric3

Lean

Ogre

Old%20Banner

Puzzle

Roman

Rozzo

Slant%20Relief

Small%20Keyboard

just some random ones for you to test with, i have a txt file with over 100 of them i stripped from this site.

the script will not populate font names in the GUI without this file being in the @scriptdir

just for fun really, but it could potentially prove useful given a few more functions, hotkey, some error checking, facelift, some more fields for comments, themes that i haven't thought of yet and some more stability. there are minor flaws, the script works, just not as smoothly as i would like it too. for example.

  • the script needs to exit after generating an au3 because if you try to create two in a row it throws an array error.
  • IE doesnt seem to close correctly at times, but i don't see any _IEclose functions included, though im not sure how that is managed.
  • Can't get a scrollbar in for the list of #include files.

Any suggestions would really be appreciated, features,fixes',comments anything@! thanks!!!!

Screenshot:->example with "Small" Font type

#cs
                   __ _     
  _____ _____ _ _ / _| |___ 
 / _ \ V / -_) '_|  _| / _ \
 \___/\_/\___|_| |_| |_\___/
                            
 
#CE
#include <FrameConstants.au3>
#include <GDIPlus.au3>
#include <GDIPlusConstants.au3>
#include <GuiAVI.au3>
#include <GuiButton.au3>

Thanks for taking the time out to read, appreciated.

Edited by overflo

;Frank. 

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

OH AND... source code might help...

; *******************************************************
;A Start;
;
;a b c d e f g h i j k l m n o p q r s t u v w x y z
;n o p q r s t u v w x y z a b c d e f g h i j k l m
;
; *******************************************************

;http://patorjk.com/textart/msg1.php?font=4Max.flf&hs=true&bg=%23FFFFFF&fc=%23000000&align=left&txt=nopqrstuvwxyzabcdefghijklm
;returns A-Z in 4Max Font
;Lets make it work for us.
;
#include <GUIConstants.au3>
#include <file.au3>
#include <Array.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <ButtonConstants.au3>
#include <GUIListbox.au3>
#include <IE.au3>

$pFolder = "C:\Program Files\AutoIt3\Include"

Global $iSelect
Global $hInput_Name 
Global $SRECORDS
Global $SDATA 
Global $hListBox 
Global $NEW
Global $FONTNAME 
Global $OLD
Global $RESULT

Dim $replace[27][2] = [["a", "n"],["b", "o"],["c", "p"],["d", "q"],["e", "r"],["f", "s"],["g", "t"],["h", "u"],["i", "v"],["j", "w"],["k", "x"],["l", "y"],["m", "z"],["n", "a"],["o", "b"],["p", "c"],["q", "d"],["r", "e"],["s", "f"],["t", "g"],["u", "h"],["v", "i"],["w", "j"],["x", "k"],["y", "l"],["z", "m"],[" ","%20"]]

$aArray = _FileListToArray($pFolder, "*.au3", 1) 
$idata = ""
For $i = 1 To $aArray[0]
    $idata &= $aArray[$i] 
Next
If Not _FileReadToArray("flist.txt", $SRECORDS) Then
    MsgBox(4096, "Error", " Error reading file to Array     error:" & @error)
    Exit
EndIf
$FDATA = ""
For $I = 1 To $SRECORDS[0]
    $FDATA &= $SRECORDS[$I] & "|"
Next

Main()

Func Main()
$hGUI = GUICreate("Astart", 400, 550)
$hListBox = _GUICtrlListBox_Create ($hGUI, "", 10, 10, 170, 500, $LBS_EXTENDEDSEL)
$submit = GUICtrlCreateButton("Submit", 10, 515, 80, 30)
$hButton_Clear  = GUICtrlCreateButton("Clear", 100, 515, 80, 30)
$hInput_Name = GUICtrlCreateInput("scriptName",200,10,170,20)
$old = GUICtrlCreateInput("YourName",200,50,170,20)
$fontname = GUICtrlCreateList("", 200, 100, 170, 250, BitOR($WS_BORDER, $WS_VSCROLL))
GUICtrlSetData(-1, $FDATA)
GUISetState()

_Update_ListBox()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $submit
            $aSelected = _GUICtrlListBox_GetSelItemsText($hListBox)
            GetnewType()
            For $i = 1 To 1
                FileWrite(@DesktopDir & "\" & Guictrlread($hInput_Name) & ".au3","#CS" & @CRLF)
                FileWrite(@DesktopDir & "\" & Guictrlread($hInput_Name) & ".au3",$result & @CRLF)
                FileWrite(@DesktopDir & "\" & Guictrlread($hInput_Name) & ".au3","#CE" & @CRLF)
                For $i = 1 to $aSelected[0]
                    FileWrite(@DesktopDir & "\" & Guictrlread($hInput_Name) & ".au3","#include <" & $aSelected[$i] & ">" & @CRLF)
                Next
                closeout()
            Next
            Exit
        Case $hButton_Clear
            _GUICtrlListBox_ResetContent($hListBox)
            _Update_ListBox()
    EndSwitch
    $iIndex = _GUICtrlListBox_GetCaretIndex($hListBox)
    If _GUICtrlListBox_GetSel($hListBox, $iIndex) = False Then _GUICtrlListBox_SetSel($hListBox, $iIndex)
WEnd
EndFunc

Func _Update_ListBox()
    _GUICtrlListBox_BeginUpdate($hListBox)
    _GUICtrlListBox_ResetContent($hListBox)
    _GUICtrlListBox_InitStorage($hListBox, 100, 4096)
    
For $i = 1 To $aArray[0]
    _GUICtrlListBox_AddString ($hListBox, $aArray[$i]) 
    Next
    _GUICtrlListBox_EndUpdate($hListBox)
EndFunc

Func GetnewType()
    $old = GUICtrlRead($old)
    $fontname = GUICtrlRead($fontname)
    
    For $s = 1 To StringLen($old)
    $oldN = StringMid($old, $s, 1)
    $index = _ArraySearch($replace, $OldN)
    $new &= $replace[$index][1]
Next
    $old = $new
    $oID = _IECreate("http://patorjk.com/textart/msg1.php?font=" & $fontname & ".flf&hs=true&bg=%23FFFFFF&fc=%23000000&align=left&txt=" & $old,"",0)
    $result = _IEBodyReadText($oID)
EndFunc

Func closeout()
    Dim $string = "Share This Message With A Friend - Text Ascii Art Generator"
    Dim $replaceString = ""
    Dim $string2 = "You can copy and paste the below HTML code into your blog, email messages, IMs, myspace page/wall, or any other place that accepts HTML code and it'll show up as a hyperlink to this message."
    Dim $replaceString2 = ""
    Dim $string3 = '<a href="http://patorjk.com/textart/msg1.php?font=' & $fontname & '.flf&hs=true&bg=%23FFFFFF&fc=%23000000&align=left&txt=' & $old & '">Psst! Check this out...</a> '
    Dim $replaceString3 = ""
    Dim $aStrings
    
    If Not _FileReadToArray(@DesktopDir & "\" & Guictrlread($hInput_Name) & ".au3",$aStrings) Then
        MsgBox(4096,"Error", "Cannot locate input file.")
    Exit
EndIf

for $i = 1 To $aStrings[0]
    If StringInStr($aStrings[$i], $string) Then
        $aStrings[$i] = StringReplace($aStrings[$i], $string, $replaceString)
    EndIf
    if Stringinstr($aStrings[$i], $string3) Then
        $aStrings[$i] = StringReplace($aStrings[$i], $string3, $replaceString3)
    EndIf
    if Stringinstr($aStrings[$i], $string2) Then
        $aStrings[$i] = StringReplace($aStrings[$i], $string2, $replaceString2)
    EndIf
Next
 _FileWriteFromArray(@DesktopDir & "\" & Guictrlread($hInput_Name) & ".au3", $aStrings, 1)
EndFunc
Edited by overflo

;Frank. 

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