Jump to content

HTA to AutoIT


grimmlock
 Share

Recommended Posts

I just downloaded AutoIT today as a friend recommended it. I am brand new to programming so I have some help with the creation of the HTA (HTML Application). There are some minor annoyances that I am having and this app runs HTML and VB very well. However the annoyances, I hope, can be fixed and the code streamlined.

I have posted it on Mediafire. Here is the link.

http://www.mediafire.com/view/?46hc1oaftqa832a

Thanks

Phil

Thanks

Grimm

Link to comment
Share on other sites

  • Moderators

hi, Grimmlock, welcome to the forum. Can you provide some more information please? Is this a web form you're trying to provide, or just a GUI on the desktop? Also, can you show us what you have tried so far?

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Thank you. I am attaching a screenshot of what the app looks like as it is right now.This is not a "web form" per say it is more of a html based application. It is called a .hta file or HTML Application. It runs the same as a html form only it is a stand alone app with scripting (VB, Java, and HTML) all built into the back end. The goal is make this a simple desktop app that will run in the system tray of the users computer so that they can send in help desk tickets when they need to without having to open Outlook or a Browser.

As for what I have tried so far, I tried directly importing my hta file (script) directly into AutoIT and as soon as I tried to compile it, it said Error line X, no matter what I did it kept throwing errors.

Thanks for the reply

Phil

Thanks

Grimm

Link to comment
Share on other sites

  • Moderators

Hi, Grimmlock. HTAs are usually pretty easy to pull into AutoIt. If you can post your HTA code, we can assist you in porting it.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]<html>[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]<head>[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]<title>****** Helpdesk App</title>[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]<HTA:APPLICATION[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]APPLICATIONNAME="****** Helpdesk App"[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]ID="HelpandSupport"[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]VERSION="1.0"[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]BORDER="dialog"[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]INNERBORDER="no"[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]MAXIMIZEBUTTON="no"[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]MINIMIZEBUTTON="no"[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]SYSMENU="Yes"[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]Showintaskbar="no"[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]ICON="[url="http://********/testsites/TestImage/Lifesaver.ico"]http://********/testsites/TestImage/Lifesaver.ico"[/url][/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]SCROLL="no"/>[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]</head>[/size][/font][/size][/font][/color]

[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]<!--HTA Window Size-->[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]<script language="VBScript">[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]Sub Window_onload[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]Dim width,height[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]width=325[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]height=650[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]self.ResizeTo width,height[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]self.MoveTo (screen.AvailWidth-width)/2,(screen.AvailHeight-height)/2[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]  document.getElementById("user").value = strCurrentUser[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]  document.getElementById("workstation").value = strComputerName[/size][/font][/size][/font][/color]

[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]End Sub[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]Sub onclickButtonCancel()[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]window.Close[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]End Sub[/size][/font][/size][/font][/color]

[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]'Sub onclickButtonMinimize()[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]'window.Minimize[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]'End Sub[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]</script>[/size][/font][/size][/font][/color]

[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]<body bgcolor="buttonface">[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]<table border=0 width=100% height=100%>[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]<tr><td height=100% width=100% valign=top align=left>[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]<font face="Tahoma" size="2">[/size][/font][/size][/font][/color]

[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]<!--VBScript Controls-->[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]<script language="VBScript">[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]strComputer = "."[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]Set objWMIService = GetObject("winmgmts:" _[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]   & "{impersonationLevel=impersonate}!" & strComputer & "rootcimv2")[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]Set colSettings = objWMIService.ExecQuery _[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]("Select * from Win32_ComputerSystem")[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]For Each objComputer in colSettings[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]strComputerName = objComputer.Name[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]strModel = objComputer.Model[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]Next[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]Set colItems = objWMIService.ExecQuery _[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]("Select * from Win32_ComputerSystem")[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]For Each objItem in colItems[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]strCurrentUser = objItem.UserName[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]Next[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]Set colBIOS = objWMIService.ExecQuery _[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]("Select * from Win32_BIOS")[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]For each objBIOS in colBIOS[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]strSerial = ObjBIOS.SerialNumber[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]Next[/size][/font][/size][/font][/color]

[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]Set objWMIDateTime = CreateObject("wbemScripting.SwbemDateTime")[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]Set objWMI = GetObject("winmgmts:" & strComputer & "rootcimv2")[/size][/font][/size][/font][/color]

