Sign in to follow this  
Followers 0
MrCreatoR

GUIListViewSysLink UDF!

18 posts in this topic

#1 ·  Posted (edited)

Hi!

This whole concept belongs to rasim, and the idea of SysLink control inside ListView belongs to ptrex! He proposed it, and i thought that this will be a good challenge/practic for me! :P

Here we go...

#cs
    Name:               GUIListViewSysLink.au3
    Description:        Functions to set Hyperlink (via SysLink control) for ListView items.
    Author:             G.Sandler (a.k.a MrCreatoR), initial concept idea by R.Gilman (a.k.a rasim), this UDF idea by ptrex!
    AutoIt version:     3.2.12.1 - 3.3.8.1
    UDF version:        1.2
#CE

Example:

#include "GUIListViewSysLink.au3"

$hGUI = GUICreate("ListView with SysLink Control!", 420, 530, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_SIZEBOX))

$hListView1 = GUICtrlCreateListView("Files|Path|Links", 10, 10, 400, 240, BitOR($LVS_REPORT, $WS_BORDER, $WS_CLIPSIBLINGS))
GUICtrlCreateListViewItem("AutoIT|C:\Program Files\AutoIt3", $hListView1)
GUICtrlCreateListViewItem("Opera|C:\Program Files\Opera", $hListView1)
GUICtrlCreateListViewItem("Script|C:\MyScripts", $hListView1)

$nSysLinkBkColor = 0xC0C0C0
$nSysLinkStockObject = $LTGRAY_BRUSH

$hListView2 = GUICtrlCreateListView("Name|Links", 10, 270, 400, 240, BitOR($LVS_REPORT, $WS_BORDER, $WS_CLIPSIBLINGS))
GUICtrlCreateListViewItem("Some Name", $hListView2)

$hSysLink1  = _GUICtrlListView_SysLinkCreate($hListView1, "AutoIt Script Home Page", "http://autoitscript.com", 0, 2)
_GUICtrlListView_SysLinkSetFont(-1, "Tahoma", 9.5)

$hSysLink2  = _GUICtrlListView_SysLinkCreate($hListView1, "Opera Home Page", "http://opera.com", 1, 2)
_GUICtrlListView_SysLinkSetFont(-1, "Tahoma", 9.5)

$hSysLink3  = _GUICtrlListView_SysLinkCreate($hListView1, "My Scripts Home Page?", "http://creator-lab.ucoz.ru", 2, 2)
_GUICtrlListView_SysLinkSetFont(-1, "Tahoma", 9.5)

$hSysLink1_2  = _GUICtrlListView_SysLinkCreate($hListView2, "Some other Home Page", "http://creator-lab.ucoz.ru", 0, 1)
_GUICtrlListView_SysLinkSetFont(-1, "Arial", 10.5)

GUICtrlSetBkColor($hListView1, $nSysLinkBkColor)
GUICtrlSetBkColor($hListView2, $nSysLinkBkColor)

GUICtrlSendMsg($hListView1, $LVM_SETCOLUMNWIDTH, 0, 80)
GUICtrlSendMsg($hListView1, $LVM_SETCOLUMNWIDTH, 1, 150)
GUICtrlSendMsg($hListView1, $LVM_SETCOLUMNWIDTH, 2, 120)

GUICtrlSendMsg($hListView2, $LVM_SETCOLUMNWIDTH, 0, 230)
GUICtrlSendMsg($hListView2, $LVM_SETCOLUMNWIDTH, 1, 115)

;Here we add ID to the $hSysLink1
_GUICtrlListView_SysLinkSetLinkInfo($hSysLink1, "http://autoitscript.com", "AutoIt")

;And now we check if it was added :)
$aInfo = _GUICtrlListView_SysLinkGetLinkInfo($hSysLink1)
$sInfo = StringFormat("Info For $hSysLink1:\n\nSysLink State\t\t= %i\nURL\t\t\t= %s\nID\t\t\t= %s\nParent ListView Handle\t= %s", _
    $aInfo[1], $aInfo[2], $aInfo[3], $aInfo[4])

ConsoleWrite($sInfo)

GUISetState(@SW_SHOW, $hGUI)

While GUIGetMsg() <> $GUI_EVENT_CLOSE
WEnd

The UDF and this example attached bellow.

P.S

Feedbacks and bug reports are always welcome!

GUIListViewSysLink_1.2.zip

ListView_SysLink_1.1.zip

ListView_SysLink_1.0.zip

Test Version (with Label control):

ListView_Link_TestVersion.zip

History version:

v1.2 [13.01.2013]

* AutoIt 3.3.8.1 compatibility.

* UDF renamed to GUIListViewSysLink.au3.

* Fixed issue when clicking on link does not executed properly.

* Fixed an issue with wrong SysLink control position set after resizing.

If "Display window content when draging" is disabled in Performance options, resizing was wrong.

v1.1 [21.10.2008]

+ Added handler to activate the main window when SysLink control is focused.

This handler also set hot cursor ($OCR_NO) while user trying to drag the SysLink control.

