Jump to content

*DONE* Fine Tune My Script, Combine into one


Recommended Posts

**PLEASE See post 6 to see the last part I need help on, thank you!**

I have a little script I'm creating to help users find some information about their computer either before they call the helpdesk or after a helpdesk tech asks them to start the script to get information

Currently I have two spererate scripts that I would like to combine into one....

The first one gives the user basic information with some clickable links... clicking the "More Info..." generates the second part of the script to give more information (duh)

The problem I have is that the user can click the "More Info" and open more than one of the same window. So to prevent this I would like for the script to change the "More Info" link to "Running" or something along that line that will inform the user that the second script is running and make it so the link cannont be click multiple times. After the second window closes, I would like for "More Info" to reappear and become clickable again

1. Combine the two scripts so only one executable is required

2. Make the clickable "MORE INFO..." change to "Running..." and not clickable while the more information script runs, then back to clickable and "More Info" when not running... (I'll use that knowledge to do the same to the "Google Search" and "Yahoo! Search"

3. If anyone can figure out how to populate the "Install Date" and "Last Boot Time" quicker, I would apperciate that too!!

Thank you in advance for all your help and I hope I explained myself good enough to get the help I'm looking for

First Code

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
    Local $msg
GUICreate ( "AISD-411: System Information", 325, 250 ); will create a dialog box that when displayed is centered
GUISetState(@SW_SHOW) ; will display an empty dialog box
GUISetFont ( 12, 400, 1, "Calibri" )

   ;~ Computer Name
   GUICtrlCreateGroup ( "", 10, 10, 305, 40)
   GUIStartGroup()
   GUICtrlCreateLabel ( "Computer Name:", 20, 25, 200, 20, $SS_LEFT)
   GUICtrlCreateLabel ( @ComputerName, 130, 25, 170, 20, $SS_RIGHT)
  
   ;~ IP Addresses
   GUICtrlCreateGroup ( "", 10, 50, 305, 60 )
   GUIStartGroup()
   GUICtrlCreateLabel ( "IP Addresses:", 20, 65, 200, 20, $SS_LEFT )
   GUICtrlCreateLabel ( @IPAddress1, 110, 65, 190, 20, $SS_RIGHT )
   GUICtrlCreateLabel ( @IPAddress2, 110, 85, 190, 20, $SS_RIGHT )
  
   ; UserName
   GUICtrlCreateGroup ( "", 10, 110, 305, 40 )
   GUIStartGroup()
   GUICtrlCreateLabel ( "User Name:", 20, 125, 125, 20, $SS_LEFT )
   GUICtrlCreateLabel ( @UserName, 100, 125, 200, 20, $SS_RIGHT )
  
   ;~ More Info Button
   GUICtrlCreateGroup ( "", 10, 150, 125, 40 )
   GUIStartGroup()
   $ClickHelp = GUICtrlCreateLabel("More Info...", 20, 165, 100, 20, $SS_LEFT )
   GUICtrlSetColor(-1, 0x0000FF)
   GUICtrlSetCursor(-1, 0 )
   GUICtrlCreateGroup ( "", 160, 150, 155, 40 )
   GUIStartGroup()
   $ClickRemote = GUICtrlCreateLabel ( "Google Search", 165, 165, 140, 20, $SS_RIGHT )
   GUICtrlSetColor(-1, 0x0000FF)
   GUICtrlSetCursor(-1, 0)
   GUICtrlCreateGroup ( "", 78, 190, 160, 40 )
   GUIStartGroup()
   $SoftCat = GUICtrlCreateLabel ( "Yahoo! Search", 80, 205, 155, 20, $SS_CENTER )
   GUICtrlSetColor(-1, 0x0000FF)
   GUICtrlSetCursor(-1,0)
   GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND")
   GUISetState(@SW_SHOW); will display an empty dialog box
   While 1
   $msg = GUIGetMsg()
   If $msg = $GUI_EVENT_CLOSE Then ExitLoop
  
   WEnd
GUIDelete()
   Func MY_WM_COMMAND($hWnd, $Msg, $wParam, $lParam)
   Local $iIDFrom = BitAND($wParam, 0xFFFF);LoWord
   Switch $iIDFrom
   Case $ClickHelp
   If ProcessExists ( "AISD-411-2.exe") Then
   $CickHelp = GUICtrlCreateLabel ( "Running...", 20, 165, 100, 20, $SS_LEFT )
   Else
   ShellExecute ( "AISD-411-2.exe" )
   EndIf
   Case $ClickRemote
   ShellExecute ( [url="http://www.google.com"]http://www.google.com[/url] )
   Case $SoftCat
   ShellExecute ( [url="http://www.yahoo.com"]http://www.yahoo.com[/url])
   EndSwitch
   EndFunc

Second Code brings up MORE INFO

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <Date.au3>
    Local $msg
GUICreate ( "AISD-411-2: System Information", 325, 325,540, 200); will create a dialog box that when displayed is centered
GUISetState(@SW_SHOW) ; will display an empty dialog box
GUISetFont ( 12, 400, 1, "Calibri" )
  
   ;~ Operating System Name
   GUICtrlCreateGroup ( "", 10, 10, 305, 40 )
   GUIStartGroup()
   GUICtrlCreateLabel ( "Operating System:", 20, 25, 125, 20, $SS_LEFT )
   $OSName = RegRead ( "HKLM\Software\Microsoft\Windows NT\CurrentVersion", "ProductName" )
   GUICtrlCreateLabel ( $OSName, 140, 25, 160, 20, $SS_RIGHT )
  
   ;~ Service Pack
   GUICtrlCreateGroup ( "", 10, 50, 305, 40 )
   GUIStartGroup()
   GUICtrlCreateLabel ( "Service Pack:", 20, 65, 125, 20, $SS_LEFT)
   GUICtrlCreateLabel ( @OSServicePack, 110, 65, 190, 20, $SS_RIGHT )
   ;~ Physical Memory
   $Memory = MemGetStats()
   $Memory = Round($Memory[1] / 1024)
   GUICtrlCreateGroup ( "", 10, 90, 305, 40 )
   GUIStartGroup()
   GUICtrlCreateLabel ( "Physical Memory:", 20, 105, 125, 20, $SS_LEFT )
   GUICtrlCreateLabel ( $Memory & " MB", 135, 105, 165, 20, $SS_RIGHT )
   ;~ Logon Server
   $LogonSrv = @LogonServer
   $LogonSrvName = StringTrimLeft ( $LogonSrv, 2 )
   GUICtrlCreateGroup ( "", 10, 130, 305, 40 )
   GUIStartGroup()
   GUICtrlCreateLabel ( "Logon Server:", 20, 145, 125, 20, $SS_LEFT )
   GUICtrlCreateLabel ( $LogonSrvName, 110, 145, 190, 20, $SS_RIGHT)
  
   ;~ IE Version
   GUICtrlCreateGroup ("", 10, 170, 306, 40 )
   GUIStartGroup()
   GUICtrlCreateLabel ( "IE Version:", 20, 185, 125, 20, $SS_LEFT )
   Local $sVersion = FileGetVersion(@ProgramFilesDir & "\Internet Explorer\iexplore.exe")
   GUICtrlCreateLabel ( $sVersion, 100, 185, 200, 20, $SS_RIGHT )
  
;~ IE Version
   GUICtrlCreateGroup ( "", 10, 210, 305, 40 )
   GUIStartGroup()
   GUICtrlCreateLabel ( "Install Date:", 20, 225, 125, 20, $SS_LEFT )
  
   ;~ System Boot Time
   Local $Bleft
   GUICtrlCreateGroup ( "", 10, 250, 306, 40 )
   GUIStartGroup()
   GUICtrlCreateLabel ( "Boot Time:", 20, 265, 125, 20, $SS_LEFT )
   RunWait( 'cmd /c systeminfo | Find "Original Install Date" >> ' & @TempDir & '\411info', "", @SW_HIDE )
   RunWait ( 'cmd /c systeminfo | Find "System Boot Time" >> ' & @TempDir & '\411info', "", @SW_HIDE )
   $411info = ( @TempDir & "\411info" )
   FileOpen ( $411info, 0 )
   $InstDate = FileReadLine ( $411info, 1 )
   $InstDateL = StringTrimLeft ( $InstDate, 25)
   $InstDateR = StringTrimRight ( $InstDateL, 13)
   $BootTime = FileReadLine ( $411info, 2 )
   $BootTimeL = StringTrimLeft ( $BootTime, 20 )
   $BootTimeR = StringTrimRight ( $BootTimeL, 0 )
   GUICtrlCreateLabel ( $InstDateR, 100, 225, 200, 20, $SS_RIGHT )
   GUICtrlCreateLabel ( $BootTimeR, 100, 265, 200, 20, $SS_RIGHT )
   FileDelete ( @TempDir & "\411info" )
  
   While 1
   $msg = GUIGetMsg()
   If $msg = $GUI_EVENT_CLOSE Then ExitLoop
  
   WEnd
GUIDelete()

post-60800-0-55290800-1339294772_thumb.j

post-60800-0-29849000-1339294859_thumb.j

Edited by Elephant007
Link to comment
Share on other sites

Here are my 0.02$

You use GUICtrlCreateGroup to put a frame around every line of data. I would drop that to enhance readability and because the group you define contains only one entry.

I would use GUICtrlCreateInput and set it to readonly for the output data (IP addresses, operating system) so the user can copy & paste the data.

I would use GUICtrlCreateButton for every function you want the user to click on ("More Info ..." etc.

As I said, just my 2 cents.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

I currently have GUICtrlCreateGroup in the script

I think it's a great idea to have inputbox as read only so they can copy and paste if ever need that is a fantastic idea!!!

So if I convert the clickable links to buttons, I can gray them out so they can't be clicked again until the program either restarts or the mor info window is closed?

I really like the readonly input box!

Thanks for your 2 cents!

Link to comment
Share on other sites

Use ControlDisable / ControlEnable to "gray out" a control.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

I was able to get these scripts combined into one and was also able to dump the %temp% file...

The only problem I has is I haven't figured out how to close the second window without closing the first.

So when the first information box runs and you click MORE INFO... the button grays (YAY!) and a new window popsup with more information. I can't get the close button to work and when you X out it, it closes the first window too

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <EditConstants.au3>
#include <Date.au3>
   Local $msg
   $MainInfoGUI = GUICreate ( "AISD-411: System Information", 325, 250 ); will create a dialog box that when displayed is centered
   GUISetState(@SW_SHOW) ; will display an empty dialog box
   GUISetFont ( 12, 400, 1, "Calibri" )
 
   ;~ Computer Name
   GUICtrlCreateGroup ( "", 10, 10, 305, 40)
   GUIStartGroup()
   GUICtrlCreateLabel ( "Computer Name:", 20, 25, 200, 20, $SS_LEFT)
   GUICtrlCreateInput( "@ComputerName", 130, 23, 170, 22, BitOr($SS_RIGHT, $ES_READONLY))
  
   ;~ IP Addresses
   GUICtrlCreateGroup ( "", 10, 50, 305, 60 )
   GUIStartGroup()
   GUICtrlCreateLabel ( "IP Addresses:", 20, 65, 200, 20, $SS_LEFT )
   GUICtrlCreateInput ( @IPAddress1, 110, 63, 190, 22, BitOr($SS_RIGHT, $ES_READONLY))
   GUICtrlCreateInput ( @IPAddress2, 110, 83, 190, 22, BitOr($SS_RIGHT, $ES_READONLY))
   
   ; UserName
   GUICtrlCreateGroup ( "", 10, 110, 305, 40 )
   GUIStartGroup()
   GUICtrlCreateLabel ( "User Name:", 20, 125, 125, 20, $SS_LEFT )
   GUICtrlCreateInput ( "@Username", 100, 125, 200, 20, BitOr($SS_RIGHT, $ES_READONLY))
  
   ;~ More Info Button
   GUICtrlCreateGroup ( "", 10, 150, 125, 40 )
   GUIStartGroup()
   $ClickMoreBT = GUICtrlCreateLabel("More Info...", 20, 165, 100, 20, $SS_CENTER )
   GUICtrlSetColor(-1, 0x0000FF)
   GUICtrlSetCursor(-1, 0 )
   GUICtrlCreateGroup ( "", 160, 150, 155, 40 )
   GUIStartGroup()
   $ClickRemote = GUICtrlCreateLabel ( "Open Support Ticket", 165, 165, 140, 20, $SS_CENTER)
   GUICtrlSetColor(-1, 0x0000FF)
   GUICtrlSetCursor(-1, 0)
   GUICtrlCreateGroup ( "", 78, 190, 160, 40 )
   GUIStartGroup()
   $SoftCat = GUICtrlCreateLabel ( "Software Catalog", 80, 205, 155, 20, $SS_CENTER )
   GUICtrlSetColor(-1, 0x0000FF)
   GUICtrlSetCursor(-1,0)
   GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND")
   GUIRegisterMsg ( "", "ClickHelp" )
   GUISetState(@SW_SHOW); will display an empty dialog box
Func MY_WM_COMMAND($hWnd, $Msg, $wParam, $lParam)
   Local $iIDFrom = BitAND($wParam, 0xFFFF);LoWord
   Switch $iIDFrom
   Case $ClickMoreBt
   ControlDisable ( "", "", $ClickMoreBT) 
   Call("MoreInfo")
   Case $ClickRemote
   ShellExecute ( "[url="https://scsmssp:444/SMPortal"]https://scsmssp:444/SMPortal[/url]" )
   Case $SoftCat
   ShellExecute ( "[url="http://sccm/CMApplicationCatalog"]http://sccm/CMApplicationCatalog[/url]")
   EndSwitch
EndFunc
Func MoreInfo()
       $MoreInfoGUI = GUICreate ( "AISD-411: System Information", 325, 350,540, 200); will create a dialog box that when displayed is centered
    GUISetState(@SW_SHOW) ; will display an empty dialog box
    GUISetFont ( 12, 400, 1, "Calibri" )
   
   $Button1 = GUICtrlCreateButton ( "Close", 120, 305 )
   
   ;~ Operating System Name
   GUICtrlCreateGroup ( "", 10, 10, 305, 40 )
   GUIStartGroup()
   GUICtrlCreateLabel ( "Operating System:", 20, 25, 125, 20, $SS_LEFT )
   $OSName = RegRead ( "HKLMSoftwareMicrosoftWindows NTCurrentVersion", "ProductName" )
   GUICtrlCreateLabel ( $OSName, 140, 25, 160, 20, $SS_RIGHT )
   
   ;~ Service Pack
   GUICtrlCreateGroup ( "", 10, 50, 305, 40 )
   GUIStartGroup()
   GUICtrlCreateLabel ( "Service Pack:", 20, 65, 125, 20, $SS_LEFT)
   GUICtrlCreateLabel ( @OSServicePack, 110, 65, 190, 20, $SS_RIGHT )
   ;~ Physical Memory
   $Memory = MemGetStats()
   $Memory = Round($Memory[1] / 1024)
   GUICtrlCreateGroup ( "", 10, 90, 305, 40 )
   GUIStartGroup()
   GUICtrlCreateLabel ( "Physical Memory:", 20, 105, 125, 20, $SS_LEFT )
   GUICtrlCreateLabel ( $Memory & " MB", 135, 105, 165, 20, $SS_RIGHT )
   ;~ Logon Server
   $LogonSrv = @LogonServer
   $LogonSrvName = StringTrimLeft ( $LogonSrv, 2 )
   GUICtrlCreateGroup ( "", 10, 130, 305, 40 )
   GUIStartGroup()
   GUICtrlCreateLabel ( "Logon Server:", 20, 145, 125, 20, $SS_LEFT )
   GUICtrlCreateLabel ( "@LogonServer", 110, 145, 190, 20, $SS_RIGHT)
   
   ;~ IE Version
   GUICtrlCreateGroup ("", 10, 170, 306, 40 )
   GUIStartGroup()
   GUICtrlCreateLabel ( "IE Version:", 20, 185, 125, 20, $SS_LEFT )
   Local $sVersion = FileGetVersion(@ProgramFilesDir & "Internet Exploreriexplore.exe")
   GUICtrlCreateLabel ( $sVersion, 100, 185, 200, 20, $SS_RIGHT )
   
    ;~ Original Install Date
   GUICtrlCreateGroup ( "", 10, 210, 305, 40 )
   GUIStartGroup()
   GUICtrlCreateLabel ( "Install Date:", 20, 225, 125, 20, $SS_LEFT )
   $readreg = RegRead("HKLMSOFTWAREMICROSOFTWINDOWS NTCURRENTVERSION", "InstallDate")
   if $readreg=0 then $readreg = RegRead("HKLM64SOFTWAREMICROSOFTWINDOWS NTCURRENTVERSION", "InstallDate")
   $sNewDate = _DateAdd( 's',$readreg, "1970/01/01 00:00:00")
   $OInstTime = StringTrimLeft ( $sNewDate, 10)
   $OInstYear = StringTrimRight ( $sNewDate, 15)
   $OInstDateL = StringTrimLeft ( $sNewDate, 8 )
   $OInstDate = StringTrimRight ( $OInstDateL, 9)
   $OInstMonthL = StringTrimLeft ( $sNewDate, 5 )
   $OInstMonth = StringTrimRight ( $OInstMonthL, 12 )
   GUICtrlCreateLabel ( $OInstMonth & "/" & $OInstDate & "/" & $OInstYear & " " & $OInstTime, 100, 225, 200, 20, $SS_RIGHT )
   ;~ Last Boot Time
   GUICtrlCreateGroup ( "", 10, 250, 305, 40 )
   GUIStartGroup()
   GUICtrlCreateLabel ( "Last Boot:", 20, 265, 125, 20, $SS_LEFT )
   $LBootTime = LastBoot()
   $LBTime = StringTrimLeft ( $LBootTime, 10)
   $LBYear = StringTrimRight ( $LBootTime, 15)
   $LBDateL = StringTrimLeft ( $LBootTime, 8 )
   $LBDate = StringTrimRight ( $LBDateL, 9)
   $LBMonthL = StringTrimLeft ( $LBootTime, 5 )
   $LBMonth = StringTrimRight ( $LBMonthL, 12 )
   GUICtrlCreateLabel ( $LBMonth & "/" & $LBDate & "/" & $LBYear & " " & $LBTime, 100, 265, 200, 20, $SS_RIGHT )
   EndFunc
  
Func LastBoot()
   $wbemFlagReturnImmediately = 0x10
   $wbemFlagForwardOnly = 0x20
   $colItems = ""
   $strComputer = "localhost"
   $objWMIService = ObjGet("winmgmts:" & $strComputer & "rootCIMV2")
   $colItems = $objWMIService.ExecQuery ("SELECT * FROM Win32_OperatingSystem", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
   If IsObj($colItems) Then
   For $objItem In $colItems
   $LastBootUp = WMIDateStringToDate($objItem.LastBootUpTime)
   Next
   EndIf
   return $LastBootUp
EndFunc
   Func WMIDateStringToDate($dtmDate)
  
   Return (StringMid($dtmDate, 1, 4) & "/" & _
   StringMid($dtmDate, 5, 2) & "/" & _
   StringMid($dtmDate, 7, 2) & _
   " " & StringMid($dtmDate, 9, 2) & ":" & StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate, 13, 2))
   EndFunc  ;==>WMIDateStringToDate
  
   While 1
      $msg1 = GUIGetMsg()
      If $msg1 = $GUI_EVENT_CLOSE Then Exit
   WEnd
Link to comment
Share on other sites

There is a very good tutorial about "Managing Multiple GUIs" on the Wiki.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Thanks Water for all your direction, this script was finally completed, I handed it over to a programmer at work and he was able to finish it off...

He said it's kind of "squirrelly" how he did it but it works! HAHA

Final code

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <EditConstants.au3>
#include <Date.au3>
   Local $msg[10]
   global $MoreInfoGUI=9999
   global $ClickMoreBT=95643
   global $resetting=False
   $MainInfoGUI = GUICreate ( "AISD-411: System Information", 325, 250, 90, 170 ); will create a dialog box that when displayed is centered
   GUISetState(@SW_SHOW) ; will display an empty dialog box
   GUISetFont ( 12, 400, 1, "Calibri" )

   ;~ Computer Name
   GUICtrlCreateGroup ( "", 10, 10, 305, 40)
   GUIStartGroup()
   GUICtrlCreateLabel ( "Computer Name:", 20, 25, 200, 20, $SS_LEFT)
   GUICtrlCreateLabel( @ComputerName, 130, 25, 170, 20, $SS_RIGHT)
  
   ;~ IP Addresses
   GUICtrlCreateGroup ( "", 10, 50, 305, 60 )
   GUIStartGroup()
   GUICtrlCreateLabel ( "IP Addresses:", 20, 65, 200, 20, $SS_LEFT )
   GUICtrlCreateLabel ( @IPAddress1, 110, 65, 190, 20, $SS_RIGHT)
   GUICtrlCreateLabel ( @IPAddress2, 110, 85, 190, 20, $SS_RIGHT)
  
   ; UserName
   GUICtrlCreateGroup ( "", 10, 110, 305, 40 )
   GUIStartGroup()
   GUICtrlCreateLabel ( "User Name:", 20, 125, 125, 20, $SS_LEFT )
   GUICtrlCreateLabel ( @Username, 100, 125, 200, 20, $SS_RIGHT)
  
   ;~ More Info Button
   GUICtrlCreateGroup ( "", 10, 150, 125, 40 )
   GUIStartGroup()
   $ClickMoreBT = GUICtrlCreateLabel("More Info...", 20, 165, 100, 20, $SS_CENTER )
   GUICtrlSetColor(-1, 0x0000FF)
   GUICtrlSetCursor(-1, 0 )
   GUICtrlCreateGroup ( "", 160, 150, 155, 40 )
   GUIStartGroup()
   $ClickRemote = GUICtrlCreateLabel ( "Open Support Ticket", 165, 165, 140, 20, $SS_CENTER)
   GUICtrlSetColor(-1, 0x0000FF)
   GUICtrlSetCursor(-1, 0)
   GUICtrlCreateGroup ( "", 78, 190, 160, 40 )
   GUIStartGroup()
   $SoftCat = GUICtrlCreateLabel ( "Software Catalog", 80, 205, 155, 20, $SS_CENTER )
   GUICtrlSetColor(-1, 0x0000FF)
   GUICtrlSetCursor(-1,0)
   GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND")
   GUISetState(@SW_SHOW); will display an empty dialog box
Func MY_WM_COMMAND($hWnd, $Msg, $wParam, $lParam)
   Local $iIDFrom = BitAND($wParam, 0xFFFF);LoWord
   Switch $iIDFrom
   Case $ClickMoreBt
   if not $resetting then
   ControlDisable ( "", "", $ClickMoreBT)
   Call("MoreInfo")
   EndIf
   Case $ClickRemote
   ShellExecute ( "[url="https://scsmssp:444/SMPortal"]https://scsmssp:444/SMPortal[/url]" )
   Case $SoftCat
   ShellExecute ( "[url="http://sccm/CMApplicationCatalog"]http://sccm/CMApplicationCatalog[/url]")
   EndSwitch
EndFunc
Func MoreInfo()
   $MoreInfoGUI = GUICreate ( "AISD-411: System Information", 325, 310,450, 170); will create a dialog box that when displayed is centered
  
   GUISetState(@SW_SHOW) ; will display an empty dialog box
   GUISetFont ( 12, 400, 1, "Calibri" )
  
   ;~ Operating System Name
   GUICtrlCreateGroup ( "", 10, 10, 305, 40 )
   GUIStartGroup()
   GUICtrlCreateLabel ( "Operating System:", 20, 25, 125, 20, $SS_LEFT )
   $OSName = RegRead ( "HKLM\Software\Microsoft\Windows NT\CurrentVersion", "ProductName" )
   GUICtrlCreateLabel ( $OSName, 140, 25, 160, 20, $SS_RIGHT )
  
   ;~ Service Pack
   GUICtrlCreateGroup ( "", 10, 50, 305, 40 )
   GUIStartGroup()
   GUICtrlCreateLabel ( "Service Pack:", 20, 65, 125, 20, $SS_LEFT)
   GUICtrlCreateLabel ( @OSServicePack, 110, 65, 190, 20, $SS_RIGHT )
  
   ;~ Physical Memory
   $Memory = MemGetStats()
   $Memory = Round($Memory[1] / 1024)
   GUICtrlCreateGroup ( "", 10, 90, 305, 40 )
   GUIStartGroup()
   GUICtrlCreateLabel ( "Physical Memory:", 20, 105, 125, 20, $SS_LEFT )
   GUICtrlCreateLabel ( $Memory & " MB", 135, 105, 165, 20, $SS_RIGHT )
   ;~ Logon Server
   $LogonSrv = @LogonServer
   $LogonSrvName = StringTrimLeft ( $LogonSrv, 2 )
   GUICtrlCreateGroup ( "", 10, 130, 305, 40 )
   GUIStartGroup()
   GUICtrlCreateLabel ( "Logon Server:", 20, 145, 125, 20, $SS_LEFT )
   GUICtrlCreateLabel ( $LogonSrvName, 110, 145, 190, 20, $SS_RIGHT)
  
   ;~ IE Version
   GUICtrlCreateGroup ("", 10, 170, 306, 40 )
   GUIStartGroup()
   GUICtrlCreateLabel ( "IE Version:", 20, 185, 125, 20, $SS_LEFT )
   Local $sVersion = FileGetVersion(@ProgramFilesDir & "\Internet Explorer\iexplore.exe")
   GUICtrlCreateLabel ( $sVersion, 100, 185, 200, 20, $SS_RIGHT )
  
   ;~ Original Install Date
   GUICtrlCreateGroup ( "", 10, 210, 305, 40 )
   GUIStartGroup()
   GUICtrlCreateLabel ( "Install Date:", 20, 225, 125, 20, $SS_LEFT )
   $readreg = RegRead("HKLM\SOFTWARE\MICROSOFT\WINDOWS NT\CURRENTVERSION\", "InstallDate")
   if $readreg=0 then $readreg = RegRead("HKLM64\SOFTWARE\MICROSOFT\WINDOWS NT\CURRENTVERSION\", "InstallDate")
   $sNewDate = _DateAdd( 's',$readreg, "1970/01/01 00:00:00")
   $OInstTime = StringTrimLeft ( $sNewDate, 10)
   $OInstYear = StringTrimRight ( $sNewDate, 15)
   $OInstDateL = StringTrimLeft ( $sNewDate, 8 )
   $OInstDate = StringTrimRight ( $OInstDateL, 9)
   $OInstMonthL = StringTrimLeft ( $sNewDate, 5 )
   $OInstMonth = StringTrimRight ( $OInstMonthL, 12 )
   GUICtrlCreateLabel ( $OInstMonth & "/" & $OInstDate & "/" & $OInstYear & " " & $OInstTime, 100, 225, 200, 20, $SS_RIGHT )
   ;~ Last Boot Time
   GUICtrlCreateGroup ( "", 10, 250, 305, 40 )
   GUIStartGroup()
   GUICtrlCreateLabel ( "Last Boot:", 20, 265, 125, 20, $SS_LEFT )
   $LBootTime = LastBoot()
   $LBTime = StringTrimLeft ( $LBootTime, 10)
   $LBYear = StringTrimRight ( $LBootTime, 15)
   $LBDateL = StringTrimLeft ( $LBootTime, 8 )
   $LBDate = StringTrimRight ( $LBDateL, 9)
   $LBMonthL = StringTrimLeft ( $LBootTime, 5 )
   $LBMonth = StringTrimRight ( $LBMonthL, 12 )
   GUICtrlCreateLabel ( $LBMonth & "/" & $LBDate & "/" & $LBYear & " " & $LBTime, 100, 265, 200, 20, $SS_RIGHT )
EndFunc
  
Func LastBoot()
   $wbemFlagReturnImmediately = 0x10
   $wbemFlagForwardOnly = 0x20
   $colItems = ""
   $strComputer = "localhost"
   $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
   $colItems = $objWMIService.ExecQuery ("SELECT * FROM Win32_OperatingSystem", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
   If IsObj($colItems) Then
   For $objItem In $colItems
   $LastBootUp = WMIDateStringToDate($objItem.LastBootUpTime)
   Next
   EndIf
   return $LastBootUp
EndFunc
Func WMIDateStringToDate($dtmDate)
  
   Return (StringMid($dtmDate, 1, 4) & "/" & _
   StringMid($dtmDate, 5, 2) & "/" & _
   StringMid($dtmDate, 7, 2) & _
   " " & StringMid($dtmDate, 9, 2) & ":" & StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate, 13, 2))
EndFunc  ;==>WMIDateStringToDate
   While 1
      $msg1 = GUIGetMsg(1)
      If $msg1[0] = $GUI_EVENT_CLOSE and $msg1[1]=$MainInfoGUI Then Exit
    
      If $msg1[0] = $GUI_EVENT_CLOSE and $msg1[1]=$MoreInfoGUI Then
      GuiDelete($MoreInfoGUI)
      $resetting=True
      ControlEnable( "", "", $ClickMoreBT)
      $resetting=False
      EndIf
   WEnd
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...