[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]Set colOS = objWMI.InstancesOf("Win32_OperatingSystem")[/size][/font][/size][/font][/color]

[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]For Each objOS in colOS[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]objWMIDateTime.Value = objOS.LastBootUpTime[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]'[/size][/font][font=arial, helvetica, sans-serif][size=2]strReboot = objWMIDateTime.GetVarDate[/size][/font][font=arial, helvetica, sans-serif][size=2]You may use this if you choose to.[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]strUpTime = TimeSpan(objWMIDateTime.GetVarDate, Now) & " (hh:mm:ss)"[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]Next[/size][/font][/size][/font][/color]

[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]'Function to display the difference between two dates in hh:mm:ss[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]Function TimeSpan(dt1, dt2)[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]If (isDate(dt1) And IsDate(dt2)) = False Then[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]TimeSpan = "00:00:00"[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]Exit Function[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]End If[/size][/font][/size][/font][/color]

[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]strSeconds = Abs(DateDiff("S", dt1, dt2))[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]strMinutes = strSeconds  60[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]strHours = strMinutes  60[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]strMinutes = strMinutes mod 60[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]strSeconds = strSeconds mod 60[/size][/font][/size][/font][/color]

[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]If len(strHours) = 1 Then strHours = "0" & strHours[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]TimeSpan = strHours & ":" & _[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]RIGHT("00" & strMinutes, 2) & ":" & _[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]RIGHT("00" & strSeconds, 2)[/size][/font][/size][/font][/color]

[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]End Function[/size][/font][/size][/font][/color]

[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]</script>[/size][/font][/size][/font][/color]

[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]<!--VBScript Output-->[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]<center><font size="4">[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]<strong>******** HelpDesk App</strong>[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]</center></font></br>[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]<strong>Username: </strong><script type="text/vbscript"> document.write strCurrentUser</script><br>[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]<strong>Computer Name: </strong><script type="text/vbscript"> document.write strComputerName</script><br>[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]<!--<strong>Email Address: </strong><script type="text/vbscript"> document.write strmail</script><br>-->[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]<!--<strong>Computer Model: </strong><script type="text/vbscript"> document.write strModel</script><br>-->[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]<!--<strong>Serial Number: </strong><script type="text/vbscript"> document.write strSerial</script><br>-->[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]<!--<strong>System Up Time: </strong><script type="text/vbscript"> document.write strUpTime</script><br>-->[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]<hr>[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]<!--Help Desk Output-->[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]*Please provide the above information when you contact the Help Desk for any hardware or software problems.[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]<strong>Help Desk #: (509) 555-5555</strong></br>[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]<strong>Help Desk Email: <a href="mailto:helpdesk@yvl.org">helpdesk@domain.com</a></strong></br>[/size][/font][/size][/font][/color]

[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]<hr>[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]<center><font size="3">[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]<strong>Request Form:</strong>[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]</center></font>[/size][/font][/size][/font][/color]

[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]<form action="[url="http://***********/sendmail_help.php"]http://***********/sendmail_help.php"[/url] method="post">[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]<!--onsubmit="this.submit(); this.reset(); return false;">-->[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]Request Types:[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]</br>[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]<select name="Request_Type">[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]<option value="Login Trouble">Login Trouble</option>[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]<option value="Monitor">Monitor</option>[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]<option value="Computer Hardware">Computer Hardware</option>[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]<option value="Employees - HR">Employees - HR</option>[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]<option value="eResources">eResources</option>[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]<option value="Internet">Internet</option>[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]<option value="Network">Network</option>[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]<option value="Permissions">Permissions</option>[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]<option value="Phones">Phones</option>[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]<option value="Polaris">Polaris</option>[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]<option value="Printers">Printers</option>[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]<option value="Self-Checks">Self-Checks</option>[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]<option value="Software">Software</option>[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]<option value="Website">Website</option>[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]</select>[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]</br>[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]</br>[/size][/font][/size][/font][/color]

[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]Subject:[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]</br><input type="text" name="Subject">[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]</br>[/size][/font][/size][/font][/color]

[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]<p>Details: <textarea name="Details" rows="10" cols="30">[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]</textarea></p>[/size][/font][/size][/font][/color]

