Sign in to follow this  
Followers 0
Valuater

Include-Functions Manager

9 posts in this topic

#1 ·  Posted (edited)

; ver 1.0.5 - 12/28/2008

Here's what it looks like...

Posted Image

Code...

; ver 1.0.5 - 12/28/2008

#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <file.au3>

Opt("GuiOnEventMode", 1)

If FileExists(@ScriptDir & "\Browse.ini") Then
    $Directory = IniRead(@ScriptDir & "\Browse.ini", "search", "dir", "")
Else
    $Directory = _DirAutoIt() & "\Include\"
    IniWrite(@ScriptDir & "\Browse.ini", "search", "dir", $Directory)
EndIf

$win = GUICreate("Include-Functions Manager", 614, 390)
GUISetOnEvent($GUI_EVENT_CLOSE, "_CLOSEGUI")
GUISetFont(9, 400, -1, "MS Sans Serif")
$btnList = GUICtrlCreateButton("&View Func", 10, 330, 75, 25)
GUICtrlSetOnEvent(-1, "Set_View_Func")
$btnView = GUICtrlCreateButton("View &File", 85, 330, 75, 25)
GUICtrlSetOnEvent(-1, "View_Include")
$btnView = GUICtrlCreateButton("View &All Func", 10, 360, 150, 25)
GUICtrlSetOnEvent(-1, "Set_View_All")
$btnReset = GUICtrlCreateButton("&+", 485, 333, 15, 20)
GUICtrlSetOnEvent(-1, "Set_Browser")
GUICtrlSetTip(-1, "<- Use This")
$btnBrowse = GUICtrlCreateButton("&Browse", 500, 333, 60, 20)
GUICtrlSetOnEvent(-1, "Browse")
$btnDefault = GUICtrlCreateButton("&--", 560, 333, 15, 20)
GUICtrlSetOnEvent(-1, "Set_Default")
GUICtrlSetTip(-1, "Use Default")
$Param_chkbx = GUICtrlCreateCheckbox("Show Parameters", 200, 360, 120, 25)
$Include_chkbx = GUICtrlCreateCheckbox("Show Includes", 350, 360, 120, 25)
GUICtrlCreateLabel("Valuater...8)", 525, 370, 120, 25)
GUICtrlSetFont(-1, 10, 700, -1, "MS Sans Serif")
$TutorItInput = GUICtrlCreateInput($Directory, 198, 333, 280, 20)
$TutorItList = GUICtrlCreateList("", 10, 10, 150, 330)
$TutorItEdit = GUICtrlCreateEdit("Please select an Include from the list to your left.", 175, 10, 420, 315)
GUISetState()

Set_List()

While 1
    Sleep(50)
WEnd

; ====== FUNCTIONS ===============

Func Set_View_Func()
    $Show_Includes = _IsChecked($Include_chkbx)
    $Show_Params = _IsChecked($Param_chkbx)
    $List_Loc = GUICtrlRead($TutorItInput)
    $List_Read = GUICtrlRead($TutorItList)
    $List_File = $List_Loc & $List_Read & ".au3"
    $ret_Info = _AllFuncParamList($List_File, $Show_Includes, $Show_Params)
    GUICtrlSetData($TutorItEdit, "")
    GUICtrlSetData($TutorItEdit, $ret_Info)
EndFunc   ;==>Set_View_Func

Func Set_View_All()
    Local $All_Func = "", $fRet
    $Show_Includes = 0 ; _IsChecked($Include_chkbx)
    $Show_Params = _IsChecked($Param_chkbx)
    $List_Loc = GUICtrlRead($TutorItInput)
    $List_Read = Set_List($List_Loc, "*.au3", 1)
    $rSplt = StringSplit(StringTrimLeft($List_Read, 1), "|")
    For $x = 1 To $rSplt[0]
        $List_File = $List_Loc & $rSplt[$x] & ".au3"
        $All_Func &= @CRLF & "-> #Include <" & $rSplt[$x] & ".au3>" & @CRLF
        $fRet = _AllFuncParamList($List_File, 0, $Show_Params)
        If $fRet <> -1 Then $All_Func &= $fRet
    Next
    GUICtrlSetData($TutorItEdit, "") ; set list to empty.
    GUICtrlSetData($TutorItEdit, $All_Func)
EndFunc   ;==>Set_View_All

Func Set_List($location = "", $type = "*.au3", $Return = 0, $sep = "|")
    If $location = "" Then $location = GUICtrlRead($TutorItInput)
    If Not StringRight($location, 1) = "\" Then $location &= "\"
    $TutList = _FileListToArray($location, $type, 1)
    If (Not IsArray($TutList)) Or (@error = 1) Then
        MsgBox(262208, "Error", "No Files or Folders Found.   ", 5)
        Return SetError(1, 0, -1)
    EndIf
    If $Return == 0 Then GUICtrlSetData($TutorItList, "")
    For $x = 1 To $TutList[0]
        If $Return == 0 Then GUICtrlSetData($TutorItList, (StringTrimRight($TutList[$x], 4)) & "|", 1)
        If $Return <> "" Then $Return &= StringTrimRight($TutList[$x], 4) & $sep
    Next
    If $Return <> "" Then Return StringTrimRight($Return, 1)
EndFunc   ;==>Set_List

Func View_Include()
    $IncludeName = GUICtrlRead($TutorItList)
    $Include = GUICtrlRead($TutorItInput) & $IncludeName & ".au3"
    If FileExists($Include) Then Return ShellExecute($Include)
    Return SetError(2, 0, -1)
EndFunc   ;==>View_Include

