Jump to content

Note Database


marfdaman
 Share

Recommended Posts

Well, this program is useful (or so I hope) for people like me who tend to make a .txt file whenever they find a piece of information they want to keep. I have dozens of such files with names like "bfjgbfkj.txt" and "12345.txt", containing info that I can't find when I need it.

So I made this program, it helps me keep my computer free of needless text files and allows me to take useful information with me in two files.

Au3: Personal_Note_Centre.au3

Images (optional, but way better IMHO): http://marfdaman.googlepages.com/Images.zip

Screenshot: http://marfdaman.googlepages.com/PNCScreen.jpg

As usual, let me know if you (don't) like it :whistle:

Edited by marfdaman

Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Link to comment
Share on other sites

I'll use this a lot. Well Done marfdaman

My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
Link to comment
Share on other sites

I'll use this a lot. Well Done marfdaman

Tnx, so will I.

Hmm... Now i'm getting an error:Array variable badly formatted (Line 367)

It worked the first time

I'll have a look...could you give me the "My Notes.txt" file in My Documents please?

Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Link to comment
Share on other sites

Changed this:

[1]Drake golder=Gaia Golder

Files2Phone=Scripts

GaiaGolder=Scripts

RandomQuote=Scripts

to this

[1]Drake golder=Scripts

Files2Phone=Scripts

GaiaGolder=Scripts

RandomQuote=Scripts

and now it works.

Did you manually change it or was it something the program did?

I don't hope, yet guess the latter.

Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Link to comment
Share on other sites

Ok, could you tell me in what order you created the treeview, just the titles, so I can see where it goes wrong?

Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Link to comment
Share on other sites

Where can I find this file - GuiTreeview.au3

As when I tried to run the program I got ERROR

ERROR: _GUICtrlTreeViewSetState(): undefined function.

2¢

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

C:\NoteCenterTest\Note Center.au3 (541) : ==> Subscript used with non-Array variable.:

_GuiCtrlStatusBarSetText($StatusBar, "Current Note: " & $Temp_Sel[0])

_GuiCtrlStatusBarSetText($StatusBar, "Current Note: " & $Temp_Sel^ ERROR

Getting the above error while running it using Beta.

Also, your FileInstall() commands need to be altered a bit. They're looking for the images in a folder that only exists on your machine. You should change them to look for the images in the current script directory or similar.

I'm really looking forward to using this program once the above bugs are squashed.

-S

(Yet Another) ExcelCOM UDF"A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly...[indent]...specialization is for insects." - R. A. Heinlein[/indent]
Link to comment
Share on other sites

C:\NoteCenterTest\Note Center.au3 (541) : ==> Subscript used with non-Array variable.:

_GuiCtrlStatusBarSetText($StatusBar, "Current Note: " & $Temp_Sel[0])

_GuiCtrlStatusBarSetText($StatusBar, "Current Note: " & $Temp_Sel^ ERROR

Getting the above error while running it using Beta.

Also, your FileInstall() commands need to be altered a bit. They're looking for the images in a folder that only exists on your machine. You should change them to look for the images in the current script directory or similar.

I'm really looking forward to using this program once the above bugs are squashed.

-S

As for the first error, just remove the "[0]" as codemyster said. It's because of the beta version I was using, where GuiCtrlRead returned an array, hence the subscript.

And about the FileInstall, I'll change that to "C:\" or something.

Glad you like it!

can't find GuiStatusBar.au3

marfiman :)

last beta in use

I'm quite sure it's a standard UDF though :whistle:

Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Link to comment
Share on other sites

It is :whistle:

My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
Link to comment
Share on other sites

; Include Version:1.66 (17 July 2006)
#include-once
#include <Array.au3>
#include <StatusBarConstants.au3>
#include <WindowsConstants.au3>
; ------------------------------------------------------------------------------
;
; AutoIt Version: 3.1.1++
; Language:       English
; Description:    Functions that assist with the Statusbar control
;
; ------------------------------------------------------------------------------
;=== Globals
Global $debug = True
Global Const $LowOrder = 0xFFFF
;=== End Globals

;=== function list
;===============================================================================
;_GuiCtrlStatusBarCreate
;_GuiCtrlStatusBarGetBorders
;_GuiCtrlStatusBarGetIcon
;_GuiCtrlStatusBarGetParts
;_GuiCtrlStatusBarGetRect
;_GuiCtrlStatusBarGetText
;_GuiCtrlStatusBarGetTextLength
;_GuiCtrlStatusBarGetTip
;_GuiCtrlStatusBarGetUnicode
;_GuiCtrlStatusBarResize
;_GuiCtrlStatusBarSetBKColor
;_GuiCtrlStatusBarSetIcon
;_GuiCtrlStatusBarSetMinHeight
;_GuiCtrlStatusBarSetSimple
;_GuiCtrlStatusBarSetText
;_GuiCtrlStatusBarSetTip
;_GuiCtrlStatusBarSetUnicode
;**********Helper**************
;_GuiCtrlStatusBarSetParts
;_CreateStructFromArray
;********** ToDo **************
;_GUICtrlStatusBarSetExtendedStyle

;===============================================================================
;
; Description:       _GuiCtrlStatusBarCreate
; Parameter(s):      $h_Gui         -   Handle to parent window
;                    $a_PanelWidth  -   width of panel or panels (for more than 1 panel pass in zero based array)
;                    $s_PanelText   -   text of panel or panels (for more than 1 panel pass in zero based array)
;                           $v_styles       -   styles to apply to the status bar (Optional) for multiple styles bitor them.
; Requirement:
; Return Value(s):   Returns hWhnd if successful, or 0 with error set to 1 otherwise.
; User CallTip:      _GuiCtrlStatusBarCreate($h_Gui, $a_PanelWidth, $s_PanelText[, $v_styles = ""]) Creates Statusbar. (required: <GuiStatusBar.au3>)
; Author(s):         rysiora, JdeB, tonedef,
;                    gafrost (Gary Frost (custompcs at charter dot net)), Steve Podhajecki <gehossafats at netmdc dot com>
; Note(s):
;===============================================================================
Func _GuiCtrlStatusBarCreate($h_Gui, $a_PanelWidth, $s_PanelText, $v_styles = "")
    Local $a_PW[1], $a_PT[1]
    If Not IsArray($a_PanelWidth) Then
        $a_PW[0] = $a_PanelWidth
    Else
        $a_PW = $a_PanelWidth
    EndIf
    If Not IsArray($a_PT) Then
        $a_PT[0] = $s_PanelText
    Else
        $a_PT = $s_PanelText
    EndIf
    If Not IsHWnd($h_Gui) Then $h_Gui = HWnd($h_Gui)
    Local $hwnd_Bar1, $x
    Local $style = BitOR($WS_CHILD, $WS_VISIBLE)
    If @NumParams = 4 Then $style = BitOR($style, $v_styles)
    $hwnd_Bar1 = DllCall("comctl32.dll", "long", "CreateStatusWindow", "long", $style, "str", "", "hwnd", $h_Gui, "int", 0)
    
    If @error Then Return SetError(1,1,0)
        _GuiCtrlStatusBarSetParts($hwnd_Bar1[0], UBound($a_PW), $a_PW)
        For $x = 0 To UBound($s_PanelText) - 1
            _GuiCtrlStatusBarSetText($hwnd_Bar1[0], $a_PT[$x], $x)
        Next
        
        Return $hwnd_Bar1[0]
EndFunc   ;==>_GuiCtrlStatusBarCreate

;===============================================================================
;
; Description:       _GuiCtrlStatusBarGetBorders
; Parameter(s):      $h_StatusBar    -    Handle to statusbar
; Requirement:
; Return Value(s):   Returns zero based array
;                       0 - width of the horizontal border
;                       1 - width of the vertical border
;                       2 - width of the border between rectangles
;                    or zero otherwise.
; User CallTip:      _GuiCtrlStatusBarGetBorders($h_StatusBar) Gets width of the borders. (required: <GuiStatusBar.au3>)
; Author(s):         gafrost (Gary Frost (custompcs at charter dot net))
; Note(s):
;===============================================================================
Func _GuiCtrlStatusBarGetBorders($h_StatusBar)
    Local $borders = DllStructCreate("int;int;int")
    If @error Then  Return SetError(@error,@error,0)
    If Not IsHWnd($h_StatusBar) Then $h_StatusBar = HWnd($h_StatusBar)
    Local $a_ret = DllCall("user32.dll", "int", "SendMessage", "hwnd", $h_StatusBar, "int", $SB_GETBORDERS, "int", 0, "ptr", DllStructGetPtr($borders))
    If (Not $a_ret[0]) Then
        $borders = 0
        Return SetError(-1,-1,0)
    Else
        Local $a_borders[3], $x
        For $x = 0 To 2
            $a_borders[$x] = DllStructGetData($borders, $x + 1)
        Next
        $borders = 0
        Return $a_borders
    EndIf
EndFunc   ;==>_GuiCtrlStatusBarGetBorders

;===============================================================================
;
; Description:       _GuiCtrlStatusBarGetIcon
; Parameter(s):      $h_StatusBar    -    The Control Id (will be converted to hWnd)
;                    $i_Panel            -    The panel to hold the text
; Requirement:
; Return Value(s):   return hwnd or zero otherwise.
; User CallTip:      _GuiCtrlStatusBarGetIcon($h_StatusBar[, $i_Panel=0]) Gets Statusbar panel Icon handle. (required: <GuiStatusBar.au3>)
; Author(s):         Steve Podhajecki <gehossafats at netmdc dotcom>, gafrost (Gary Frost (custompcs at charter dot net))
; Note(s):
;===============================================================================
Func _GuiCtrlStatusBarGetIcon($h_StatusBar, $i_Panel)
    If Not IsHWnd($h_StatusBar) Then $h_StatusBar = HWnd($h_StatusBar)
    Local $ret = DllCall("user32.dll", "long", "SendMessage", "hwnd", $h_StatusBar, "int", $SB_GETICON, "int", $i_Panel, "int", 0)
    If IsArray($ret) Then Return $ret[0]
EndFunc   ;==>_GuiCtrlStatusBarGetIcon

;===============================================================================
;
; Description:       _GuiCtrlStatusBarGetParts
; Parameter(s):      $h_StatusBar    -    The Control Id (will be converted to hWnd)
;
; Requirement:
; Return Value(s):   Returns the number of parts in the window, otherwise zero.
; User CallTip:      _GuiCtrlStatusBarGetParts($h_StatusBar) Retrieves a count of the parts in a status window. (required: <GuiStatusBar.au3>)
; Author(s):         Steve Podhajecki <gehossafats at netmdc dot com>, gafrost (Gary Frost (custompcs at charter dot net))
;
; Note(s):
;===============================================================================
Func _GuiCtrlStatusBarGetParts($h_StatusBar)
    If Not IsHWnd($h_StatusBar) Then $h_StatusBar = HWnd($h_StatusBar)
    Local $ret = DllCall("user32.dll", "int", "SendMessage", "hwnd", $h_StatusBar, "int", $SB_GETPARTS, "int", 0, "int", 0)
    If IsArray($ret) Then Return $ret[0]
EndFunc   ;==>_GuiCtrlStatusBarGetParts

;===============================================================================
;
; Description:       _GuiCtrlStatusBarGetRect
; Parameter(s):      $h_StatusBar    -    Handle to statusbar
;                    $i_part         -    zero based index of panel to retrieve rectangle from
; Requirement:
; Return Value(s):   Returns zero based array
;                       0 - Left
;                       1 - Top
;                       2 - Right
;                       3 - Bottom
;                    zero otherwise.
; User CallTip:      _GuiCtrlStatusBarGetRect($StatusBar, $i_part) Retrieves the bounding rectangle of a part in a status window. (required: <GuiStatusBar.au3>)
; Author(s):         gafrost (Gary Frost (custompcs at charter dot net))
; Note(s):
;===============================================================================
Func _GuiCtrlStatusBarGetRect($h_StatusBar, $i_part)
;~     typedef struct _RECT {
;~       LONG left;
;~       LONG top;
;~       LONG right;
;~       LONG bottom;
;~     } RECT, *PRECT;
    Local $RECT = DllStructCreate("int;int;int;int")
    If @error Then Return SetError(-1,-1,0)
    If Not IsHWnd($h_StatusBar) Then $h_StatusBar = HWnd($h_StatusBar)
    Local $a_ret = DllCall("user32.dll", "int", "SendMessage", "hwnd", $h_StatusBar, "int", $SB_GETRECT, "int", $i_part, "ptr", DllStructGetPtr($RECT))
    If IsArray($a_ret) Then
        If (Not $a_ret[0]) Then
            $RECT = 0
            Return SetError(-1,-1,0)
        Else
            Local $a_rect[4], $x
            For $x = 0 To 3
                $a_rect[$x] = DllStructGetData($RECT, $x + 1)
            Next
            $RECT = 0
            Return $a_rect
        EndIf
    Else
        $RECT = 0
        Return SetError(-1,-1,0)
    EndIf
EndFunc   ;==>_GuiCtrlStatusBarGetRect

;===============================================================================
;
; Description:       _GuiCtrlStatusBarGetText
; Parameter(s):      $h_StatusBar    -    The Control Id (will be converted to hWnd)
;                    $i_Panel        -    The panel to retreive the text from
; Requirement:
; Return Value(s):   Text from panel
; User CallTip:      _GuiCtrlStatusBarGetText($h_StatusBar[,$i_Panel=0]) Gets Statusbar Text from a part. (required: <GuiStatusBar.au3>)
; Author(s):         tonedef, gafrost (Gary Frost (custompcs at charter dot net)), Steve Podhajecki <gehossafats@netmdc.com>
; Note(s):
;===============================================================================
Func _GuiCtrlStatusBarGetText($h_StatusBar, $i_Panel = 0)
    ;== there is a built in function to use for this. See help documentation
    Local $v_Ret
    If Not IsHWnd($h_StatusBar) Then $h_StatusBar = HWnd($h_StatusBar)
    $v_Ret = DllCall("user32.dll", "long", "SendMessage", "hwnd", $h_StatusBar, "int", $SB_GETTEXT, "int", $i_Panel, "strptr", "")
    If IsArray($v_Ret) Then
        Return $v_Ret[4]
    Else
        Return SetError(-1,-1,"")
    EndIf
EndFunc   ;==>_GuiCtrlStatusBarGetText

;===============================================================================
;
; Description:       _GuiCtrlStatusBarGetTextLength
; Parameter(s):      $h_StatusBar    -    The Control Id (will be converted to hWnd)
;                    $i_Panel        -    Nubmer of the panel to retrieve length from
;
; Requirement:
; Return Value(s):   Text Length
; User CallTip:      _GuiCtrlStatusBarGetTextLength ($h_StatusBar, $i_Panel) Retrieves the length, in characters, of the text from the specified part of a status window. (required: <GuiStatusBar.au3>)
; Author(s):         Steve Podhajecki <gehossafats@netmdc.com>, gafrost (Gary Frost (custompcs at charter dot net))
; Note(s):
;===============================================================================
Func _GuiCtrlStatusBarGetTextLength($h_StatusBar, $i_Panel)
    If Not IsHWnd($h_StatusBar) Then $h_StatusBar = HWnd($h_StatusBar)
    Local $ret = DllCall("user32.dll", "long", "SendMessage", "hwnd", $h_StatusBar, "int", $SB_GETTEXTLENGTH, "int", $i_Panel, "int", 0)
    If IsArray($ret) Then
        Return $ret[0]
    Else
        Return SetError(-1,-1,-1)
    EndIf
EndFunc   ;==>_GuiCtrlStatusBarGetTextLength

;===============================================================================
;
; Description:       _GuiCtrlStatusBarGetTip
; Parameter(s):      $h_StatusBar   -   The Control Id (will be converted to hWnd)
;                    $i_Panel           -   The panel to retreive the text from
; Requirement:
; Return Value(s):   Tip Text, on error empty string and @error is set to 1
; User CallTip:      _GuiCtrlStatusBarGetTip($h_StatusBar[, $i_Panel=0]) Gets Statusbar TipText. (required: <GuiStatusBar.au3>)
; Author(s):         Steve Podhajecki <gehossafats@netmdc.com>, , gafrost (Gary Frost (custompcs at charter dot net))
; Note(s):           The status bar must be created with the $SBT_TOOLTIPS style to enable ToolTips.
;===============================================================================
Func _GuiCtrlStatusBarGetTip($h_StatusBar, $i_Panel = 0)
    Local $v_Ret, $strBuff, $wParam
    If Not IsHWnd($h_StatusBar) Then $h_StatusBar = HWnd($h_StatusBar)
    $strBuff = DllStructCreate("char[255]")
    $wParam = ((DllStructGetSize($strBuff) * 0x10000) + $i_Panel)
    $v_Ret = DllCall("user32.dll", "long", "SendMessage", "hwnd", $h_StatusBar, "int", $SB_GETTIPTEXT, _
            "long", $wParam, "ptr", DllStructGetPtr($strBuff))
    If IsArray($v_Ret) Then
        Return StringStripWS(DllStructGetData($strBuff, 1), 7);strip leading, trailing, and double ws.
    Else
        Return SetError(1,1,"")
    EndIf
EndFunc   ;==>_GuiCtrlStatusBarGetTip

;===============================================================================
;
; Description:       _GuiCtrlStatusBarGetUnicode
; Parameter(s):      $h_StatusBar    -    The Control Id (will be converted to hWnd)
;
; Requirement:
; Return Value(s):   If this value is nonzero, the control is using Unicode characters.
;                    If this value is zero, the control is using ANSI characters
; User CallTip:      _GuiCtrlStatusBarGetUnicode ($h_StatusBar) Retrieves the Unicode character format flag for the control. (required: <GuiStatusBar.au3>)
; Author(s):         gafrost (Gary Frost (custompcs at charter dot net))
; Note(s):
;===============================================================================
Func _GuiCtrlStatusBarGetUnicode($h_StatusBar)
    If Not IsHWnd($h_StatusBar) Then $h_StatusBar = HWnd($h_StatusBar)
    Local $a_ret = DllCall("user32.dll", "int", "SendMessage", "hwnd", $h_StatusBar, "int", $SB_GETUNICODEFORMAT, "int", 0, "int", 0)
    If IsArray($a_ret) Then
        Return $a_ret[0]
    Else
        Return SetError(-1,-1,0)
    EndIf
EndFunc   ;==>_GuiCtrlStatusBarGetUnicode

;===============================================================================
;
; Description:       _GuiCtrlStatusBarResize
; Parameter(s):      $h_StatusBar    -    The Control Id (will be converted to hWnd)
;
; Requirement:
; Return Value(s):   If the function succeeds, the return value is nonzero, otherwise zero.
; User CallTip:      _GuiCtrlStatusBarResize($h_StatusBar)    Resize Statusbar. (required: <GuiStatusBar.au3>)
; Author(s):         Steve Podhajecki <gehossafats@netmdc.com>
; Note(s):
;===============================================================================
Func _GuiCtrlStatusBarResize($h_StatusBar)
    If Not IsHWnd($h_StatusBar) Then $h_StatusBar = HWnd($h_StatusBar)
    Local $ret = DllCall("user32.dll", "int", "MoveWindow", "hwnd", $h_StatusBar, "int", 0, "int", 0, "int", 0, "int", 0)
    If IsArray($ret) Then
        Return $ret[0]
    Else
        Return SetError(-1,-1,0)
    EndIf
EndFunc   ;==>_GuiCtrlStatusBarResize

;===============================================================================
;
; Description:       _GuiCtrlStatusBarSetBKColor
; Parameter(s):      $h_StatusBar    -    Handle to statusbar
;                    $v_HexRGB       -    Hex RGB color to set Status Bar background
; Requirement:
; Return Value(s):   Returns the previous background color or zero upon failure
; User CallTip:      _GuiCtrlStatusBarSetBKColor($h_StatusBar, $v_HexRGB) Sets the background color in a status bar. (required: <GuiStatusBar.au3>)
; Author(s):         gafrost (Gary Frost (custompcs at charter dot net))
; Note(s):
;===============================================================================
Func _GuiCtrlStatusBarSetBKColor($h_StatusBar, $v_HexRGB)
    Local $tc = Hex(String($v_HexRGB), 6)
    Local $ret = DllCall("user32.dll", "int", "SendMessage", "hwnd", $h_StatusBar, "int", $SB_SETBKCOLOR, "int", 0, "int", '0x' & StringMid($tc, 5, 2) & StringMid($tc, 3, 2) & StringMid($tc, 1, 2))
    If IsArray($ret) Then
        $tc = Hex(String($ret[0]), 6)
        Return '0x' & StringMid($tc, 5, 2) & StringMid($tc, 3, 2) & StringMid($tc, 1, 2)
    Else
        Return SetError(-1,-1,0)
    EndIf
EndFunc   ;==>_GuiCtrlStatusBarSetBKColor

;===============================================================================
;
; Description:       _GuiCtrlStatusBarSetIcon
; Parameter(s):      $h_StatusBar    -    Handle to statusbar
;                    $i_part         -    Nubmer of panel to add icon too
;                    $s_IconFile     -    file to extract icon from
;                    $i_iconID       -    id of the icon
; Requirement:
; Return Value(s):   Returns nonzero if successful, or zero otherwise.
; User CallTip:      _GuiCtrlStatusBarSetIcon($StatusBar, $i_part, $szIconFile, $iconID) Sets an Icon in the Panel. (required: <GuiStatusBar.au3>)
; Author(s):         gafrost (Gary Frost ([email="custompcs at charter dot net"]custompcs at charter dot net[/email]))
; Note(s):    To remove the icon from a panel use -1 for $i_iconID
;       If using simple status bar then set $i_part to 255
;===============================================================================
Func _GuiCtrlStatusBarSetIcon($h_StatusBar, $i_part, $s_IconFile, $i_iconID)
    Local $hIcon, $result
    If $i_part = 255 Then $i_part = -1
    If Not IsHWnd($h_StatusBar) Then $h_StatusBar = HWnd($h_StatusBar)
    If $i_iconID = -1 Then
        $result = DllCall("user32.dll", "int", "SendMessage", "hwnd", $h_StatusBar, "int", $SB_SETICON, "int", $i_part, "hwnd", $i_iconID)
        If IsArray($result) Then 
            Return $result
        Else
            Return SetError(-1,-1,0)
        EndIf
    Else
        $hIcon = DllStructCreate("int")
        $result = DllCall("shell32.dll", "int", "ExtractIconEx", "str", $s_IconFile, "int", $i_iconID, "hwnd", 0, "ptr", DllStructGetPtr($hIcon), "int", 1)
        $result = $result[0]
        If $result > 0 Then
            $result = DllCall("user32.dll", "int", "SendMessage", "hwnd", $h_StatusBar, "int", $SB_SETICON, "int", $i_part, "hwnd", DllStructGetData($hIcon, 1))
        EndIf
        DllCall("user32.dll", "int", "DestroyIcon", "hwnd", DllStructGetPtr($hIcon))
        $hIcon = 0
        If IsArray($result) Then 
            Return $result
        Else
            Return SetError(-1,-1,0)
        EndIf
    EndIf
EndFunc   ;==>_GuiCtrlStatusBarSetIcon

;===============================================================================
;
; Description:       _GuiCtrlStatusBarSetMinHeight
; Parameter(s):      $h_StatusBar    -    Handle to statusbar
;                    $i_MinHeight    -    Minimum height, in pixels, of the window
; Requirement:
; Return Value(s):   None
; User CallTip:      _GuiCtrlStatusBarSetMinHeight($h_StatusBar, $i_MinHeight) Sets the minimum height of a status window's drawing area. (required: <GuiStatusBar.au3>)
; Author(s):         gafrost (Gary Frost (custompcs at charter dot net))
; Note(s):
;===============================================================================
Func _GuiCtrlStatusBarSetMinHeight($h_StatusBar, $i_MinHeight)
    If Not IsHWnd($h_StatusBar) Then $h_StatusBar = HWnd($h_StatusBar)
    DllCall("user32.dll", "int", "SendMessage", "hwnd", $h_StatusBar, "int", $SB_SETMINHEIGHT, "int", $i_MinHeight, "int", 0)
    _GuiCtrlStatusBarResize($h_StatusBar)
EndFunc   ;==>_GuiCtrlStatusBarSetMinHeight

;===============================================================================
;
; Description:       _GuiCtrlStatusBarSetSimple
; Parameter(s):      $h_StatusBar    -    Handle to statusbar
;                    $b_Simple       -    Display type flag.
;                        If this parameter is TRUE, the window displays simple text. (Default)
;                        If it is FALSE, it displays multiple parts
; Requirement:
; Return Value(s):   None
; User CallTip:      _GuiCtrlStatusBarSetSimple($h_StatusBar[, $b_Simple = True]) Specifies whether a status window displays simple text or displays all window parts. (required: <GuiStatusBar.au3>)
; Author(s):         gafrost (Gary Frost (custompcs at charter dot net))
; Note(s):
;===============================================================================
Func _GuiCtrlStatusBarSetSimple($h_StatusBar, $b_Simple = True)
    If Not IsHWnd($h_StatusBar) Then $h_StatusBar = HWnd($h_StatusBar)
    DllCall("user32.dll", "int", "SendMessage", "hwnd", $h_StatusBar, "int", $SB_SIMPLE, "int", $b_Simple, "int", 0)
EndFunc   ;==>_GuiCtrlStatusBarSetSimple

;===============================================================================
;
; Description:       _GuiCtrlStatusBarSetText
; Parameter(s):      $h_StatusBar    -    The Control Id (will be converted to hWnd)
;                    $s_Data         -    The text to display in the panel
;                    $i_Panel        -    The panel to hold the text (Default: 0)
; Requirement:
; Return Value(s):   Returns TRUE if successful, or FALSE otherwise.
; User CallTip:      _GuiCtrlStatusBarSetText($h_StatusBar[, $s_Data = ""[, $i_Panel = 0]]) Sets the text in the specified part of a status window. (required: <GuiStatusBar.au3>)
; Author(s):         rysiora, JdeB, tonedef,
;                    gafrost (Gary Frost (custompcs at charter dot net))
; Note(s):           Set $i_Panel to 255 for simple statusbar
;===============================================================================
Func _GuiCtrlStatusBarSetText($h_StatusBar, $s_Data = "", $i_Panel = 0)
    If Not IsHWnd($h_StatusBar) Then $h_StatusBar = HWnd($h_StatusBar)
    Local $ret = DllCall("user32.dll", "int", "SendMessage", "hwnd", $h_StatusBar, "int", $SB_SETTEXT, "int", $i_Panel, "str", $s_Data)
    If IsArray($ret) Then
        Return $ret[0]
    Else
        Return SetError(1,1,False)
    EndIf
EndFunc   ;==>_GuiCtrlStatusBarSetText

;===============================================================================
;
; Description:       _GuiCtrlStatusBarSetTip
; Parameter(s):      $h_StatusBar    -    Handle to statusbar
;                    $i_part         -    Zero-based index of the part that will receive the ToolTip text
;                    $s_ToolTip      -    new ToolTip text
; Requirement:
; Return Value(s):   None
; User CallTip:      _GuiCtrlStatusBarSetTip($h_StatusBar, $i_part, $s_ToolTip) Sets the ToolTip text for a part in a status bar. (required: <GuiStatusBar.au3>)
; Author(s):         gafrost (Gary Frost (custompcs at charter dot net))
; Note(s):
;===============================================================================
Func _GuiCtrlStatusBarSetTip($h_StatusBar, $i_part, $s_ToolTip)
    If Not IsHWnd($h_StatusBar) Then $h_StatusBar = HWnd($h_StatusBar)
    Local $struct = DllStructCreate("char[" & StringLen($s_ToolTip) + 1 & "]")
    DllStructSetData($struct, 1, $s_ToolTip)
    If @error Then Return SetError(@error,@error,0)
    DllCall("user32.dll", "int", "SendMessage", "hwnd", $h_StatusBar, "int", $SB_SETTIPTEXT, "int", $i_part, "int", DllStructGetPtr($struct))
    $struct = 0
EndFunc   ;==>_GuiCtrlStatusBarSetTip

;===============================================================================
;
; Description:       _GuiCtrlStatusBarSetUnicode
; Parameter(s):      $h_StatusBar    -    Handle to statusbar
;                    $b_Unicode        -    Determines the character set that is used by the control.
;                        If this value is TRUE, the control will use Unicode characters. (Default)
;                        If this value is FALSE, the control will use ANSI characters.
; Requirement:
; Return Value(s):   Returns the previous Unicode format flag for the control
; User CallTip:      _GuiCtrlStatusBarSetUnicode($h_StatusBar[, $b_Unicode = True[) Sets the Unicode character format flag for the control. (required: <GuiStatusBar.au3>)
; Author(s):         gafrost (Gary Frost (custompcs at charter dot net))
; Note(s):
;===============================================================================
Func _GuiCtrlStatusBarSetUnicode($h_StatusBar, $b_Unicode = True)
    If Not IsHWnd($h_StatusBar) Then $h_StatusBar = HWnd($h_StatusBar)
    Local $a_ret = DllCall("user32.dll", "int", "SendMessage", "hwnd", $h_StatusBar, "int", $SB_SETUNICODEFORMAT, "int", $b_Unicode, "int", 0)
    If IsArray($a_ret) Then
        Return $a_ret[0]
    Else
        Return SetError(1,1,False)
    EndIf
EndFunc   ;==>_GuiCtrlStatusBarSetUnicode

;===============================================================================
; Helper functions
;===============================================================================
;===============================================================================
;
; Description:       _GuiCtrlStatusBarSetParts
; Parameter(s):      $h_StatusBar    -    The Control Id (will be converted to hWnd)
;                    $i_Panels        -    Nubmer of panesl to create
;                    $i_PanelWidth    -     width of panel(s) (Default: 100)
;
; Requirement:
; Return Value(s):   1 if successfull, otherwise zero
; User CallTip:      _GuiCtrlStatusBarSetParts ($h_StatusBar, $i_Panels[, $i_PanelWidth = 100]). (required: <GuiStatusBar.au3>)
; Author(s):         tonedef, gafrost (Gary Frost (custompcs at charter dot net)), Steve Podhajecki <gehossafats at netmdc dot com>
; Note(s):
;===============================================================================
Func _GuiCtrlStatusBarSetParts($h_StatusBar, $i_Panels, $a_PanelWidth = 100)
    Local $sta
;~  , $emsg[6]
    If Not IsHWnd($h_StatusBar) Then $h_StatusBar = HWnd($h_StatusBar)
    ;=== Set each panel to be same size and assign the last one the remainder
    If Not IsArray($a_PanelWidth) Then
        Local $a_PanelWidth[$i_Panels], $panel, $size
        $size = WinGetClientSize("")
        For $panel = 0 To $i_Panels - 1
            $a_PanelWidth[$panel] = Int(($size[0] / $i_Panels) * $panel + 1)
        Next
        $a_PanelWidth[$i_Panels - 1] = -1
    EndIf
    ;== end set sizing
    
    $sta = _CreateStuctFromArray($a_PanelWidth, "int")
    If @error Then Return SetError(1,1,0)
    
;~  $emsg[0] = "No error."
;~  $emsg[1] = "Unable to use the DLL file."
;~  $emsg[2] = ' unknown "return type".'
    
    DllCall("user32.dll", "long", "SendMessage", "hwnd", $h_StatusBar, "int", $SB_SETPARTS, "int", $i_Panels, "ptr", DllStructGetPtr($sta))
    If @error Then Return SetError(1,1,0)
    ;== Sometimes this needs to be called in order to update the status bar.
    _GuiCtrlStatusBarResize($h_StatusBar)
    $sta = ""
    Return 1
EndFunc   ;==>_GuiCtrlStatusBarSetParts

;===============================================================================
;
; Description:       CreateStructFromArray
; Parameter(s):      $a_Variable array to create struct with
;                    $structType, the SINGLE type of struct to create.
; Requirement:
; Return Value(s):
; User CallTip:      _CreateStructFromArray
; Author(s):            Steve Podhajecki <gehossafats at netmdc dot com>
; Note(s):
;===============================================================================
Func _CreateStuctFromArray($a_Variable, $structType)
    If Not IsArray($a_Variable) Then Return SetError(1,1,0)
    Local $a_ctr, $strVar, $struct
;~  , $emsg[6]
    For $a_ctr = 0 To UBound($a_Variable) - 1
        $strVar &= $structType & ";"
    Next
    $strVar = StringTrimRight($strVar, 1)
;~  $emsg[0] = "No Error."
;~  $emsg[1] = "Variable passed to DllStructCreate was not a string."
;~  $emsg[2] = "There is an unknown Data Type in the string passed. "
;~  $emsg[3] = "Failed to allocate the memory needed for the struct, or Pointer = 0."
;~  $emsg[4] = "Error allocating memory for the passed string."
;~  $emsg[5] = ""
    
    $struct = DllStructCreate($strVar)
    If @error Then Return SetError(1,1,0)
    
;~  $emsg[0] = 'No Error. '
;~  $emsg[1] = 'Struct not a correct struct returned by DllStructCreate.'
;~  $emsg[2] = 'Element value out of range. '
;~  $emsg[3] = 'index would be outside of the struct.'
;~  $emsg[4] = 'Element data type is unknown'
;~  $emsg[5] = 'index < 0.'
    For $a_ctr = 0 To UBound($a_Variable) - 1
        DllStructSetData($struct, ($a_ctr) + 1, $a_Variable[$a_ctr])
        If @error Then Return SetError(1,1,0)
    Next
    Return $struct
EndFunc   ;==>_CreateStuctFromArray

Theres GUIStatusBar.au3

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...