[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]</td></tr>[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]<tr><td align=right>[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]<input type="submit" value="Send">[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]<input type="reset" value="Reset">[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]<!--<input type="button" name="Close" id="Cancel" value="Close" onclick="onclickButtonCancel">-->[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]<input type="hidden" name="user">[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]<input type="hidden" name="workstation">[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]<input type="hidden" name="email"[/size][/font][/size][/font][/color]


[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]</td></tr>[/size][/font][/size][/font][/color]

[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]</form>[/size][/font][/size][/font][/color]

[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]</table>[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]</table>[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]</body>[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]</html>[/size][/font][/size][/font][/color]
[color=#000000][font=Lucida Grande', 'Segoe UI', Arial, Helvetica, sans-serif][size=3][font=arial, helvetica, sans-serif][size=2]

Edited by grimmlock

Thanks

Grimm

Link to comment
Share on other sites

As for what I have tried so far, I tried directly importing my hta file (script) directly into AutoIT and as soon as I tried to compile it, it said Error line X, no matter what I did it kept throwing errors.

No matter what you did? Did you try throwing your computer out the window?

It doesn't make much sense, in what you say about importing the hta directly. What do you mean directly? Of course it won't work without using AI syntax.

Link to comment
Share on other sites

Thank that helped get me started. Here is what I have so far. Could someone look at it and let me know, how I can get the Gui combo, and all the GUI input fields to be sent in an email when the submit button is pressed?

The goal here is:

When the app is opened and someone fills in the all the "input fields" the submit button take all that information and sends it to an email address. I want to include the username, computer name, subject, etc.

I hope this explains it. Here is the code:

#include <GUIConstantsEx.au3>
#include <Constants.au3>
#include <GUIConstants.au3>

Dim $username = @Username ; User Name
Dim $computername = @ComputerName ; Computer Name
Dim $text1 = ""; Output text for message box.
Dim $text2 = ""; Output text for message box.
Dim $combo1 = ""; Output text for combo box.
$text1 = "Username = " & $username & @CRLF ; The & character concentrates (joins) two values together.
$text2 = "Computer Name = " & $computername & @CRLF ; The &= adds to the variable. The same as doing $var = $var & "extra stuff"

Opt("GUIOnEventMode", 1)  ; Change to OnEvent mode
$mainwindow = GUICreate("HelpDesk App", 300, 600)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
GUICtrlCreateLabel("Helpdesk App", 30, 10, 290, 40)
GUICtrlSetFont (-1, 20, 800); bold

GUICtrlCreateLabel($text1, 25, 60)
GUICtrlCreateLabel($text2, 25, 78)
;$resetbutton = GUICtrlCreateButton("Reset", 115, 565, 80) *Commented Out; Would like to learn how to create a form and clear the data
$okbutton = GUICtrlCreateButton("Send", 200, 565, 80)
GUICtrlSetOnEvent($okbutton, "OKButton")
;GUICtrlSetOnEvent($resetbutton, "RESETButton") *Commented Out: Would really like to have a button to reset all fields.
GUISetState(@SW_SHOW)

; _AddHorzSep(10, 40, 290)
_AddHorzSep(10, 105, 280)
_AddHorzSep(10, 210, 280)

Func _AddHorzSep($iX, $iY, $iW)

    GUICtrlCreateLabel("", $iX, $iY, $iW, 1)
    GUICtrlSetBkColor(-1, 0x000000)


EndFunc

GUICtrlCreateLabel("*Please provide the above information when you contact the Help Desk for any hardware or software problems.", 20, 120, 250, 50)
GUICtrlCreateLabel("Helpdesk #: (555) 555-5555", 85, 173)
GUICtrlCreateLabel("Helpdesk Email:", 70, 188)
$email = GUICtrlCreateLabel ("helpdesk@domain.com", 148,188)
GuiCtrlSetFont($email, 8.5, -1, 4) ; underlined
GuiCtrlSetColor($email,0x0000ff)
GuiCtrlSetCursor($email,0)
GUICtrlSetOnEvent(-1, "OnEmail")


GUICtrlCreateLabel("Helpdesk Request Form", 30, 220, 270, 50)
GUICtrlSetFont (-1, 15, 800); bold

GUICtrlCreateLabel("Request Type:", 25, 273, 75)
   GUICtrlCreateCombo("", 100, 270, 160) ; create first item
GUICtrlSetData(-1, "Keyboard/Mouse|Monitor|Tower", "Keyboard/Mouse") ; add other item snd set a new default

GUICtrlCreateLabel("Subject:", 25, 303, 75)
   GUICtrlCreateInput("", 100, 300, 160)

GUICtrlCreateLabel("Details:", 25, 330, 75)
   GUICtrlCreateInput("", 25, 345, 235, 200)

While 1
  Sleep(1000)  ; Idle around
WEnd

Func OKButton()
  ;Note: at this point @GUI_CTRLID would equal $okbutton,
  ;and @GUI_WINHANDLE would equal $mainwindow
  MsgBox(0, "HelpDesk App", "Your ticket has been submitted successfully")
  Exit
EndFunc

Func OnEmail()
    Run(@ComSpec & " /c " & 'start mailto:me@domain.com', "", @SW_HIDE)
EndFunc

Func CLOSEClicked()
  ;Note: at this point @GUI_CTRLID would equal $GUI_EVENT_CLOSE,
  ;and @GUI_WINHANDLE would equal $mainwindow
  Exit
EndFunc
Edited by grimmlock

Thanks

Grimm

Link to comment
Share on other sites

  • Moderators

Hi, grimmlock. First off a suggestion, when you post code please put it between autoit tags, makes it much easier to read?

As to your question about submitting via email, are you using Outlook? If so, you'll find Water's great Outlook UDFs in the Examples forum. They can get you started on sending email from a script.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Here are some suggestions

#include<guiconstants.au3>
#include<File.au3>


Global $goCommReturn[2]
Global $goCommError = ObjEvent("AutoIt.Error", "CommError")
;put main script in main for easier delmination of global declations,registers, includes etc.
;DIM is not ideal. Use global for variables meant to be used ubiquitously, local for variables in a function. Add [localglobal] const for variables that do not change
;I prefer not using oneventmode so that nonstandard global variables are not required. and I think it is easier to debug cause/effect.
; put "&" on labels and buttons before their corresponding forms to make keyboard navigation easier.

_main()
Func _Main()
while 1
_gui()
WEnd
EndFunc ;==>_Main
Func _gui()

Local $sUsername = @UserName ; User Name
Local $sComputername = @ComputerName ; Computer Name
Local $sTexts = ""; Output text for message box.
Local $sText2 = ""; Output text for message box.
Local $combo1 = ""; Output text for combo box.
Local Const $sDomain = 'Acme.com'
Local Const $sServer = "MailServerName" & '.' & $sDomain
Local Const $sSupportEmail = "support" & '@' & $sDomain
ClipPut($sServer)
$sTexts = "Username = " & $sUsername & @CRLF ; The & character concentrates (joins) two values together.
$sText2 = "Computer Name = " & $sComputername & @CRLF ; The &= adds to the variable. The same as doing $var = $var & "extra stuff"


Local $hMainwindow = GUICreate("HelpDesk App", 300, 600)

GUICtrlCreateLabel("Helpdesk App", 30, 10, 290, 40)
GUICtrlSetFont(-1, 20, 800); bold

GUICtrlCreateLabel($sTexts, 25, 60)
GUICtrlCreateLabel($sText2, 25, 78)
$hResetButton = GUICtrlCreateButton("&Reset", 115, 565, 80); *Commented Out; Would like to learn how to create a form and clear the data
Local $hOkButton = GUICtrlCreateButton("&Send", 200, 565, 80)


GUISetState(@SW_SHOW)

; _AddHorzSep(10, 40, 290)
_AddHorzSep(10, 105, 280)
_AddHorzSep(10, 210, 280)




GUICtrlCreateLabel("*Please provide the above information when you contact the Help Desk for any hardware or software problems.", 20, 120, 250, 50)
GUICtrlCreateLabel("Helpdesk #: (555) 555-5555", 85, 173)
GUICtrlCreateLabel("&Helpdesk Email:", 70, 188)
$hEmail = GUICtrlCreateLabel($sSupportEmail, 148, 188);helpdesk@domain.com"
GUICtrlSetFont($hEmail, 8.5, -1, 4) ; underlined
GUICtrlSetColor($hEmail, 0x0000ff)
GUICtrlSetCursor($hEmail, 0)



GUICtrlCreateLabel("Helpdesk Request Form", 30, 220, 270, 50)
GUICtrlSetFont(-1, 15, 800); bold

GUICtrlCreateLabel("&Request Type:", 25, 273, 75)
Local $hCombo = GUICtrlCreateCombo("", 100, 270, 160) ; create first item
GUICtrlSetData(-1, "Keyboard/Mouse|Monitor|Tower", "Keyboard/Mouse") ; add other item snd set a new default

GUICtrlCreateLabel("Su&bject:", 25, 303, 75)
Local $hInputText = GUICtrlCreateInput("", 100, 300, 160)

GUICtrlCreateLabel("&Details:", 25, 330, 75)
GUICtrlCreateInput("", 25, 345, 235, 200)

While 1
Switch GUIGetMsg()
Case $hOkButton
$msg = GUICtrlRead($hInputText) & @CRLF & "----------------" & @CRLF & $sTexts & @CRLF & $sText2 & @CRLF & _wmigetcompinfo()

OKButton($sServer, $sUsername, $sUsername & '@' & $sDomain, $sSupportEmail, "Issue:" & GUICtrlRead($hCombo), $msg)


Case $hEmail
OnEmail($sSupportEmail)
case $hResetButton
ExitLoop
Case $GUI_EVENT_CLOSE
Exit

;~ Send()
EndSwitch
WEnd
EndFunc

Func _AddHorzSep($iX, $iY, $iW)

GUICtrlCreateLabel("", $iX, $iY, $iW, 1)
GUICtrlSetBkColor(-1, 0x000000)


EndFunc ;==>_AddHorzSep

Func _wmigetcompinfo($strComputer = "localhost")
    ; Generated by AutoIt Scriptomatic November 30, 2012
    $wbemFlagReturnImmediately = 0x10
    $wbemFlagForwardOnly = 0x20
    $colItems = ""


    $sOutput = ""
    $sOutput &= "Computer: " & $strComputer & @CRLF
    $sOutput &= "==========================================" & @CRLF
    $objWMIService = ObjGet("winmgmts:" & $strComputer & "rootCIMV2")
    $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem", "WQL", _
            $wbemFlagReturnImmediately + $wbemFlagForwardOnly)


    If IsObj($colItems) Then
        For $objItem In $colItems