+ Added 2 more functions:

_GUICtrlListView_SysLinkSetLinkInfo() - Sets link information.

_GUICtrlListView_SysLinkGetLinkInfo() - Gets link information.

+ Added WM_CTLCOLORSTATIC registration to set bk color for the SysLink control.

(To change the color just set $nSysLinkBkColor variable to desired color).

* Rewrited parameters for the _GUICtrlListView_SysLinkCreate() function...

* $sTextFormat splitted into different 3 parameters: $sTitle, $sLink and $iLnkID.

* Added $iFillItemText - Allows to fill item text (SysLink text),

so the LV item will have the same text as SysLink control. Default is 1.

* Fixed inactive GUI window after executing url.

v1.0 [10.10.2008]

* First release.

Enjoy! Posted Image

Edited by MrCreatoR

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites



MrCreatoR

Good work. Thank you! :P

Share this post


Link to post
Share on other sites

Very Nice! Thanks!

Share this post


Link to post
Share on other sites

Good work here... a suggestion I'd make is to get the back ground color of the listview and paint the background color of the CreateWindowEx the same :(... You two seem to feed of each other well :P .


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

@SmOke_N

I am just kicking the ball, it is MrCreatoR and ProgAndy who is scoring here !! :P

Anyhow this is a very nice addition to the standard listView.

Regards,

ptrex

I was speaking of Rasim :( ... Both have produced some nice Listview alternatives/options. That's who I was referring to by feeding well off of one another (I mistyped in my other post, I put "Feed of" rather than "Feed off").

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Thanks for the feedbacks!

@SmOke_N

a suggestion I'd make is to get the back ground color of the listview and paint the background color of the CreateWindowEx the same

Actualy i tried that, i spent on this issue more time than on building the UDF itself :(

How to set background color for window created with _WinAPI_CreateWindowEx() ?

And what is the best way to get Background color of ListView control?

This one not working:

$hDC = DllCall("User32.dll", "hwnd", "GetDC", "hwnd", $hLV)
$hDC = $hDC[0]

$nColor = DllCall("GDI32.dll", "int", "GetBkColor", "hwnd", $hDC)

It returns FFFFFF (white) always :P

Edited by MrCreatoR

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

#10 ·  Posted

For setting the bg color, experiment with the WM_CTLCOLOR* messages. I don't know which one, if any, that a syslink control sends though. Here's the msdn -

http://msdn.microsoft.com/en-us/library/bb432504(VS.85).aspx

I don't see a call on 32 bit system for SysLink control ...

Thanks for the feedbacks!

@SmOke_N

Actualy i tried that, i spent on this issue more time than on building the UDF itself :(

How to set background color for window created with _WinAPI_CreateWindowEx() ?

And what is the best way to get Background color of ListView control?

This one not working:

$hDC = DllCall("User32.dll", "hwnd", "GetDC", "hwnd", $hLV)
$hDC = $hDC[0]

$nColor = DllCall("GDI32.dll", "int", "GetBkColor", "hwnd", $hDC)

It returns FFFFFF (white) always :P

This is a similar issue I had here: http://www.autoitscript.com/forum/index.php?showtopic=65802

I reformatted it a bit using wraithdu's and googles suggestion: http://cboard.cprogramming.com/archive/ind...hp/t-91110.html :

Func _GUISetSysLinkBkColor($h_parent, $h_wnd, $i_color = 0xFFFFFF)
    Local Const $GCL__HBRBACKGROUND  = -10
    Local Const $RDW__ERASE          = 0x04
    Local Const $RDW__INVALIDATE        = 0x01
    Local Const $RDW__ALLCHILDREN      = 0x080
    Local Const $RDW__UPDATENOW      = 0x100
    Local Const $WM__CTLCOLORSTATIC  = 0x00138

    Local $i_color_bgr = _
                        BitOR(BitShift(BitAND($i_color, 0x000000FF), 16), _
                        BitAND($i_color, 0x0000FF00), _
                        BitShift(BitAND($i_color, 0x00FF0000),16))
                        
    Local $h_dc = DllCall("User32.dll", "hwnd", "GetDC", "hwnd", $hSysLink1)
    If @error Then Return SetError(1, 0, 0)
    
    Local $h_sm = DllCall("User32.dll", "hwnd", "SendMessage", "hwnd", $h_parent, "uint", $WM__CTLCOLORSTATIC, "wparam", $h_dc[0], "lparam", $h_wnd)
    If @error Then Return SetError(2, 0, 0)
    
    Local $i_scl = DllCall("User32.dll", "int", "SetClassLongA", "hwnd", $h_wnd, "int", $GCL__HBRBACKGROUND, "dword", $h_sm[0])
    If @error Then Return SetError(3, 0, 0)
    
    DllCall("User32.dll", "int", "DeleteObject", "long", $i_scl[0])
    DllCall("User32.dll", "int", "InvalidateRect", "hwnd", $h_wnd, "int", 0, "int", 1)
    DllCall("User32.dll", "int", "RedrawWindow", "hwnd", $h_wnd, "int", 0, "int", 0, "uint", _
                BitOR($RDW__ERASE, $RDW__INVALIDATE, $RDW__ALLCHILDREN, $RDW__UPDATENOW))
    DllCall("User32.dll", "int", "UpdateWindow", "hwnd", $h_wnd)
    DllCall("User32.dll", "int", "ReleaseDC", "hwnd", $h_wnd, "hwnd", $h_dc[0])
    Return 1
EndFunc
But still the same issue :idea: ... I'll be curious to see this be accomplished for more than one reason obviously :) ...

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#11 ·  Posted

I spent 2 more hours (or maybe more) on this, this function has suffered a lot from me :P But no luck either :)

In the end(?) i came up with two workarounds:

1) Change the background color of ListView control :( - Not so preferable.

2) Instead of SysLink control use standard labels on top of new GUI (as framework), and handle the clicks with some timer function.

For the first one just add this to the top of _GUICtrlListView_SysLinkCreate function:

Local $nBkColor = _WinAPI_GetSysColor($COLOR_3DFACE)
    GUICtrlSetBkColor($hWnd, $nBkColor)

(before «If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd)»).