Func _AllFuncParamList($fList = @ScriptFullPath, $fIncludes = 1, $fParams = 0, $fSep = @CRLF);"|")
    Local $iIncludes, $iList, $ret = ""
    $aArray = StringSplit(FileRead($fList, FileGetSize($fList)), @LF)
    For $x = 1 To UBound($aArray) - 1
        If StringLeft($aArray[$x], 5) = "Func " Then
            If $fParams <> 1 Then $aArray[$x] = StringLeft($aArray[$x], StringInStr($aArray[$x], "(")) & ")"
            ;ConsoleWrite(StringTrimLeft($aArray[$x], 4) & @LF)
            $iList &= StringTrimLeft($aArray[$x], 4) & $fSep
        EndIf
        If $fIncludes == 1 And StringLeft($aArray[$x], 8) = "#Include" Then
            $s_Start = StringInStr($aArray[$x], "<") + 1
            $iIncludes &= StringMid($aArray[$x], $s_Start, StringInStr($aArray[$x], ">") - $s_Start) & "|"
        EndIf
    Next
    If $fIncludes = 1 Then
        $iPath = GUICtrlRead($TutorItInput)
        $iSplit = StringSplit($iIncludes, "|")
        For $i = 1 To $iSplit[0] - 1
            ConsoleWrite(@CRLF & "-> Include: " & $iPath & $iSplit[$i] & @LF)
            If StringInStr($iSplit[$i], "once") Or StringInStr($iSplit[$i], "constants") Then ContinueLoop
            $iList &= $fSep & "-> #Include <" & $iSplit[$i] & ">" & $fSep
            $iList &= _AllFuncParamList($iPath & $iSplit[$i], 0, $fParams)
        Next
    EndIf
    If $iList <> "" Then Return $iList
    Return SetError(1, 0, -1)
EndFunc   ;==>_AllFuncParamList

Func Browse()
    $find_loc = FileSelectFolder("Choose a Folder.", "")
    If $find_loc = "" Then Return
    If StringRight($find_loc, 1) <> "\" Then $find_loc = $find_loc & "\"
    GUICtrlSetData($TutorItInput, $find_loc)
    IniWrite(@ScriptDir & "\Browse.ini", "search", "dir", $find_loc)
    Set_List()
EndFunc   ;==>Browse

Func Set_Default()
    $Directory = _DirAutoIt() & "\Include\"
    IniWrite(@ScriptDir & "\Browse.ini", "search", "dir", $Directory)
    GUICtrlSetData($TutorItInput, $Directory)
    Set_List()
EndFunc   ;==>Set_Default

Func Set_Browser()
    $Directory = GUICtrlRead($TutorItInput)
    If StringRight($Directory, 1) <> "\" Then $Directory = $Directory & "\"
    IniWrite(@ScriptDir & "\Browse.ini", "search", "dir", $Directory)
    GUICtrlSetData($TutorItInput, $Directory)
    Set_List()
EndFunc   ;==>Set_Browser

Func _CloseGUI()
    Exit
EndFunc   ;==>_CloseGUI

;************************************************************

; Locate Autoit/Beta Directory
; Author - MHz (Modified by FireFox)
Func _DirAutoIt($version = 'Prod')
    Switch $version
        Case 'Prod'
            Switch True
                Case FileExists(@ProgramFilesDir & '\AutoIt3')
                    Return @ProgramFilesDir & '\AutoIt3'
                Case RegRead('HKLM\SOFTWARE\AutoIt v3\AutoIt', 'InstallDir')
                    Return RegRead('HKLM\SOFTWARE\AutoIt v3\AutoIt', 'InstallDir')
            EndSwitch
    EndSwitch
    If $version = 'Prod' Then $version = 'Public Release'
    Return FileSelectFolder('Locate AutoIt Directory  (' & $version & ' version)', @HomeDrive)
EndFunc   ;==>_DirAutoIt

; from Zedna +/-
Func _IsChecked($control)
    If BitAND(GUICtrlRead($control), $GUI_CHECKED) = $GUI_CHECKED Then Return 1
    Return 0
EndFunc   ;==>_IsChecked

ENJOY!

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites



This is great. Makes it so much easier to find out the sytax.

Share this post


Link to post
Share on other sites

Thanks for the Manager but what about the personal (user) include folder?

My personal folder can be read from the registry -> HKEY_CURRENT_USER\Software\AutoIt v3\AutoIt\Include

Maybe this can be added, too.

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Thanks for the Manager but what about the personal (user) include folder?

My personal folder can be read from the registry -> HKEY_CURRENT_USER\Software\AutoIt v3\AutoIt\Include

Maybe this can be added, too.

UEZ

As you wish... lol

Actually, I had thought of that but was too lazy...

thanks

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Nice tool Valuater!

Idea for new functionality:

- on doubleclick on function definition it will open include file (in Scite) and go to doubleclicked function 

EDIT:

- also don't display include files with no Func() --> *Constants.au3

- on doubleclick on include file (in left panel) show it's functions

Edited by Zedna

Share this post


Link to post
Share on other sites

@Valuater

You've added list view for see includes as last script you gave me for slider, nice job :)

@Zedna

Have you read my pm ?

Cheers, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

Hey, that's cool! I'm sure this will be useful for all the UDFs we downloaded ourself that are not covered in help. It was so annoying to always navigate for the file and scroll through it until I found the function which I wanted to know the syntax of.


[font="Courier New"]http://RomanK.hondadesigns.com[/font]

Share this post


Link to post
Share on other sites

As you wish... lol

Actually, I had thought of that but was too lazy...

thanks

8)

THANKS :)

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Thanks for sharing! :)


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

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