;~     $sOutput &= "AdminPasswordStatus: " & $objItem.AdminPasswordStatus & @CRLF
;~     $sOutput &= "AutomaticResetBootOption: " & $objItem.AutomaticResetBootOption & @CRLF
;~     $sOutput &= "AutomaticResetCapability: " & $objItem.AutomaticResetCapability & @CRLF
;~     $sOutput &= "BootOptionOnLimit: " & $objItem.BootOptionOnLimit & @CRLF
;~     $sOutput &= "BootOptionOnWatchDog: " & $objItem.BootOptionOnWatchDog & @CRLF
;~     $sOutput &= "BootROMSupported: " & $objItem.BootROMSupported & @CRLF
;~     $sOutput &= "BootupState: " & $objItem.BootupState & @CRLF
            $sOutput &= "Caption: " & $objItem.Caption & @CRLF
;~     $sOutput &= "ChassisBootupState: " & $objItem.ChassisBootupState & @CRLF
;~     $sOutput &= "CreationClassName: " & $objItem.CreationClassName & @CRLF
            $sOutput &= "CurrentTimeZone: " & $objItem.CurrentTimeZone & @CRLF
            $sOutput &= "DaylightInEffect: " & $objItem.DaylightInEffect & @CRLF
            $sOutput &= "Description: " & $objItem.Description & @CRLF
            $sOutput &= "Domain: " & $objItem.Domain & @CRLF
            $sOutput &= "DomainRole: " & $objItem.DomainRole & @CRLF
            $sOutput &= "EnableDaylightSavingsTime: " & $objItem.EnableDaylightSavingsTime & @CRLF