About the second one, later i will post test-version (to see if it's good enough :idea: ).


Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

#12 ·  Posted

UDF updated!

History:

; v1.0 [10.10.2008, 02:20]

; First release.

;

; v1.1 [21.10.2008, 00:03]

; - Added handler to activate the main window when SysLink control is focused.

; This handler also set hot cursor ($OCR_NO) while user trying to drag the SysLink control.

;

; - Added 2 more functions:

; _GUICtrlListView_SysLinkSetLinkInfo() - Sets link information.

; _GUICtrlListView_SysLinkGetLinkInfo() - Gets link information.

;

; - Added WM_CTLCOLORSTATIC registration to set bk color for the SysLink control.

; (To change the color just set $nSysLinkBkColor variable to desired color).

;

; - Rewrited parameters for the _GUICtrlListView_SysLinkCreate() function...

; * $sTextFormat splitted into different 3 parameters: $sTitle, $sLink and $iLnkID.

; * Added $iFillItemText - Allows to fill item text (SysLink text),

; so the LV item will have the same text as SysLink control. Default is 1.

;

; - Fixed inactive GUI window after executing url.

I also added mentioned before Test version (with Label control), please see first post.

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

#13 ·  Posted

hummm getting in 3.3.6.1 an error message :unsure:

C:\Program Files\AutoIt3\Include\_ListView_SysLink.au3(59,31) : ERROR: $HDN_FIRST previously declared as a 'Const'

Global Const $HDN_FIRST = -300

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\~\test3.au3 - 1 error(s), 0 warning(s)

maybe u can do something whit it :>

i don't ;)


[size="4"][u][quote]as finishing touch god created the dutch [/quote][/size][/u]

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

Delete the line with the error message, it's already been declared in one of the other included files, HeaderConstants.au3 in this case.

EDIT:typo

Edited by BrewManNH

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

#15 ·  Posted

This is awesome and it helped me to create a link for my tool... but if i click on the link nothing happens how to make work ?


Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Share this post


Link to post
Share on other sites

#16 ·  Posted

Update (after 4 years! :lmao: ):

v1.2 [13.01.2013]

* AutoIt 3.3.8.1 compatibility.

* UDF renamed to GUIListViewSysLink.au3.

* Fixed issue when clicking on link does not executed properly.

* Fixed an issue with wrong SysLink control position set after resizing.

If "Display window content when draging" is disabled in Performance options, resizing was wrong.


Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

#17 ·  Posted

Hello MrCreatoR,

I recently found your solution for the hyperlinks for listviews and found it really helpfull. I almost got my Autoit applicaton running however stumbled over a problem I have difficulties to resolve. It might be quite trivial for you and hopefully you can help. I am using your GUIListViewSysLink code to actually show hyperlinks in a listview which have prior been extracted from a text file. Hence the string containing the address (in my case it will be a file path) will need to be stored assigned to a variabel first and then will need to be handed over to your function. Here is the line of code where the problem starts:

...

_GUICtrlListView_SysLinkCreate($listview, "Update", $link, $i-1, 4)

...

Here the $link variable contains a simple string such as "C:tempupdate.bat". and it really needs to be a variable to allow changing hyperlinks. When executing my code I don't get a hyperlink in the corresponding column but rather something like:
<a href="C:tempupdate.bat""

I might have forgotton some other parameters. Could you help me out here? I hope the info I provided is sufficient.

Would really appreciate your help.

Regards,

hudehade

Share this post


Link to post
Share on other sites

#18 ·  Posted

When executing my code I don't get a hyperlink in the corresponding column but rather something like:

<a href="C:tempupdate.bat""

 

Hi,

I have tested the issue with variable, and it's working fine:

$sLink = 'c:\test.txt'
$hSysLink  = _GUICtrlListView_SysLinkCreate($hListView, "Update", $sLink, 0, 1)

Perhaps something wrong with the index values, can you show me the full code? Or a part with the ListView and UDF called in a loop?


Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

AutoIt is simple, subtle, elegant. © AutoIt Team

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

  • Similar Content

    • TheDcoder
      Help with resizing controls in a resizable window!
      By TheDcoder
      Hello! I am trying make my GUI Controls resize correctly... Here is my GUI's code:
      #include <ButtonConstants.au3> #include <ColorConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <WindowsConstants.au3> Global $g_hMainGUI = GUICreate("Test GUI", 500, 316, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX, $WS_SIZEBOX)) GUISetBkColor($COLOR_WHITE, $g_hMainGUI) GUICtrlCreateGroup("Box 1", 6, 2, 488, 197) GUICtrlSetResizing(-1, $GUI_DOCKBORDERS) GUICtrlCreateLabel("Label", 9, 20, 67, 15) GUICtrlSetResizing(-1, $GUI_DOCKAUTO) GUICtrlCreateCombo("", 77, 14, 334, 21, $CBS_DROPDOWNLIST) GUICtrlSetResizing(-1, $GUI_DOCKAUTO) GUICtrlCreateButton("Button 0", 415, 13, 74, 23) GUICtrlSetResizing(-1, BitOR($GUI_DOCKAUTO, $GUI_DOCKVCENTER, $GUI_DOCKHEIGHT)) GUICtrlCreatelistView("Col 1|Col 2|Col 3", 12, 42, 476, 149, $LVS_SINGLESEL, BitOR($LVS_EX_FULLROWSELECT, $WS_EX_CLIENTEDGE)) GUICtrlSetResizing(-1, $GUI_DOCKBORDERS) GUICtrlCreateGroup("Box 2", 6, 199, 253, 112) ;GUICtrlSetResizing(-1, $GUI_DOCKHEIGHT) GUICtrlCreateButton("Button 1", 11, 214, 121, 30) GUICtrlSetResizing(-1, $GUI_DOCKAUTO + $GUI_DOCKSTATEBAR) GUICtrlCreateButton("Button 2", 11, 245, 121, 30) GUICtrlSetResizing(-1, $GUI_DOCKAUTO + $GUI_DOCKSTATEBAR) GUICtrlCreateButton("Button 3", 133, 245, 121, 30) GUICtrlSetResizing(-1, $GUI_DOCKAUTO + $GUI_DOCKSTATEBAR) GUICtrlCreateButton("Button 4", 133, 214, 121, 30) GUICtrlSetResizing(-1, $GUI_DOCKAUTO + $GUI_DOCKSTATEBAR) GUICtrlCreateButton("Button 5", 11, 276, 121, 30) GUICtrlSetResizing(-1, $GUI_DOCKAUTO + $GUI_DOCKSTATEBAR) GUICtrlCreateButton("Button 6", 133, 276, 121, 30) GUICtrlSetResizing(-1, $GUI_DOCKAUTO + $GUI_DOCKSTATEBAR) GUICtrlCreateGroup("Box 3", 264, 199, 230, 112) ;GUICtrlSetResizing(-1, $GUI_DOCKHEIGHT) GUICtrlCreateButton("Button 7", 269, 214, 220, 30) GUICtrlSetResizing(-1, $GUI_DOCKAUTO + $GUI_DOCKSTATEBAR) GUICtrlCreateButton("Button 8", 269, 245, 220, 30) GUICtrlSetResizing(-1, $GUI_DOCKAUTO + $GUI_DOCKSTATEBAR) GUICtrlCreateButton("Button 9", 269, 276, 220, 30) GUICtrlSetResizing(-1, $GUI_DOCKAUTO + $GUI_DOCKSTATEBAR) GUISetState() Local $nMsg = 0 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete($g_hMainGUI) Here is what I need: 

      1. Prevent button 0, Label & Combo from moving down
      2. Prevent expansion of Box 1 & 2
       
      I tried a lot but I can't get the desired result, now my brain hurts!
      Thanks in Advance, TD!
    • gil900
      GUIImageButton* - Create GDIP button with image and with frame
      By gil900
      Hello,
      I worte this:

      $hGUI = GUICreate('', 326, 260, 312, 159) WinSetOnTop($hGUI,'',1) GUISetBkColor(0xF5FF82) GUISetState(@SW_SHOW) _GDIPlus_Startup() $hGUI_hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI) $Button1Image = @ScriptDir&'\button.png' ; $Button1Image = 'img_button' ; <- Activate this line if you want the image to be loaded from resources $Button2Image = @ScriptDir&'\button2.png' ; $Button2Image = 'img_button2' ; <- Activate this line if you want the image to be loaded from resources $Button = GUIImageButton_Create($hGUI_hGraphics,$Button1Image,95, 72) Sleep(1000) ; Set frame for the button GUIImageButton_SetSquareFrame($hGUI,$hGUI_hGraphics,$Button,10,0xFF00A300) Sleep(1000) ; Set the image button2.png for the button GUIImageButton_SetNewImage($hGUI_hGraphics,$Button,$Button2Image) Sleep(1000) ; Set the image button1.png for the button GUIImageButton_SetNewImage($hGUI_hGraphics,$Button,$Button1Image) Sleep(1000) ; Set new frame instead of the previous GUIImageButton_SetSquareFrame($hGUI,$hGUI_hGraphics,$Button,5,0xFFFF0505) Sleep(1000) ; Remove the frame from the button GUIImageButton_RemoveSquareFrame($hGUI,$Button) Sleep(1000) ; Set frame again GUIImageButton_SetSquareFrame($hGUI,$hGUI_hGraphics,$Button,1) Sleep(1000) ; Remove only the image from the button GUIImageButton_CleanGraphics($hGUI,$Button,0) ; If the 3 parameter is 1 then it will clean also the frame. *It will not remove the button! only clean the visual output Sleep(1000) ; Set the image button2.png for the button GUIImageButton_SetNewImage($hGUI_hGraphics,$Button,$Button2Image) ; This will remove the button. you can call it without calling GUIImageButton_CleanGraphics before ;~ GUIImageButton_Delete($hGUI,$Button1) ;~ Do ;~ Until GUIGetMsg() = $GUI_EVENT_CLOSE ; To use the button just: ; This will not work if you activated line 80 and will not work during the sleeps... ConsoleWrite('listening to $Button:' & @CRLF) While Sleep(10) Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $Button[0] ; <- *[0] ConsoleWrite('$Button1 Clicked' & @CRLF) EndSwitch WEnd ; #FUNCTION# ==================================================================================================================== ; Name ..........: GUIImageButton_Create ; Description ...: Create button with image ; Syntax ........: GUIImageButton_Create($hGUI_hGraphics, $Image, $x_pos, $y_pos[, $x_size = Default[, $y_size = Default]]) ; Parameters ....: $hGUI_hGraphics - value of _GDIPlus_GraphicsCreateFromHWND($hGUI) ; $Image - Can be path the the image file or resource name ; $x_pos - the x pos of the image in the GUI. ; $y_pos - the y pos of the image in the GUI. ; $x_size - [optional] the x size of the image ; $y_size - [optional] the y size of the image ; ** x size and y size must be the same as the real xy size of the image file! ; Return values .: Button handle (Array): ; [0] is the ctrl id and this is the only important thing. [1] & [2] are for internal use only ; Author ........: gil900 ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: Yes ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name ..........: GUIImageButton_SetSquareFrame ; Description ...: Create frame around the button ; Syntax ........: GUIImageButton_SetSquareFrame($hGUI, $hGUI_hGraphics, Byref $aButton[,$iLineWidth = 1 [, ; $LineColor_rgba = 0xFF000000]]) ; Parameters ....: $hGUI - A handle for the GUI ; $hGUI_hGraphics - value of _GDIPlus_GraphicsCreateFromHWND($hGUI). ; $aButton - value of GUIImageButton_Create ; $iLineWidth - [optional] The width in pixels of the frame. Default is 1. ; $LineColor_rgba - [optional] the color value - [0xFF & RGB code]. ; Default is 0xFF000000. ; Return values .: None ; Author ........: gil900 ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name ..........: GUIImageButton_SetNewImage ; Description ...: Set new image over the previous one. ** The new image must be the same size! ; Syntax ........: GUIImageButton_SetNewImage($hGUI_hGraphics, $aButton, $Image) ; Parameters ....: $hGUI_hGraphics - value of _GDIPlus_GraphicsCreateFromHWND($hGUI). ; $aButton - value of GUIImageButton_Create ; $Image - Can be path the the image file or resource name ; Return values .: None ; Author ........: gil900 ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name ..........: GUIImageButton_RemoveSquareFrame ; Description ...: Remove only the frame around the image(if exists) ; Syntax ........: GUIImageButton_RemoveSquareFrame($hGUI, Byref $aButton) ; Parameters ....: $hGUI - A handle for the GUI ; $aButton - value of GUIImageButton_Create ; Return values .: None ; Author ........: gil900 ; Example .......: No ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name ..........: GUIImageButton_Delete ; Description ...: Remove the button ; Syntax ........: GUIImageButton_Delete($hGUI, Byref $aButton) ; Parameters ....: $hGUI - A handle for the GUI ; $aButton - value of GUIImageButton_Create ; Return values .: None ; Author ........: gil900 ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name ..........: GUIImageButton_CleanGraphics ; Description ...: Clean ONLY the graphics of the button. Can clean only the image without the frame or the image+frame((if exists)) ; * It will not delete the button. ; Syntax ........: GUIImageButton_CleanGraphics($hGUI, Byref $aButton[, $CleanFrame = 1]) ; Parameters ....: $hGUI - A handle for the GUI ; $aButton - value of GUIImageButton_Create ; $CleanFrame - [optional] 1 = clean image+frame(if exists) ; 2 = clean image only ; . Default is 1. ; Return values .: None ; Author ........: Your Name ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; ===============================================================================================================================  
      Download full code with the images:
      GUIImageButton - r2.rar
      GUIImageButton.rar
      Tested on Autoit 3.3.14.2
      If the title is not good enough then you can edit it and and write better one.
       
      Hope you found it useful. If so then please leave a comment. It took a long time to share this piece of code with the documentation
    • mLipok
      SMTP Mailer UDF
      By mLipok
      I very long time was using
       

       
       
      In the end, I found that at present my needs I need to modify it. And here it is:
      #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 ;~ #AutoIt3Wrapper_Run_Debug_Mode=Y ;(Y/N) Run Script with console debugging. Default=N #Region INCLUDE ;################################## ; Include ;################################## #include <file.au3> #EndRegion INCLUDE #Region Variables ;################################## ; Variables ;################################## Global Enum _ $g__INetSmtpMailCom_ERROR_FileNotFound = 1, _ $g__INetSmtpMailCom_ERROR_Send, _ $g__INetSmtpMailCom_ERROR_ObjectCreation, _ $g__INetSmtpMailCom_ERROR_COUNTER Global Const $g__cdoSendUsingPickup = 1 ; Send message using the local SMTP service pickup directory. Global Const $g__cdoSendUsingPort = 2 ; Send the message using the network (SMTP over the network). Must use this to use Delivery Notification Global Const $g__cdoAnonymous = 0 ; Do not authenticate Global Const $g__cdoBasic = 1 ; basic (clear-text) authentication Global Const $g__cdoNTLM = 2 ; NTLM ; Delivery Status Notifications Global Const $g__cdoDSNDefault = 0 ; None Global Const $g__cdoDSNNever = 1 ; None Global Const $g__cdoDSNFailure = 2 ; Failure Global Const $g__cdoDSNSuccess = 4 ; Success Global Const $g__cdoDSNDelay = 8 ; Delay Global Const $g__cdoDSNSuccessFailOrDelay = 14 ; Success, failure or delay #EndRegion Variables #Region Example Script ;################################## ; Example Script ;################################## ;~ _Example() Func _Example() Local $sSmtpServer = "MailServer" ; address for the smtp-server to use - REQUIRED Local $sFromName = "Name" ; name from who the email was sent Local $sFromAddress = "your@Email.Address.com" ; address from where the mail should come Local $sToAddress = "your@Email.Address.com" ; destination address of the email - REQUIRED Local $sSubject = "Userinfo" ; subject from the email - can be anything you want it to be Local $sBody = "" ; the messagebody from the mail - can be left blank but then you get a blank mail Local $sAttachFiles = "" ; the file(s) you want to attach seperated with a ; (Semicolon) - leave blank if not needed Local $sCcAddress = "CCadress1@test.com" ; address for cc - leave blank if not needed Local $sBccAddress = "BCCadress1@test.com" ; address for bcc - leave blank if not needed Local $sImportance = "Normal" ; Send message priority: "High", "Normal", "Low" Local $sUsername = "******" ; username for the account used from where the mail gets sent - REQUIRED Local $sPassword = "********" ; password for the account used from where the mail gets sent - REQUIRED Local $iIPPort = 25 ; port used for sending the mail Local $bSSL = False ; enables/disables secure socket layer sending - set to True if using httpS ; Local $iIPPort = 465 ; GMAIL port used for sending the mail ; Local $bSSL = True ; GMAIL enables/disables secure socket layer sending - set to True if using httpS Local $bIsHTMLBody = False Local $iDSNOptions = $g__cdoDSNDefault Local $rc = _INetSmtpMailCom($sSmtpServer, $sFromName, $sFromAddress, $sToAddress, $sSubject, $sBody, $sAttachFiles, $sCcAddress, $sBccAddress, $sImportance, $sUsername, $sPassword, $iIPPort, $bSSL, $bIsHTMLBody, $iDSNOptions) If @error Then MsgBox(0, "_INetSmtpMailCom(): Error sending message", _ "Error code: " & @error & @CRLF & @CRLF & _ "Error Hex Number: " & _INetSmtpMailCom_ErrHexNumber() & @CRLF & @CRLF & _ "Description: " & _INetSmtpMailCom_ErrDescription() & @CRLF & @CRLF & _ "Description (rc): " & $rc & @CRLF & @CRLF & _ "ScriptLine: " & _INetSmtpMailCom_ErrScriptLine() _ ) ConsoleWrite("### COM Error ! Number: " & _INetSmtpMailCom_ErrHexNumber() & " ScriptLine: " & _INetSmtpMailCom_ErrScriptLine() & " Description:" & _INetSmtpMailCom_ErrDescription() & @LF) EndIf EndFunc ;==>_Example #EndRegion Example Script #Region UDF Functions ; The UDF ; #FUNCTION# ==================================================================================================================== ; Name ..........: _INetSmtpMailCom ; Description ...: ; Syntax ........: _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress[, $s_Subject = ""[, $as_Body = ""[, ; $s_AttachFiles = ""[, $s_CcAddress = ""[, $s_BccAddress = ""[, $s_Importance = "Normal"[, $s_Username = ""[, ; $s_Password = ""[, $IPPort = 25[, $bSSL = False[, $bIsHTMLBody = False[, $iDSNOptions = $g__cdoDSNDefault]]]]]]]]]]]]) ; Parameters ....: $s_SmtpServer - A string value. ; $s_FromName - A string value. ; $s_FromAddress - A string value. ; $s_ToAddress - A string value. ; $s_Subject - [optional] A string value. Default is "". ; $s_Body - [optional] A string value. Default is "". ; $s_AttachFiles - [optional] A string value. Default is "". ; $s_CcAddress - [optional] A string value. Default is "". ; $s_BccAddress - [optional] A string value. Default is "". ; $s_Importance - [optional] A string value. Default is "Normal". ; $s_Username - [optional] A string value. Default is "". ; $s_Password - [optional] A string value. Default is "". ; $IPPort - [optional] An integer value. Default is 25. ; $bSSL - [optional] A binary value. Default is False. ; $bIsHTMLBody - [optional] A binary value. Default is False. ; $iDSNOptions - [optional] An integer value. Default is $g__cdoDSNDefault. ; Return values .: None ; Author ........: Jos ; Modified ......: mLipok ; Remarks .......: ; Related .......: http://www.autoitscript.com/forum/topic/23860-smtp-mailer-that-supports-html-and-attachments/ ; Link ..........: http://www.autoitscript.com/forum/topic/167292-smtp-mailer-udf/ ; Example .......: Yes ; =============================================================================================================================== Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $s_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Importance = "Normal", $s_Username = "", $s_Password = "", $IPPort = 25, $bSSL = False, $bIsHTMLBody = False, $iDSNOptions = $g__cdoDSNDefault) ; init Error Handler _INetSmtpMailCom_ErrObjInit() Local $objEmail = ObjCreate("CDO.Message") If Not IsObj($objEmail) Then Return SetError($g__INetSmtpMailCom_ERROR_ObjectCreation, Dec(_INetSmtpMailCom_ErrHexNumber()), _INetSmtpMailCom_ErrDescription()) ; Clear previous Err information _INetSmtpMailCom_ErrHexNumber(0) _INetSmtpMailCom_ErrDescription('') _INetSmtpMailCom_ErrScriptLine('') $objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>' $objEmail.To = $s_ToAddress If $s_CcAddress <> "" Then $objEmail.Cc = $s_CcAddress If $s_BccAddress <> "" Then $objEmail.Bcc = $s_BccAddress $objEmail.Subject = $s_Subject ; Select whether or not the content is sent as plain text or HTM If $bIsHTMLBody Then $objEmail.Textbody = $s_Body & @CRLF Else $objEmail.HTMLBody = $s_Body EndIf ; Add Attachments If $s_AttachFiles <> "" Then Local $S_Files2Attach = StringSplit($s_AttachFiles, ";") For $x = 1 To $S_Files2Attach[0] $S_Files2Attach[$x] = _PathFull($S_Files2Attach[$x]) If FileExists($S_Files2Attach[$x]) Then ConsoleWrite('+> File attachment added: ' & $S_Files2Attach[$x] & @LF) $objEmail.AddAttachment($S_Files2Attach[$x]) Else ConsoleWrite('!> File not found to attach: ' & $S_Files2Attach[$x] & @LF) Return SetError($g__INetSmtpMailCom_ERROR_FileNotFound, 0, 0) EndIf Next EndIf ; Set Email Configuration $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = $g__cdoSendUsingPort $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_SmtpServer If Number($IPPort) = 0 Then $IPPort = 25 $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $IPPort ;Authenticated SMTP If $s_Username <> "" Then $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = $g__cdoBasic $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = $s_Username $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $s_Password EndIf $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = $bSSL ;Update Configuration Settings $objEmail.Configuration.Fields.Update ; Set Email Importance Switch $s_Importance Case "High" $objEmail.Fields.Item("urn:schemas:mailheader:Importance") = "High" Case "Normal" $objEmail.Fields.Item("urn:schemas:mailheader:Importance") = "Normal" Case "Low" $objEmail.Fields.Item("urn:schemas:mailheader:Importance") = "Low" EndSwitch ; Set DSN options If $iDSNOptions <> $g__cdoDSNDefault And $iDSNOptions <> $g__cdoDSNNever Then $objEmail.DSNOptions = $iDSNOptions $objEmail.Fields.Item("urn:schemas:mailheader:disposition-notification-to") = $s_FromAddress ;~ $objEmail.Fields.Item("urn:schemas:mailheader:return-receipt-to") = $s_FromAddress EndIf ; Update Importance and Options fields $objEmail.Fields.Update ; Sent the Message $objEmail.Send If @error Then _INetSmtpMailCom_ErrObjCleanUp() Return SetError($g__INetSmtpMailCom_ERROR_Send, Dec(_INetSmtpMailCom_ErrHexNumber()), _INetSmtpMailCom_ErrDescription()) EndIf ; CleanUp $objEmail = "" _INetSmtpMailCom_ErrObjCleanUp() EndFunc ;==>_INetSmtpMailCom ; ; Com Error Handler Func _INetSmtpMailCom_ErrObjInit($bParam = Default) Local Static $oINetSmtpMailCom_Error = Default If $bParam == 'CleanUp' And $oINetSmtpMailCom_Error <> Default Then $oINetSmtpMailCom_Error = '' Return $oINetSmtpMailCom_Error EndIf If $oINetSmtpMailCom_Error = Default Then $oINetSmtpMailCom_Error = ObjEvent("AutoIt.Error", "_INetSmtpMailCom_ErrFunc") EndIf Return $oINetSmtpMailCom_Error EndFunc ;==>_INetSmtpMailCom_ErrObjInit Func _INetSmtpMailCom_ErrObjCleanUp() _INetSmtpMailCom_ErrObjInit('CleanUp') EndFunc ;==>_INetSmtpMailCom_ErrObjCleanUp Func _INetSmtpMailCom_ErrHexNumber($vData = Default) Local Static $vReturn = 0 If $vData <> Default Then $vReturn = $vData Return $vReturn EndFunc ;==>_INetSmtpMailCom_ErrHexNumber Func _INetSmtpMailCom_ErrDescription($sData = Default) Local Static $sReturn = '' If $sData <> Default Then $sReturn = $sData Return $sReturn EndFunc ;==>_INetSmtpMailCom_ErrDescription Func _INetSmtpMailCom_ErrScriptLine($iData = Default) Local Static $iReturn = '' If $iData <> Default Then $iReturn = $iData Return $iReturn EndFunc ;==>_INetSmtpMailCom_ErrScriptLine Func _INetSmtpMailCom_ErrFunc() _INetSmtpMailCom_ErrObjInit() _INetSmtpMailCom_ErrHexNumber(Hex(_INetSmtpMailCom_ErrObjInit().number, 8)) _INetSmtpMailCom_ErrDescription(StringStripWS(_INetSmtpMailCom_ErrObjInit().description, 3)) _INetSmtpMailCom_ErrScriptLine(_INetSmtpMailCom_ErrObjInit().ScriptLine) SetError(1); something to check for when this function returns Return EndFunc ;==>_INetSmtpMailCom_ErrFunc #EndRegion UDF Functions Creating this modification, I had to:
      1. Object Error Handler used only for the duration of the function of Use,
      2. Automatic ErrorHandler CleanUp so that previous ErrorHandler took the job.
      3. Ability to get ErrorNumber and ErrorDescription ErrorScriptLine information even after the end of the function
      4. Elimination of most global variables
       
      mLipok
       
      EDIT: attached SmtpMailer_UDF.au3 file
      EDIT 2: Any comments are welcome.
      EDIT 3: Script CleanUp
      EDIT 4: Download moved to "Download Section" (previously downloaded 379 times)

       
       
    • DavidLago
      GUI Interaction (VB6)
      By DavidLago
      Hello. 
      Not sure this is the right forum. If I'm wrong, please, let me know.
      I have a task that I really don't know where to begin at. I have a legacy application built in VB6 (yeah, I know) and lately it has been reported to slow down some of the hours of the day and I'm supposed to have a end-user-experience log for this.
      I have worked with IE before, doing things like _IEFormGetCollection, then _IEFormElementGetCollection, and manipulating @extended tags, also, _IEFormElementGetObjByName, _IEFormElementSetValue and _IEFormSubmit at the end. Another example is _IEImgGetCollection, then working with the variable properties, like $xyz.src.
      What I need to do is basically the same.
      - Collecting GUIForms or elements and Setting values into forms (like _IEFormElementSetValue) 
      - Submitting the info to generate an order on another frame of the GUI, and measure the timing.
       
      What I need to know:
      What function or section to be based upon. I have searched in the help file for over a hour with no luck. I've found some stuff within _WinAPI, GDIPlus, and GUIReference, though I wasn't able to find a suitable function to work with this. I have also searched and read some topics in our forum, but most of them refers to AutoIt GUIs. If I missed something, please, educate me.
      Of course, I'll post whatever I can share about what could be helpful for other users.
    • lrstndm
      command prompt shows up at compiled code
      By lrstndm
      Hi all,
      I am working on a application with a GUI and command prompt in 1.
      Currently my code looks this simple >
      #AutoIt3Wrapper_UseUpx=y #AutoIt3Wrapper_Change2CUI=y #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 615, 437, 192, 124) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd But when I compile this and run the compiled version there is also a command prompt shown. But I don't want this.
      Besides that, I also want it to be possible when I run my script from the command prompt, the program will give feedback in the command prompt where it was started from. With the setup above. This is possible with the ConsoleWrite command. 
      Is it possible to hide the command prompt one way or another when I start the GUI? Or do I have to change my script?
      I hope someone can help me.
      Regards,
      lrstndm