Jump to content

Getting more than one button to with within a GUI


Recommended Posts

I have a bit of an issue, I am trying to get a email or web link to working with a GUI, this is not normally an issues as in past times I would not have used a menu system generated from a text file but now I'm needing this flexibility more and more.

how can I get [Global $contact] to be active while th rest of the script is running..

how can I get hints to work, e.g. when my cursor wanders over the list items to display the hints.

The bases of the below script was done by someone else, unfortunately I have forgot who.. which is why I'm having an issue, its a really neat solution but seems to preclude allot..

#include <Misc.au3>
#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <TreeViewConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <EventLog.au3>
#include <Array.au3>

_Singleton("Automated Launcher Script")
Opt("MustDeclareVars", 1)
Opt("GUIOnEventMode", 1)
HotKeySet("^!x", "_Close");Exit on Ctrl+Alt+X

Global $ininame = "cfu.ini"

If $CmdLine[0] == 1 Then
$ininame = $CmdLine[1]
EndIf

If Not FileExists($ininame) Then
MsgBox(0x2030, "Error", "No """ & $ininame & """! Writing empty .ini file.")
_CreateINI()
Exit
EndIf

test_ini_file()

Global $slist = IniReadSectionNames($ininame)
If @error == 1 Then
MsgBox(0x2030, "Error", "Read fail for " & $ininame & "! File empty or invalid.")
Exit
EndIf

Global $guiWindow = GUICreate("Batch Software Install", 250, 340)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Close")
Global $guiButton = GUICtrlCreateButton("OK", 85, 213, 90, 30, $BS_DEFPUSHBUTTON)
GUICtrlSetOnEvent($guiButton, "_ButtonEvent")
Global $guiLabel = GUICtrlCreateLabel("Choose programs to Install:", 10, 10, 180, 15)
Global $project = GUICtrlCreateLabel("DHRH/CG/B.1", 167, 10, 180, 15)
Global $guiTree = GUICtrlCreateTreeView(10, 30, 230, 175, $TVS_CHECKBOXES)
Global $CFU_Logo = GUICtrlCreatePic("cfu_logo.bmp", 10, 250, 230, 59, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS))

Global $contact = GUICtrlCreateLabel("[email="support@computer-facilities.com"]support@computer-facilities.com[/email]", 87, 315, 180, 15), $Link

GUICtrlSetColor(-1, 0x0000FF)
GUICtrlSetCursor(-1, 2)

Global $tItem[$slist[0] + 1]
Global $hint
For $i = 2 To $slist[0]
$tItem[$i] = GUICtrlCreateTreeViewItem($slist[$i], $guiTree)
Next
GUISetState(@SW_SHOW)

Sleep(86400000)

Func _ButtonEvent()
Local $msgres = MsgBox(0x2124, "Confirm Selection", "Are you sure of your selection?", 86400, $guiWindow)
If $msgres == 6 Then
  GUISetState(@SW_HIDE)
  Local $pID, $path, $dir, $hint, $checked = False, $var, $var1
  For $i = 2 To $slist[0]
   If BitAND(GUICtrlRead($tItem[$i]), $GUI_CHECKED) Then
    $checked = True
    $path = IniRead($ininame, $slist[$i], "path", "<no path>")
    $dir = IniRead($ininame, $slist[$i], "dir", "<no path>")
    $hint = IniRead($ininame, $slist[$i], "hint", "software install")
    TrayTip("Progress", $hint, 7, 1)
    $var = @ScriptDir & "\" & $path
    $var1 = @ScriptDir & "\" & $dir
    If FileExists($var) Then
    ;MsgBox(1,"whats up","File : " & $var & @CRLF & @CRLF & "Full Path : " & $var1)
    $pID = RunWait($var, $var1)
    If @error <> 0 Then
      MsgBox(0x2030, "Error ", "Failed to run properly " & $var & "!", 86400, $guiWindow)
    EndIf
    Else
    MsgBox(0x2030, "File Not Found", "Failed to find " & $var & "!", 86400, $guiWindow)
    EndIf
    ProcessWaitClose($pID)
   EndIf
  Next
  GUISetState(@SW_SHOW)
  If $checked Then
   MsgBox(0x2000, "Process Launcher", "Process queue finished!", 86400, $guiWindow)
   _Close()
  Else
   MsgBox(0x2000, "Process Launcher", "No install process selected!", 86400, $guiWindow)
  EndIf
EndIf
EndFunc   ;==>_ButtonEvent

cfu.ini file

[Computer Facilities]
url = [url="http://www.computer-facilities.com"]www.computer-facilities.com[/url]
e-mail = [email="support@computer-facilities.com"]support@computer-facilities.com[/email]
tel = 0414-533784

[MS Office 2007]
path = Microsoft Office 2007 with Outlook Contact Manager\X16-69453.exe
dir = Microsoft Office 2007 with Outlook Contact Manager\
hint = Installing MSOffice 2007

[Outlook CBM (XP Only)]
path = Microsoft Office 2007 with Outlook Contact Manager\X13-11296.exe
dir = Microsoft Office 2007 with Outlook Contact Manager\
hint = Installing Outlook Contact Business Manager

[Norton 2010 Antivirus]
path = Norton Antivirus 2010\NIS-TW-30-17-1-0-19TBEN.exe
dir = Norton Antivirus 2010\
hint = Installing Norton 2010 Antivirus Software

[Norton Updates]
path = Norton Antivirus 2010\Updates\20100417-020-v5i32.exe
dir = Norton Antivirus 2010\Updates\
hint = Installing Norton Database Updates

[Acrobat Reader]
path = Addons and Options\AdbeRdr930_en_US.exe
dir = Addons and Options\
hint = Install Acrobat Reader 9

[HP LaserJet P2055d Printer Drivers]
path = Drivers\HP\install.exe
dir = Drivers\
hint = Installing drivers for HP LaserJet P2055d

[Java]
path = Service Packs\jre-6u20-windows-i586.exe
dir = Service Packs\
hint = Installing Java Version 6u20

[APC UPS Application and Drivers]
path = Drivers\APC\install.exe
dir = Drivers\
hint = Installing drivers for APC UPS

[.NET Framework 3.5 Setup]
path = Service Packs\dotnetfx35setup.exe
dir = Service Packs\
hint = Installing Microsoft .NET Framework 3.5 Setup

[D-Link DWL-G510 Wireless Drivers]
path = Drivers\D-Link\Setup.exe
dir = Drivers\
hint = Installing drivers D-Link DWL-G510

[HP Desktop Drivers]
path = Drivers\HP\install.exe
dir = Drivers\
hint = Installing drivers for HP Desktop

Any pointers would be really appreciated.

Edited by PeterAtkin

[topic='115020'] AD Domain Logon Script[/topic]

Link to comment
Share on other sites

  • Moderators

PeterAtkin,

Gary Frost produced an excellent UDF to get hyperlinks into GUI - you can find it here (it is also mentioned in the FAQ, by the way :) ).

To get control tooltips to work, you need to use GUICtrlSetTip after creating the control.

I hope that allows you to progress. :idea:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Thanks for the info,

looks like i will have to rewrite the function as it seems that the GUICtrlCreateTreeViewItem() just does not have this ability to show hints as far as I can tell.

[topic='115020'] AD Domain Logon Script[/topic]

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...