;~             $sOutput &= "FrontPanelResetStatus: " & $objItem.FrontPanelResetStatus & @CRLF
;~     $sOutput &= "InfraredSupported: " & $objItem.InfraredSupported & @CRLF
;~     $strInitialLoadInfo = $objItem.InitialLoadInfo(0)
;~             $sOutput &= "InitialLoadInfo: " & $strInitialLoadInfo & @CRLF
            $sOutput &= "InstallDate: " & WMIDateStringToDate($objItem.InstallDate) & @CRLF
;~     $sOutput &= "KeyboardPasswordStatus: " & $objItem.KeyboardPasswordStatus & @CRLF
            $sOutput &= "LastLoadInfo: " & $objItem.LastLoadInfo & @CRLF
            $sOutput &= "Manufacturer: " & $objItem.Manufacturer & @CRLF
            $sOutput &= "Model: " & $objItem.Model & @CRLF
            $sOutput &= "Name: " & $objItem.Name & @CRLF
            $sOutput &= "NameFormat: " & $objItem.NameFormat & @CRLF
            $sOutput &= "NetworkServerModeEnabled: " & $objItem.NetworkServerModeEnabled & @CRLF
;~             $sOutput &= "NumberOfLogicalProcessors: " & $objItem.NumberOfLogicalProcessors & @CRLF
;~             $sOutput &= "NumberOfProcessors: " & $objItem.NumberOfProcessors & @CRLF
;~     $strOEMLogoBitmap = $objItem.OEMLogoBitmap(0)
;~     $sOutput &= "OEMLogoBitmap: " & $strOEMLogoBitmap & @CRLF
            $strOEMStringArray = $objItem.OEMStringArray(0)
            $sOutput &= "OEMStringArray: " & $strOEMStringArray & @CRLF
            $sOutput &= "PartOfDomain: " & $objItem.PartOfDomain & @CRLF
;~     $sOutput &= "PauseAfterReset: " & $objItem.PauseAfterReset & @CRLF
;~     $strPowerManagementCapabilities = $objItem.PowerManagementCapabilities(0)
;~     $sOutput &= "PowerManagementCapabilities: " & $strPowerManagementCapabilities & @CRLF
;~     $sOutput &= "PowerManagementSupported: " & $objItem.PowerManagementSupported & @CRLF
;~     $sOutput &= "PowerOnPasswordStatus: " & $objItem.PowerOnPasswordStatus & @CRLF
;~     $sOutput &= "PowerState: " & $objItem.PowerState & @CRLF
;~     $sOutput &= "PowerSupplyState: " & $objItem.PowerSupplyState & @CRLF
;~     $sOutput &= "PrimaryOwnerContact: " & $objItem.PrimaryOwnerContact & @CRLF
;~     $sOutput &= "PrimaryOwnerName: " & $objItem.PrimaryOwnerName & @CRLF
;~     $sOutput &= "ResetCapability: " & $objItem.ResetCapability & @CRLF
;~     $sOutput &= "ResetCount: " & $objItem.ResetCount & @CRLF
;~     $sOutput &= "ResetLimit: " & $objItem.ResetLimit & @CRLF
;~     $strRoles = $objItem.Roles(0)
;~     $sOutput &= "Roles: " & $strRoles & @CRLF
;~     $sOutput &= "Status: " & $objItem.Status & @CRLF
;~     $strSupportContactDescription = $objItem.SupportContactDescription(0)
;~     $sOutput &= "SupportContactDescription: " & $strSupportContactDescription & @CRLF
;~     $sOutput &= "SystemStartupDelay: " & $objItem.SystemStartupDelay & @CRLF
;~     $strSystemStartupOptions = $objItem.SystemStartupOptions(0)
;~     $sOutput &= "SystemStartupOptions: " & $strSystemStartupOptions & @CRLF
;~     $sOutput &= "SystemStartupSetting: " & $objItem.SystemStartupSetting & @CRLF
            $sOutput &= "SystemType: " & $objItem.SystemType & @CRLF
            $sOutput &= "ThermalState: " & $objItem.ThermalState & @CRLF
            $sOutput &= "TotalPhysicalMemory: " & $objItem.TotalPhysicalMemory & @CRLF
;~     $sOutput &= "UserName: " & $objItem.UserName & @CRLF
;~     $sOutput &= "WakeUpType: " & $objItem.WakeUpType & @CRLF
;~     $sOutput &= "Workgroup: " & $objItem.Workgroup & @CRLF


        Next
    Else
        Return ("WMI not functional")
    EndIf

    $colItems = $objWMIService.ExecQuery("SELECT *  FROM Win32_ComputerSystemProduct", "WQL", _
            $wbemFlagReturnImmediately + $wbemFlagForwardOnly)


    If IsObj($colItems) Then
        For $objItem In $colItems
             MsgBox(0,"","SerialNumber" & $objItem.IdentifyingNumber)
            $sOutput &= "SerialNumber: " & $objItem.IdentifyingNumber & @CRLF
        Next

        Return ($sOutput)

EndIf



EndFunc ;==>_wmigetcompinfo

Func WMIDateStringToDate($dtmDate)

Return (StringMid($dtmDate, 5, 2) & "/" & _
StringMid($dtmDate, 7, 2) & "/" & StringLeft($dtmDate, 4) _
& " " & StringMid($dtmDate, 9, 2) & ":" & StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate, 13, 2))
EndFunc ;==>WMIDateStringToDate

Func OKButton($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $s_Body)


$rc = _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $s_Body)
If @error Then
MsgBox(0, "Error sending message", "Error code:" & @error & " Description:" & $rc)
Else
MsgBox(0, "HelpDesk App", "Your ticket has been submitted successfully")
;~ else
EndIf

EndFunc ;==>OKButton

Func OnEmail($sSupportEmail)
Run(@ComSpec & " /c " & 'start mailto:' & $sSupportEmail, "", @SW_HIDE)
EndFunc ;==>OnEmail

Func CLOSEClicked()
;Note: at this point @GUI_CTRLID would equal $GUI_EVENT_CLOSE,
;and @GUI_WINHANDLE would equal $hMainwindow
Exit
EndFunc ;==>CLOSEClicked







;
; The UDF
Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $sBody = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Importance = "Normal", $s_Username = "", $s_Password = "", $IPPort = 25, $ssl = 0)


Local $objEmail = ObjCreate("CDO.Message")
$objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>'
$objEmail.To = $s_ToAddress
Local $i_Error = 0
Local $i_Error_desciption = ""
If $s_CcAddress <> "" Then $objEmail.Cc = $s_CcAddress
If $s_BccAddress <> "" Then $objEmail.Bcc = $s_BccAddress
$objEmail.Subject = $s_Subject
If StringInStr($sBody, "<") And StringInStr($sBody, ">") Then
$objEmail.HTMLBody = $sBody
Else
$objEmail.Textbody = $sBody & @CRLF
EndIf
If $s_AttachFiles <> "" Then
Local $S_Files2Attach = StringSplit($s_AttachFiles, ";")
For $x = 1 To $S_Files2Attach[0]
$S_Files2Attach[$x] = _PathFull($S_Files2Attach[$x])
;~ ConsoleWrite('@@ Debug : $S_Files2Attach[$x] = ' & $S_Files2Attach[$x] & @LF & '>Error code: ' & @error & @LF) ;### Debug Console
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)
SetError(1)
Return 0
EndIf
Next
EndIf
$objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
$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") = 1
$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
If $ssl Then
$objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
EndIf
;Update 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
$objEmail.Fields.Update
; Sent the Message
$objEmail.Send
If @error Then
SetError(2)
Return $goCommReturn[1]
EndIf
$objEmail = ""
EndFunc ;==>_INetSmtpMailCom
;
;
; Com Error Handler
Func CommError()
$HexNumber = Hex($goCommError.number, 8)
$goCommReturn[0] = $HexNumber
$goCommReturn[1] = StringStripWS($goCommError.description, 3)
ConsoleWrite("### COM Error ! Number: " & $HexNumber & " ScriptLine: " & $goCommError.scriptline & " Description:" & $goCommReturn[1] & @LF)
SetError(1); something to check for when this function returns
Return
EndFunc ;==>CommError

I would also suggest looking into a system to create serialized ticket #.

Ideally ticket systems would be tied into a database, so that backreferencing is easy and liability/ownership is easy to prove.

Edited by DicatoroftheUSA
Link to comment
Share on other sites

Your welcome. I messed up on the serial part of WMI. The power and pitfalls of copy/past :/

It should have looked like this instead.

$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystemProduct", "WQL", _
$wbemFlagReturnImmediately + $wbemFlagForwardOnly)


If IsObj($colItems) Then
For $objItem In $colItems
MsgBox(0,"","SerialNumber" & $objItem.IdentifyingNumber)
$sOutput &= "SerialNumber: " & $objItem.IdentifyingNumber & @CRLF
Next
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...