Jump to content

Damein

Active Members
  • Posts

    607
  • Joined

  • Last visited

1 Follower

About Damein

  • Birthday 10/03/1989

Profile Information

  • Location
    Michigan
  • WWW
    http://robertsalatka.com/
  • Interests
    Programming, Starcraft, Guitar, Final Fantasy :)

Recent Profile Visitors

612 profile views

Damein's Achievements

  1. So I have a huge text file that is admittedly laid out perfectly for this but I can't seem to think of the best way to do it. I'm trying to manage some data and want to condense it. Example data <span class='color3'>Serpent's Small Charm of Inertia</span> (83)<BR><span class='color0'>Keep in Inventory to Gain Bonus</span><BR><span class='color1'>Required Level: 40</span><BR><span class='color3'>+3% Faster Run/Walk</span><BR><span class='color3'>+13 to Mana</span> <span class='color3'>Ruby Small Charm of Dexterity</span> (85)<BR><span class='color0'>Keep in Inventory to Gain Bonus</span><BR><span class='color1'>Required Level: 32</span><BR><span class='color3'>+2 to Dexterity</span><BR><span class='color3'>Fire Resist +11%</span> <span class='color3'> Small Charm of Inertia</span> (81)<BR><span class='color0'>Keep in Inventory to Gain Bonus</span><BR><span class='color1'>Required Level: 27</span><BR><span class='color3'>+3% Faster Run/Walk</span> <span class='color3'> Small Charm of Inertia</span> (84)<BR><span class='color0'>Keep in Inventory to Gain Bonus</span><BR><span class='color1'>Required Level: 27</span><BR><span class='color3'>+3% Faster Run/Walk</span> <span class='color3'>Fine Small Charm of Sustenance</span> (77)<BR><span class='color0'>Keep in Inventory to Gain Bonus</span><BR><span class='color1'>Required Level: 21</span><BR><span class='color3'>+2 to Maximum Damage</span><BR><span class='color3'>+19 to Attack Rating</span><BR><span class='color3'>+14 to Life</span> <span class='color3'>Bronze Small Charm of Sustenance</span> (86)<BR><span class='color0'>Keep in Inventory to Gain Bonus</span><BR><span class='color1'>Required Level: 17</span><BR><span class='color3'>+7 to Attack Rating</span><BR><span class='color3'>+15 to Life</span> <span class='color3'>Shimmering Small Charm of Dexterity</span> (79)<BR><span class='color0'>Keep in Inventory to Gain Bonus</span><BR><span class='color1'>Required Level: 25</span><BR><span class='color3'>+2 to Dexterity</span><BR><span class='color3'>All Resistances +4</span> <span class='color3'>Serpent's Small Charm of Strength</span> (86)<BR><span class='color0'>Keep in Inventory to Gain Bonus</span><BR><span class='color1'>Required Level: 40</span><BR><span class='color3'>+2 to Strength</span><BR><span class='color3'>+17 to Mana</span> <span class='color3'>Steel Small Charm of Dexterity</span> (81)<BR><span class='color0'>Keep in Inventory to Gain Bonus</span><BR><span class='color1'>Required Level: 49</span><BR><span class='color3'>+33 to Attack Rating</span><BR><span class='color3'>+2 to Dexterity</span> <span class='color3'>Bronze Small Charm of Dexterity</span> (79)<BR><span class='color0'>Keep in Inventory to Gain Bonus</span><BR><span class='color1'>Required Level: 5</span><BR><span class='color3'>+4 to Attack Rating</span><BR><span class='color3'>+1 to Dexterity</span> So first goal; Read Into Array And Split Between Each Line and then further split between each needed field, which is conveniently the same line as the StringRegExp $ReadFile = FileOpenDialog("Find Mule...", "D:\Documents\d2mr-1.14d\d2bot-with-kolbot-master\d2bot-with-kolbot-master\d2bs\kolbot\mules", "Text files (*.txt)", 4) Dim $aRecords If Not _FileReadToArray($ReadFile,$aRecords) Then MsgBox(4096,"Error", " Error reading log to Array error:" & @error) Exit EndIf For $x = 1 to $aRecords[0] $ArrayData = StringRegExp($aRecords[$x],"(?i)(?s)<span class='color3'>(.*?)</span>",3) Next Now I want to do one more thing that I can't think of how to do The first instance of the RegExp gives me the Title, so I can assign that something like $Title = $ArrayData[$x][0] I then need to iterate through however many more instances there are and add them together like $Field = $Field + $ArrayData[$x][xxxx] until no more fields found This is where I am stuck
  2. So I'm gathering some data from a Wiki and everything was going well but I've hit a road block. I know how to use StringRegExp when there's only 1 variable to the string. But with multiple types I'm not sure how to work it. This is my full script atm. #include <array.au3> HotKeySet("{`}", "_Run") Global $URL, $sSource, $ItemName, $ItemStats, $ItemImg, $Lvl, $Stats, $DataField1 Global $ItemData[500], $ItemsNames[500], $ItemUrls[500], $ItemsStats[500] Global $ItemLog = @ScriptDir & "/ItemLog.txt" Func _Run() MsgBox(0, "Logging", "Starting Log") $URL = ClipGet() $sSource = BinaryToString(InetRead($URL)) $ItemData = StringRegExp($sSource,'(?i)(?s)<span style="color: #A59263; font-size: 1.4em; letter-spacing: .15em; margin: .25em; font-family: Georgia;">(.*?)</span></p></span></td></tr></table></div>',3) For $i = 0 To UBound($ItemData) - 1 $ItemName = StringSplit($ItemData[$i], '<', 0) $ItemsNames[$i] = '"name: "' & $ItemName[1] & '",' $ItemImg = StringSplit($ItemData[$i], 'https://d1u5p3l4wpay3k.cloudfront.net/diablo_gamepedia', 1) $ItemImg = StringSplit($ItemImg[2], '"', 0) $ItemUrls[$i] = '"url": "https://d1u5p3l4wpay3k.cloudfront.net/diablo_gamepedia' & $ItemImg[1] $ItemStats = StringSplit($ItemData[$i], 'style="color: #CCCCCC; font-size: .9em;">', 1) $SplitData = StringSplit($ItemStats[2], ":",1) $DataField1 = $SplitData[1] ClipPut($ItemStats[2]) MsgBOx(0, "Test", "Wait") $SplitData = StringRegExp($ItemStats[2], '(?i)(?s)<span style="(.*?)</span>', 3) For $a = 0 To UBound($SplitData) - 1 MsgBox(0, "Test", $SplitData[$a]) Next ; $ItemStats = StringRegExp($ItemData[$i], '(?i)(?s)<span style="color: #4169E1;">(.*?)</span>',3) Next EndFunc While 1 Sleep(10) WEnd So the section I am trying to pull is this; 2H Damage: <span style="color: #4169E1;">(5-6) to (39-52)</span><br />Attack Speed: <span style="color: #CCCCCC;">[10]</span><br />Minimum Strength: <span style="color: #CCCCCC;">50</span><br />Minimum Dexterity: <span style="color: #CCCCCC;">65</span><br />Level Requirement: 28<br /><br /><span style="color: #4169E1;">+70-130% Enhanced Damage (varies)</span><br /><span style="color: #4169E1;">+1 to Amazon Skill Levels</span><br /><span style="color: #4169E1;">3% Mana Stolen per Hit</span><br /><span style="color: #4169E1;">+5 to Strength</span><br /><span style="color: #4169E1;">+2 to Exploding Arrow (Amazon Only)</span><p><br /><span style="color: #4169E1;">(Only Spawns In Patch 1.09 or later) So I need it to pull all the various stats IE; 2H Damage: (5-6) to (39-52) Attack Speed: [10] Minimum Strength: 50 Ect. ect. I'm not quite sure what the best way to go about this is. I was going to use StringSplit's ect. ect. but with all the different types of stats I'm not quite sure what the best way to attack it is. Thanks!
  3. So I've got this XML file I'm writing up and I have it designed like this: ?<?xml version="1.0" encoding="iso-8859-1"?> <movies> <item id="001" name="I Know What You Did Last Summer" quality="4" genre="Horror"</item> </movies> So I want to be able to pull the ID, quality and genre of each item listed in the XML... but I can't seem to get it to work. All the examples I've looked at find the node because the item is listed like: "<id>001</id>" but nothing I found could read an XML like this, where each entry has multiple items in it... Thanks for the help if you can!
  4. Just creating a drinking counter to track how many drinks I take... and I can't get simple thing to work.. possibly because I started drinking already... lol HotKeySet("{NUMPAD1}", "_Skip") _GuiCreate() $SkipCount = 0 Global $SkipShots Func _Skip() $SkipCount += 1 GuiCtrlSetData($SkipShots, $SkipCount) EndFunc Func _GuiCreate() GuiCreate("Drink Counter", 400, 400) $OverallShots = GuiCtrlCreateInput("", 10, 10, 200, 30) GuiCtrlSetFont(-1, 14) GuiCtrlCreateLabel("Total Shots", 220, 15, 100, 50) GuiCtrlSetFont(-1, 14) GuiCtrlSetColor(-1, 0xFF0000) $SkipShots = GuiCtrlCreateInput("", 10, 60, 200, 30) GuiCtrlSetFont(-1, 14) GuiCtrlCreateLabel("Skip Shots", 220, 65, 100, 50) GuiCtrlSetFont(-1, 14) GuiCtrlSetColor(-1, 0xFF0000) $SHSShots = GuiCtrlCreateInput("", 10, 110, 200, 30) GuiCtrlSetFont(-1, 14) GuiCtrlCreateLabel("SHS Shots", 220, 115, 100, 50) GuiCtrlSetFont(-1, 14) GuiCtrlSetColor(-1, 0xFF0000) $HSShots = GuiCtrlCreateInput("", 10, 160, 200, 30) GuiCtrlSetFont(-1, 14) GuiCtrlCreateLabel("HS Shots", 220, 165, 100, 50) GuiCtrlSetFont(-1, 14) GuiCtrlSetColor(-1, 0xFF0000) $AirShots = GuiCtrlCreateInput("", 10, 210, 200, 30) GuiCtrlSetFont(-1, 14) GuiCtrlCreateLabel("Air Shots", 220, 215, 100, 50) GuiCtrlSetFont(-1, 14) GuiCtrlSetColor(-1, 0xFF0000) $FlagShots = GuiCtrlCreateInput("", 10, 260, 200, 30) GuiCtrlSetFont(-1, 14) GuiCtrlCreateLabel("Flag Shots", 220, 265, 100, 50) GuiCtrlSetFont(-1, 14) GuiCtrlSetColor(-1, 0xFF0000) GuiSetState() EndFunc While 1 Sleep(10) WEnd I can't get it to set the control to the new value. I can't get it to set it to anything. Thanks!
  5. I've made good head way but I can't seem to figure out what I am doing wrong here.I am pulling data from a webpage doing a JSON request for weather and then I am wanting to parse out each day separately so I can store it in a Class so I can then display it as needed. I've been able to pull the data and everything but I can't seem to loop through all the instances of the days. Snippet of the JSON response "epoch":"1478217600", "pretty":"7:00 PM CDT on November 03, 2016", "day":3, "month":11, "year":2016, "yday":307, "hour":19, "min":"00", "sec":0, "isdst":"1", "monthname":"November", "monthname_short":"Nov", "weekday_short":"Thu", "weekday":"Thursday", "ampm":"PM", "tz_short":"CDT", "tz_long":"America/Chicago" }, "period":2, "high": { "fahrenheit":"71", "celsius":"22" }, "low": { "fahrenheit":"49", "celsius":"9" }, "conditions":"Chance of a Thunderstorm", "icon":"chancetstorms", "icon_url":"http://icons.wxug.com/i/c/k/chancetstorms.gif", "skyicon":"", "pop":60, "qpf_allday": { "in": 0.10, "mm": 3 }, "qpf_day": { "in": 0.10, "mm": 3 }, "qpf_night": { "in": 0.00, "mm": 0 }, "snow_allday": { "in": 0.0, "cm": 0.0 }, "snow_day": { "in": 0.0, "cm": 0.0 }, "snow_night": { "in": 0.0, "cm": 0.0 }, "maxwind": { "mph": 15, "kph": 24, "dir": "NW", "degrees": 309 }, "avewind": { "mph": 11, "kph": 18, "dir": "NW", "degrees": 309 }, "avehumidity": 72, "maxhumidity": 0, "minhumidity": 0 } , {"date":{ "epoch":"1478304000", "pretty":"7:00 PM CDT on November 04, 2016", "day":4, "month":11, "year":2016, "yday":308, "hour":19, "min":"00", "sec":0, "isdst":"1", "monthname":"November", "monthname_short":"Nov", "weekday_short":"Fri", "weekday":"Friday", "ampm":"PM", "tz_short":"CDT", "tz_long":"America/Chicago" }, "period":3, "high": { "fahrenheit":"67", "celsius":"19" }, "low": { "fahrenheit":"41", "celsius":"5" }, "conditions":"Clear", "icon":"clear", "icon_url":"http://icons.wxug.com/i/c/k/clear.gif", "skyicon":"", "pop":10, "qpf_allday": { "in": 0.00, "mm": 0 }, "qpf_day": { "in": 0.00, "mm": 0 }, "qpf_night": { "in": 0.00, "mm": 0 }, "snow_allday": { "in": 0.0, "cm": 0.0 }, "snow_day": { "in": 0.0, "cm": 0.0 }, "snow_night": { "in": 0.0, "cm": 0.0 }, "maxwind": { "mph": 10, "kph": 16, "dir": "NNE", "degrees": 12 }, "avewind": { "mph": 8, "kph": 13, "dir": "NNE", "degrees": 12 }, "avehumidity": 56, "maxhumidity": 0, "minhumidity": 0 } , {"date":{ Code to grab data/parse it. Dim WUnderground As New System.Net.WebClient Dim URL As String URL = "http://api.wunderground.com/api/*****/forecast/q/47715.json" Dim result As String = WUnderground.DownloadString(URL) Dim matches As MatchCollection = Regex.Matches(result, "epoch[^>]*date") For Each match As Match In matches MessageBox.Show(match.Value) Next But the above only comes up with 1 match, not 5 as it should be. Using MessageBox.Show(matches.Count.ToString()) Also only shows a 1 so there seems to be something wrong with the RegEx I just can't place it. Thanks!
  6. This can be closed. I've solved it by a rough method and will continue to expand on it and maybe improve, but its good for now. Imports System.Data Imports System.Configuration Imports MySql.Data.MySqlClient Public Class Form1 Public customerName As String() Public customerEmail As String() Public customerPhone As String() Public formLoaded As Boolean Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load formLoaded = False Dim constr As New String _ ("Data Source=******;port=3306;Initial Catalog=WDL-Test;User Id=AdminWebLink3;password=*****") Using con As New MySqlConnection(constr) Using cmd As New MySqlCommand("SELECT customerID, Name, Email, Phone FROM Contacts") Using sda As New MySqlDataAdapter() cmd.Connection = con sda.SelectCommand = cmd Dim ds As New DataSet() sda.Fill(ds) customerDropDown.DataSource = ds.Tables(0) customerDropDown.DisplayMember = "customerID" For i As Integer = 0 To ds.Tables(0).Rows.Count - 1 customerName = (From myRow In ds.Tables(0).AsEnumerable Select myRow.Field(Of String)("Name")).ToArray customerEmail = (From myRow In ds.Tables(0).AsEnumerable Select myRow.Field(Of String)("Email")).ToArray customerPhone = (From myRow In ds.Tables(0).AsEnumerable Select myRow.Field(Of String)("Phone")).ToArray Next End Using End Using End Using formLoaded = True End Sub Private Sub customerDropDown_SelectedIndexChanged(sender As Object, e As EventArgs) Handles customerDropDown.SelectedIndexChanged If formLoaded = True Then Dim count As String = customerDropDown.SelectedIndex customerNumberBox.Text = customerPhone(count) customerEmailBox.Text = customerEmail(count) customerNameBox.Text = customerName(count) End If End Sub End Class
  7. *** EDIT *** After posting this I realized that the reason it was failing was because it was being called before the array could be populated. If I placed it inside the Button clicked function it worked just fine. So I guess my question is now, how do I keep it in the same function (When the drop down box is changed) and it still work? Thanks!
  8. Hey guys, I just started poking around in VB today so I could use it to do some SQL work. I made decent head way until I hit this block. I can grab the data from the Database and put it into a DataSet or DataTable but I want to be able to autofill some textboxes with the results as well. Imports System.Data Imports System.Configuration Imports MySql.Data.MySqlClient Public Class Form1 Public phoneNumbers Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Dim constr As New String _ ("Data Source=*****;port=3306;Initial Catalog=WDL-Test;User Id=AdminWebLink3;password=****") Using con As New MySqlConnection(constr) Using cmd As New MySqlCommand("SELECT customerID, Name, Email, Phone FROM Contacts") Using sda As New MySqlDataAdapter() cmd.Connection = con sda.SelectCommand = cmd Dim ds As New DataSet() sda.Fill(ds) customerDropDown.DataSource = ds.Tables(0) customerDropDown.DisplayMember = "customerID" For i As Integer = 0 To ds.Tables(0).Rows.Count - 1 Dim phoneNumbers As String() = (From myRow In ds.Tables(0).AsEnumerable Select myRow.Field(Of String)("Phone")).ToArray Next End Using End Using End Using End Sub Private Sub getCustomerName_Click(sender As Object, e As EventArgs) Handles getCustomerName.Click MessageBox.Show(customerDropDown.Text + " " + Convert.ToString(customerDropDown.SelectedValue)) End Sub Private Sub customerDropDown_SelectedIndexChanged(sender As Object, e As EventArgs) Handles customerDropDown.SelectedIndexChanged customerNumberBox.Text = phoneNumbers(3) End Sub End Class In the above it auto grabs the data from the table selected and populates a Drop down box with the customerID. I then am going to assign values to arrays "Name", "Email" and "Phone" that when they select an item from the drop down box it will auto fill in the appropriate text boxes. I know I don't have all of the array assignments of the customerDropDown_SelectedIndexChanged setup properly, that will be done when I find out how I can populate the textboxes with actual data. Currently it errors out with a NULL code because for some reason it doesn't find any data in the array. So I think I am just misunderstanding how to properly populate an array/make it public. Thanks for the help!
  9. Hey guys. Don't know if I'm doing this wrong but it seems I have it correct something is just amiss. I'm thinking its my lack of experience in Excel that is the problem. Trying to export a text file to Excel and everything works but the formatting is off on some data. Here are two screen shots. Before I stretch the column the Bin Number looks like this. After I stretch it it looks like this. Now its still wrong because this is the data its suppose to be inputting. Part Number|Part Description|Product Line|Bin Number|Count 1E-1041014|Label, Hazcom, Flooded, Med.|Deka|NA 1E-1041015|Label, Hazcom, Flooded, Lg.|Deka|NA 1E-1041017|Label, Hazcom, Agm/Gel, Med.|Deka|NA 1E-12214905|1/0 Thimble|NA|1E0302 1E-12214907|2/0 Thimble|NA|1E0303 1E-81214921|Cone, Single, Standard|NA|NA And this is the section of the script doing the export. Func _Export() Dim $ExportData[1][4] $ItemCount = _GUICtrlListView_GetItemCount($ListView) For $i = 0 To $ItemCount - 1 $GetPartNumberText = _GUICtrlListView_GetItemText($ListView, $i) $GetPartDescriptionText = _GUICtrlListView_GetItemText($ListView, $i, 1) $GetPartProductLineText = _GUICtrlListView_GetItemText($ListView, $i, 2) $GetPartBinNumberText = _GUICtrlListView_GetItemText($ListView, $i, 3) _ArrayInsert($ExportData, $i, $GetPartNumberText & "|" & $GetPartDescriptionText & "|" & $GetPartProductLineText & "|" & $GetPartBinNumberText) Next _ArrayDelete($ExportData, $ItemCount) SplashTextOn("Exporting...", "Exporting... please wait...", 300, 50, Default, Default, 33) Local $oExcel = _Excel_Open() If @error Then Exit MsgBox(16, "Excel UDF: _Excel_BookOpenText Example", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended) FileDelete(@TempDir & "/Temp Part Database.txt") FileDelete(@ScriptDir & "/Temp Part Database.txt") _FileWriteFromArray(@TempDir & "/Temp Part Database.txt", $ExportData) _FileWriteToLine(@TempDir & "/Temp Part Database.txt", 1, "Part Number|Part Description|Product Line|Bin Number|Count") _FileWriteFromArray(@ScriptDir & "/Temp Part Database.txt", $ExportData) _FileWriteToLine(@ScriptDir & "/Temp Part Database.txt", 1, "Part Number|Part Description|Product Line|Bin Number|Count") Local $sTextFile = @TempDir & "/Temp Part Database.txt" FileOpen(@TempDir & "/Temp Part Database.txt") $oWorkbook = _Excel_BookOpenText($oExcel, $sTextFile, Default, $xlGeneralFormat, Default, Default, "|") If @error Then MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_BookOpenText Example 1", "Error opening '" & $sTextFile & "'." & @CRLF & "@error = " & @error & ", @extended = " & @extended) Exit Else EndIf SplashOff() EndFunc ;==>_Export Any takers? Thanks!
  10. Hey, wasn't quite sure what to call it on here so we'll go with that, lol. It's pretty simple but pretty efficient IMO and is going to help me out a lot. When I finish a job I have to present all the part numbers and the serial numbers of whatever I work on. Each facility is different but I can load a database and have it all in one easy location. It started out as something I just made for myself but turned into something more professional and universal. The Listviews and INI's can be pretty much changed to whatever is needed for anything so I thought I'd share. Thanks! Images So when you click on the "Manage Database" button it requests a folder with stored Databases. If the folder contains no Parts/Equipment INI's it will automatically create them. The rest is pretty self-explanatory. Sources #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=Images\Icon.ico #AutoIt3Wrapper_Compression=0 #AutoIt3Wrapper_Res_Fileversion=1.3.0.0 #AutoIt3Wrapper_Res_LegalCopyright=R.S.S. #AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker #AutoIt3Wrapper_Add_Constants=n #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ; *** Start added by AutoIt3Wrapper *** ; *** End added by AutoIt3Wrapper *** #include <GUIConstantsEx.au3> #include <Misc.au3> #include <EditConstants.au3> #include <MsgBoxConstants.au3> #include <Excel.au3> #include <ListViewConstants.au3> #include <GuiListView.au3> #include <Array.au3> #include <WindowsConstants.au3> #include <File.au3> #include "SearchWorkOrdersModule.au3" #include "ManageDatabaseModule.au3" Local $hDLL = DllOpen("user32.dll") Opt("GUIOnEventMode", 1) Opt("WinTitleMatchMode", 3) Global $CurrentGUI, $MainGUI, $ManageGUI, $ManagePartsGUI, $ManageUnitsGUI, $DatabasePath, $WorkOrdersGUI, $ViewWorkOrdersGUI _CreateMainGUI() Func _CreateMainGUI() $CurrentGUI = "Main" $MainGUI = GUICreate("Waddell Power Database Manager", 400, 250) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") GUISetBkColor(0xFFFFFF) $ManageDatabasesButton = GUICtrlCreateButton("Manage Databases", 10, 90, 185, 60) GUICtrlSetOnEvent(-1, "_CreateManageGUI") GUICtrlSetFont(-1, 15) $SearchWorkOrdersButton = GUICtrlCreateButton("Search Work Orders", 205, 90, 185, 60) GUICtrlSetOnEvent(-1, "_CreateWorkOrdersGUI") GUICtrlSetFont(-1, 14.5) $ExitButton = GUICtrlCreateButton("Exit", 110, 170, 185, 60) GUICtrlSetOnEvent(-1, "_Exit") GUICtrlSetFont(-1, 15) GUICtrlCreateLabel("© RS Software", 335, 240, 200) GUICtrlSetFont(-1, 7) GUICtrlCreateLabel("Version 1.2", 1, 240, 200) GUICtrlSetFont(-1, 7) GUICtrlCreatePic(@ScriptDir & "\Images\Logo.bmp", 50, 5, 300, 70) GUISetState() EndFunc ;==>_CreateMainGUI Func _CloseGUI() If $CurrentGUI = "Manage" Then GUIDelete($ManageGUI) GUISetState(@SW_ENABLE, $MainGUI) Sleep(100) WinActivate($MainGUI) $CurrentGUI = "Main" EndIf If $CurrentGUI = "Parts" Then GUIDelete($ManagePartsGUI) GUISetState(@SW_ENABLE, $ManageGUI) Sleep(100) WinActivate($ManageGUI) $CurrentGUI = "Manage" EndIf If $CurrentGUI = "Units" Then GUIDelete($ManageUnitsGUI) GUISetState(@SW_ENABLE, $ManageGUI) Sleep(100) WinActivate($ManageGUI) $CurrentGUI = "Manage" EndIf If $CurrentGUI = "Work Orders" Then GUIDelete($WorkOrdersGUI) GUISetState(@SW_ENABLE, $MainGUI) Sleep(100) WinActivate($MainGUI) $CurrentGUI = "Main" EndIf If $CurrentGUI = "View Work Orders" Then GUIDelete($ViewWorkOrdersGUI) GUISetState(@SW_ENABLE, $MainGUI) Sleep(100) WinActivate($MainGUI) $CurrentGUI = "Main" EndIf EndFunc ;==>_CloseGUI Func _Exit() Exit EndFunc ;==>_Exit While 1 Sleep(10) WEnd ManageDatabaseModule Global $CurrentGUI, $ManageGUI, $ListView, $ManagePartsGUI, $ManageUnitsGUI, $DatabasePath, $SearchPartsInput, $SearchEquipmentInput, $PartList Global $g_bSortSense = True Func _CreateManageGui() $DatabasePath = FileSelectFolder("Select Folder...", @MyDocumentsDir) If $DatabasePath = "" Then MsgBox(48, "Error", "No database selected, cancelling operation!") Else GUISetState(@SW_DISABLE, $MainGui) $CurrentGUI = "Manage" $ManageGUI = GUICreate("Manage Database's", 400, 250) GUISetOnEvent($GUI_EVENT_CLOSE, "_CloseGUI") GUISetBkColor(0xFFFFFF) $ManagePartsButton = GUICtrlCreateButton("Manage Parts", 10, 90, 185, 60) GUICtrlSetOnEvent(-1, "_ManageParts") GUICtrlSetFont(-1, 15) $ManageUnitsButton = GUICtrlCreateButton("Manage Equipment", 205, 90, 185, 60) GUICtrlSetOnEvent(-1, "_ManageEquipment") GUICtrlSetFont(-1, 15) $ExitButton = GUICtrlCreateButton("Close", 100, 180, 185, 60) GUICtrlSetOnEvent(-1, "_CloseGUI") GUICtrlSetFont(-1, 15) GUICtrlCreatePic(@ScriptDir & "\Images\Logo.bmp", 50, 5, 300, 70) GUISetState() EndIf EndFunc ;==>_CreateManageGui Func _ManageParts() GUISetState(@SW_DISABLE, $ManageGUI) $CurrentGUI = "Parts" If FileExists($DatabasePath & "/Parts Database.ini") Then $ReadData = IniReadSection($DatabasePath & "/Parts Database.ini", "Parts") Else MsgBox(0, "Database Created", "No database was found, creating new database!") FileCopy(@ScriptDir & "/Data/Default Parts Database.ini", $DatabasePath & "/Parts Database.ini") FileCopy(@ScriptDir & "/Data/Default Equipment Database.ini", $DatabasePath & "/Equipment Database.ini") $ReadData = IniReadSection($DatabasePath & "/Parts Database.ini", "Parts") EndIf $ManagePartsGUI = GUICreate("Parts", 600, 660) GUISetOnEvent($GUI_EVENT_CLOSE, "_CloseGUI") GUISetBkColor(0xFFFFFF) GUICtrlCreateLabel("Search Parts", 12, 20, 130, 40) GUICtrlSetFont(-1, 16) $SearchPartsInput = GUICtrlCreateInput("", 150, 18, 250, 30) GUICtrlSetFont(-1, 16) $SearchPartsButton = GUICtrlCreateButton("Search", 450, 5, 100, 50) GUICtrlSetOnEvent(-1, "_SearchParts") GUICtrlSetFont(-1, 16) $ListView = GUICtrlCreateListView("Part Number|Description|Product Line|Bin Number", 10, 60, 580, 500, $LVS_SORTASCENDING) _GUICtrlListView_SetColumnWidth(-1, 0, 200) _GUICtrlListView_SetColumnWidth(-1, 1, 500) _GUICtrlListView_SetColumnWidth(-1, 2, 200) _GUICtrlListView_SetColumnWidth(-1, 3, 200) For $i = 1 To UBound($ReadData) - 1 GUICtrlCreateListViewItem($ReadData[$i][0] & "|" & $ReadData[$i][1], $ListView) Next $AddNewPartButton = GUICtrlCreateButton("Add", 10, 565, 220, 40) GUICtrlSetOnEvent(-1, "_AddPart") GUICtrlSetFont(-1, 16) $EditPartButton = GUICtrlCreateButton("Edit", 370, 565, 220, 40) GUICtrlSetOnEvent(-1, "_EditPart") GUICtrlSetFont(-1, 16) $RemovePartButton = GUICtrlCreateButton("Remove", 10, 615, 220, 40) GUICtrlSetOnEvent(-1, "_RemovePart") GUICtrlSetFont(-1, 16) $CloseButton = GUICtrlCreateButton("Close", 370, 615, 220, 40) GUICtrlSetOnEvent(-1, "_CloseGUI") GUICtrlSetFont(-1, 16) $ExportButton = GUICtrlCreateButton("Export", 250, 590, 100, 50) GUICtrlSetOnEvent(-1, "_Export") GUICtrlSetFont(-1, 16) GUISetState() GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY") EndFunc ;==>_ManageParts Func _Export() SplashTextOn("Exporting...", "Exporting... please wait...", 300, 50, Default, Default, 33) Local $oExcel = _Excel_Open() If @error Then Exit MsgBox(16, "Excel UDF: _Excel_BookOpenText Example", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended) ; ***************************************************************************** ; Open a text file as delimited, separator = |, pass fieldinfo and set ; DecimalSeparator and ThousandsSeparator. ; ***************************************************************************** _FileReadToArray($DatabasePath & "/Parts Database.ini", $PartList) FileDelete(@TempDir & "/Temp Part Database.txt") FileWrite(@TempDir & "/Temp Part Database.txt", "Part Number|Part Description|Product Line|Bin Number|Count" & @CRLF) For $i = 2 To UBound($PartList) - 1 If StringInStr($PartList[$i], "=") Then $PartList[$i] = StringReplace($PartList[$i], "=", "|") EndIf FileWrite(@TempDir & "/Temp Part Database.txt", $PartList[$i] & @CRLF) Next Local $sTextFile = @TempDir & "/Temp Part Database.txt" $oWorkbook = _Excel_BookOpenText($oExcel, $sTextFile, Default, $xlGeneralFormat, Default, Default, "|") If @error Then MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_BookOpenText Example 1", "Error opening '" & $sTextFile & "'." & @CRLF & "@error = " & @error & ", @extended = " & @extended) Exit Else EndIf SplashOff() EndFunc ;==>_Export Func _AddPart() GUISetState(@SW_DISABLE, $ManagePartsGUI) $Stop = 0 $NewPartNumber = InputBox("Add Part", "Please input the part number you wish to add.") If $NewPartNumber = "" Then MsgBox(48, "Error", "No part number input, cancelling addition of a new part!") $Stop = 1 EndIf If $Stop = 0 Then $NewPartDescription = InputBox("Add Part", "Please input the part description you wish to add.") If $NewPartDescription = "" Then MsgBox(48, "Error", "No part description was inputted, cancelling addition of a new part!") $Stop = 1 EndIf EndIf If $Stop = 0 Then $NewPartProductLine = InputBox("Add Part", "Please input the product line associated with this part that you wish to add.") If $NewPartProductLine = "" Then MsgBox(48, "Error", "No product line was inputted, cancelling addition of a new part!") $Stop = 1 EndIf EndIf If $Stop = 0 Then $NewPartBin = InputBox("Add Part", "Please input the part bin number you wish to add.") If $NewPartBin = "" Then MsgBox(48, "Error", "No part bin number was inputted, cancelling addition of a new part!") $Stop = 1 EndIf EndIf If $Stop = 0 Then $CheckMsgBox = MsgBox(4, "Add Part", "Are you sure you wish to add the following part?" & @CRLF & @CRLF & "Part Number: " & $NewPartNumber & @CRLF & "Part Description: " & $NewPartDescription & @CRLF & "Product Line: " & $NewPartProductLine & @CRLF & "Bin Number: " & $NewPartBin) If $CheckMsgBox = 6 Then IniWrite($DatabasePath & "/Parts Database.ini", "Parts", $NewPartNumber, $NewPartDescription & "|" & $NewPartProductLine & "|" & $NewPartBin) MsgBox(0, "Add Part", "Part number: " & $NewPartNumber & " has been added!") GUICtrlCreateListViewItem($NewPartNumber & "|" & $NewPartDescription & "|" & $NewPartProductLine & "|" & $NewPartBin, $ListView) Else MsgBox(48, "Add Part", "You have chosen to cancel the addition of a new part!") EndIf EndIf GUISetState(@SW_ENABLE, $ManagePartsGUI) Sleep(100) WinActivate($ManagePartsGUI) EndFunc ;==>_AddPart Func _EditPart() GUISetState(@SW_DISABLE, $ManagePartsGUI) $ListViewGetSelection = _GUICtrlListView_GetSelectionMark($ListView) $GetPartNumber = _GUICtrlListView_GetItem($ListView, $ListViewGetSelection, 0) $GetPartDescription = _GUICtrlListView_GetItem($ListView, $ListViewGetSelection, 1) $GetPartProductLine = _GUICtrlListView_GetItem($ListView, $ListViewGetSelection, 2) $GetPartBin = _GUICtrlListView_GetItem($ListView, $ListViewGetSelection, 3) If $GetPartNumber[3] = "" Then MsgBox(48, "Error", "No part was selected, cancelling operation!") Else $Stop = 0 $EditPartNumber = InputBox("Edit Part", "Please input a new part number or leave the part number the same.", $GetPartNumber[3]) If $EditPartNumber = "" Then MsgBox(48, "Error", "No part number input, cancelling edit of part!") $Stop = 1 EndIf If $Stop = 0 Then $EditPartDescription = InputBox("Edit Part", "Please input a new part description or leave the description the same.", $GetPartDescription[3]) If $EditPartDescription = "" Then MsgBox(48, "Error", "No part description was inputted, cancelling edit of part!") $Stop = 1 EndIf EndIf If $Stop = 0 Then $EditPartProductLine = InputBox("Edit Part", "Please input a new product line associated with this part that you wish to edit or leave it the same.", $GetPartProductLine[3]) If $EditPartProductLine = "" Then MsgBox(48, "Error", "No product line was inputted, cancelling edit of part!") $Stop = 1 EndIf EndIf If $Stop = 0 Then $EditPartBin = InputBox("Edit Part", "Please input a new part bin number or leave the number the same.", $GetPartBin[3]) If $EditPartDescription = "" Then MsgBox(48, "Error", "No part bin number was inputted, cancelling edit of part!") $Stop = 1 EndIf EndIf If $Stop = 0 Then $CheckMsgBox = MsgBox(4, "Edit Part", "Are you sure you wish to edit the following part?" & @CRLF & @CRLF & "Part Number: " & $EditPartNumber & @CRLF & "Part Description: " & $EditPartDescription & @CRLF & "Product Line: " & $EditPartProductLine & @CRLF & "Bin Number: " & $EditPartBin) If $CheckMsgBox = 6 Then IniDelete($DatabasePath & "/Parts Database.ini", "Parts", $GetPartNumber[3]) IniWrite($DatabasePath & "/Parts Database.ini", "Parts", $EditPartNumber, $EditPartDescription & "|" & $EditPartProductLine & "|" & $EditPartBin) MsgBox(0, "Edit Part", "Part number: " & $EditPartNumber & " has been changed!") _GUICtrlListView_DeleteItem($ListView, $ListViewGetSelection) GUICtrlCreateListViewItem($EditPartNumber & "|" & $EditPartDescription & "|" & $EditPartProductLine & "|" & $EditPartBin, $ListView) Else MsgBox(48, "Edit Part", "You have chosen to cancel the edit of the part!") EndIf EndIf EndIf GUISetState(@SW_ENABLE, $ManagePartsGUI) Sleep(100) WinActivate($ManagePartsGUI) EndFunc ;==>_EditPart Func _RemovePart() GUISetState(@SW_DISABLE, $ManagePartsGUI) $ListViewGetSelection = _GUICtrlListView_GetSelectionMark($ListView) $GetPartNumber = _GUICtrlListView_GetItem($ListView, $ListViewGetSelection, 0) If $GetPartNumber[3] = "" Then MsgBox(48, "Error", "No part was selected, cancelling operation!") Else $CheckMsgBox = MsgBox(4, "Remove Part", "Are you sure you wish to remove the following part?" & @CRLF & @CRLF & $GetPartNumber[3]) If $CheckMsgBox = 6 Then _GUICtrlListView_DeleteItem($ListView, $ListViewGetSelection) IniDelete($DatabasePath & "/Parts Database.ini", "Parts", $GetPartNumber[3]) MsgBox(0, "Remove Part", "The part has been removed from the database!") Else MsgBox(48, "Remove Part", "You have chosen to cancel the removal of the part!") EndIf EndIf GUISetState(@SW_ENABLE, $ManagePartsGUI) Sleep(100) WinActivate($ManagePartsGUI) EndFunc ;==>_RemovePart Func _ManageEquipment() GUISetState(@SW_DISABLE, $ManageGUI) $CurrentGUI = "Units" If FileExists($DatabasePath & "/Equipment Database.ini") Then $ReadData = IniReadSection($DatabasePath & "/Equipment Database.ini", "Equipment") Else MsgBox(0, "Database Created", "No database was found, creating new database!") FileCopy(@ScriptDir & "/Data/Default Parts Database.ini", $DatabasePath & "/Parts Database.ini") FileCopy(@ScriptDir & "/Data/Default Equipment Database.ini", $DatabasePath & "/Equipment Database.ini") $ReadData = IniReadSection($DatabasePath & "/Equipment Database.ini", "Equipment") EndIf $ManageUnitsGUI = GUICreate("Equipment", 600, 660) GUISetOnEvent($GUI_EVENT_CLOSE, "_CloseGUI") GUISetBkColor(0xFFFFFF) GUICtrlCreateLabel("Search Equipment", 12, 20, 170, 40) GUICtrlSetFont(-1, 16) $SearchEquipmentInput = GUICtrlCreateInput("", 200, 18, 250, 30) GUICtrlSetFont(-1, 16) $SearchEquipmentButton = GUICtrlCreateButton("Search", 480, 5, 100, 50) GUICtrlSetOnEvent(-1, "_SearchEquipment") GUICtrlSetFont(-1, 16) $ListView = GUICtrlCreateListView("Unit Number|Model Number|Serial Number", 10, 60, 580, 500, $LVS_SORTASCENDING) _GUICtrlListView_SetColumnWidth(-1, 0, 100) _GUICtrlListView_SetColumnWidth(-1, 1, 250) _GUICtrlListView_SetColumnWidth(-1, 2, 250) For $i = 1 To UBound($ReadData) - 1 GUICtrlCreateListViewItem($ReadData[$i][0] & "|" & $ReadData[$i][1], $ListView) Next $AddNewUnitButton = GUICtrlCreateButton("Add", 10, 565, 220, 40) GUICtrlSetOnEvent(-1, "_AddUnit") GUICtrlSetFont(-1, 16) $EditUnitButton = GUICtrlCreateButton("Edit", 370, 565, 220, 40) GUICtrlSetOnEvent(-1, "_EditUnit") GUICtrlSetFont(-1, 16) $RemoveUnitButton = GUICtrlCreateButton("Remove", 10, 615, 220, 40) GUICtrlSetOnEvent(-1, "_RemoveUnit") GUICtrlSetFont(-1, 16) $CloseButton = GUICtrlCreateButton("Close", 370, 615, 220, 40) GUICtrlSetOnEvent(-1, "_CloseGUI") GUICtrlSetFont(-1, 16) GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY") GUISetState() EndFunc ;==>_ManageEquipment Func _AddUnit() GUISetState(@SW_DISABLE, $ManageUnitsGUI) $Stop = 0 $NewUnitNumber = InputBox("Add Equipment", "Please input the unit number you wish to add.") If $NewUnitNumber = "" Then MsgBox(48, "Error", "No unit number input, cancelling addition of a new unit!") $Stop = 1 EndIf If $Stop = 0 Then $NewUnitModelNumber = InputBox("Add Equipment", "Please input the model number of this unit.") If $NewUnitModelNumber = "" Then MsgBox(48, "Error", "No model number was inputted, cancelling addition of a new unit!") $Stop = 1 EndIf EndIf If $Stop = 0 Then $NewUnitBatterySerial = InputBox("Add Unit", "Please input the serial number with this unit.") If $NewUnitBatterySerial = "" Then MsgBox(48, "Error", "No serial number was inputted, cancelling addition of a new unit!") $Stop = 1 EndIf EndIf If $Stop = 0 Then $CheckMsgBox = MsgBox(4, "Add Unit", "Are you sure you wish to add the following unit?" & @CRLF & @CRLF & "Unit Number: " & $NewUnitNumber & @CRLF & "Model Number: " & $NewUnitModelNumber & @CRLF & "Serial Number: " & $NewUnitBatterySerial) If $CheckMsgBox = 6 Then IniWrite($DatabasePath & "/Equipment Database.ini", "Equipment", $NewUnitNumber, $NewUnitModelNumber & "|" & $NewUnitBatterySerial) MsgBox(0, "Add Unit", "Unit number: " & $NewUnitNumber & " has been added!") GUICtrlCreateListViewItem($NewUnitNumber & "|" & $NewUnitModelNumber & "|" & $NewUnitBatterySerial, $ListView) Else MsgBox(48, "Add Unit", "You have chosen to cancel the addition of a new unit!") EndIf EndIf GUISetState(@SW_ENABLE, $ManageUnitsGUI) Sleep(100) WinActivate($ManageUnitsGUI) EndFunc ;==>_AddUnit Func _EditUnit() GUISetState(@SW_DISABLE, $ManageUnitsGUI) $ListViewGetSelection = _GUICtrlListView_GetSelectionMark($ListView) $GetUnitNumber = _GUICtrlListView_GetItem($ListView, $ListViewGetSelection, 0) $GetUnitModelNumber = _GUICtrlListView_GetItem($ListView, $ListViewGetSelection, 1) $GetUnitBatterySerial = _GUICtrlListView_GetItem($ListView, $ListViewGetSelection, 2) $Stop = 0 If $GetUnitNumber[3] = "" Then MsgBox(48, "Error", "No unit was selected, cancelling operation!") Else $EditUnitNumber = InputBox("Edit Unit", "Please input the unit number you wish to edit.", $GetUnitNumber[3]) If $EditUnitNumber = "" Then MsgBox(48, "Error", "No unit number input, cancelling edit of the unit!") $Stop = 1 EndIf If $Stop = 0 Then $EditUnitModelNumber = InputBox("Edit Unit", "Please input the model number with this unit.", $GetUnitModelNumber[3]) If $EditUnitModelNumber = "" Then MsgBox(48, "Error", "No model number was inputted, cancelling edit of the unit!") $Stop = 1 EndIf EndIf If $Stop = 0 Then $EditUnitBatterySerial = InputBox("Edit Unit", "Please input the serial number with this unit.", $GetUnitBatterySerial[3]) If $EditUnitBatterySerial = "" Then MsgBox(48, "Error", "No serial number was inputted, cancelling edit of the unit!") $Stop = 1 EndIf EndIf If $Stop = 0 Then $CheckMsgBox = MsgBox(4, "Edit Unit", "Are you sure you wish to edit the following Unit?" & @CRLF & @CRLF & "Unit Number: " & $EditUnitNumber & @CRLF & "Model Number: " & $EditUnitModelNumber & @CRLF & "Serial Number: " & $EditUnitBatterySerial) If $CheckMsgBox = 6 Then IniDelete($DatabasePath & "/Equipment Database.ini", "Equipment", $GetUnitNumber[3]) IniWrite($DatabasePath & "/Equipment Database.ini", "Equipment", $EditUnitNumber, $EditUnitModelNumber & "|" & $EditUnitBatterySerial) MsgBox(0, "Edit Unit", "Unit number: " & $EditUnitNumber & " has been changed!") _GUICtrlListView_DeleteItem($ListView, $ListViewGetSelection) GUICtrlCreateListViewItem($EditUnitNumber & "|" & $EditUnitModelNumber & "|" & $EditUnitBatterySerial, $ListView) Else MsgBox(48, "Edit Part", "You have chosen to cancel the edit of the unit!") EndIf EndIf EndIf GUISetState(@SW_ENABLE, $ManageUnitsGUI) Sleep(100) WinActivate($ManageUnitsGUI) EndFunc ;==>_EditUnit Func _RemoveUnit() GUISetState(@SW_DISABLE, $ManageUnitsGUI) $ListViewGetSelection = _GUICtrlListView_GetSelectionMark($ListView) $GetUnitNumber = _GUICtrlListView_GetItem($ListView, $ListViewGetSelection, 0) If $GetUnitNumber[3] = "" Then MsgBox(48, "Error", "No unit was selected, cancelling operation!") Else $CheckMsgBox = MsgBox(4, "Remove Part", "Are you sure you wish to remove the following unit?" & @CRLF & @CRLF & $GetUnitNumber[3]) If $CheckMsgBox = 6 Then _GUICtrlListView_DeleteItem($ListView, $ListViewGetSelection) IniDelete($DatabasePath & "/Equipment Database.ini", "Equipment", $GetUnitNumber[3]) MsgBox(0, "Remove Unit", "The unit has been removed from the database!") Else MsgBox(48, "Remove Unit", "You have chosen to cancel the removal of the unit!") EndIf EndIf GUISetState(@SW_ENABLE, $ManageUnitsGUI) Sleep(100) WinActivate($ManageUnitsGUI) EndFunc ;==>_RemoveUnit Func _SearchParts() Dim $FoundEntries[1] $ReadPartLookupInput = GUICtrlRead($SearchPartsInput) $Found = 0 $SearchAll = 0 $ReadPartsData = IniReadSection($DatabasePath & "/Parts Database.ini", "Parts") If $ReadPartLookupInput = "all" Then $SearchAll = 1 _GUICtrlListView_DeleteAllItems($ListView) For $i = 1 To UBound($ReadPartsData) - 1 GUICtrlCreateListViewItem($ReadPartsData[$i][0] & "|" & $ReadPartsData[$i][1], $ListView) Next Else For $i = 1 To UBound($ReadPartsData) - 1 If StringInStr($ReadPartsData[$i][0], $ReadPartLookupInput) Then $PartInfo = $ReadPartsData[$i][0] & "|" & $ReadPartsData[$i][1] _ArrayInsert($FoundEntries, 0, $PartInfo, 0) $Found = 1 EndIf Next If $Found = 0 Then MsgBox(0, "Searching...", "No parts found matching that part number, searching part descriptions!") For $i = 1 To UBound($ReadPartsData) - 1 $SplitData = StringSplit($ReadPartsData[$i][1], "|") If StringInStr($SplitData[1], $ReadPartLookupInput) Then $PartInfo = $ReadPartsData[$i][0] & "|" & $ReadPartsData[$i][1] _ArrayInsert($FoundEntries, 0, $PartInfo, 0) $Found = 1 EndIf Next EndIf If $Found = 0 Then MsgBox(0, "Searching...", "No parts found matching that part description, searching product lines!") For $i = 1 To UBound($ReadPartsData) - 1 $SplitData = StringSplit($ReadPartsData[$i][1], "|") If StringInStr($SplitData[2], $ReadPartLookupInput) Then $PartInfo = $ReadPartsData[$i][0] & "|" & $ReadPartsData[$i][1] _ArrayInsert($FoundEntries, 0, $PartInfo, 0) $Found = 1 EndIf Next EndIf If $Found = 0 Then MsgBox(0, "Searching...", "No parts found matching that product line, searching part bin numbers!") For $i = 1 To UBound($ReadPartsData) - 1 $SplitData = StringSplit($ReadPartsData[$i][1], "|") If StringInStr($SplitData[3], $ReadPartLookupInput) Then $PartInfo = $ReadPartsData[$i][0] & "|" & $ReadPartsData[$i][1] _ArrayInsert($FoundEntries, 0, $PartInfo, 0) $Found = 1 EndIf Next EndIf If $Found = 0 Then MsgBox(48, "Error", "No parts found matching your input in the database!") Else _ArrayInsert($FoundEntries, 0, "RDaughertyPlaceHolder") _GUICtrlListView_DeleteAllItems($ListView) For $i = 1 To UBound($FoundEntries) - 1 For $a = 1 To UBound($ReadPartsData) - 1 If StringInStr($FoundEntries[$i], $ReadPartsData[$a][0]) Then GUICtrlCreateListViewItem($FoundEntries[$i] & "|" & $ReadPartsData[$a][1], $ListView) EndIf Next Next EndIf EndIf GUICtrlSetData($SearchPartsInput, "") EndFunc ;==>_SearchParts Func _SearchEquipment() Dim $FoundEntries[1] $ReadUnitNumberInput = GUICtrlRead($SearchEquipmentInput) $Found = 0 $SearchAll = 0 $ReadUnitsData = IniReadSection($DatabasePath & "/Equipment Database.ini", "Equipment") If $ReadUnitNumberInput = "all" Then $SearchAll = 1 _GUICtrlListView_DeleteAllItems($ListView) For $i = 1 To UBound($ReadUnitsData) - 1 GUICtrlCreateListViewItem($ReadUnitsData[$i][0] & "|" & $ReadUnitsData[$i][1], $ListView) Next Else For $i = 1 To UBound($ReadUnitsData) - 1 If StringInStr($ReadUnitsData[$i][0], $ReadUnitNumberInput) Then $UnitsInfo = $ReadUnitsData[$i][0] & "|" & $ReadUnitsData[$i][1] _ArrayInsert($FoundEntries, 0, $UnitsInfo, 0) $Found = 1 EndIf Next If $Found = 0 Then MsgBox(0, "Searching...", "No units found matching that number, searching model numbers!") For $i = 1 To UBound($ReadUnitsData) - 1 $SplitData = StringSplit($ReadUnitsData[$i][1], "|") If StringInStr($SplitData[1], $ReadUnitNumberInput) Then $UnitsInfo = $ReadUnitsData[$i][0] & "|" & $ReadUnitsData[$i][1] _ArrayInsert($FoundEntries, 0, $UnitsInfo, 0) $Found = 1 EndIf Next EndIf If $Found = 0 Then MsgBox(0, "Searching...", "No units found matching that model number, searching serial numbers!") For $i = 1 To UBound($ReadUnitsData) - 1 $SplitData = StringSplit($ReadUnitsData[$i][1], "|") If StringInStr($SplitData[2], $ReadUnitNumberInput) Then $UnitsInfo = $ReadUnitsData[$i][0] & "|" & $ReadUnitsData[$i][1] _ArrayInsert($FoundEntries, 0, $UnitsInfo, 0) $Found = 1 EndIf Next EndIf If $Found = 0 Then MsgBox(48, "Error", "No units, model numbers or serial numbers found matching that search criteria!") Else _ArrayInsert($FoundEntries, 0, "RDaughertyPlaceHolder") _GUICtrlListView_DeleteAllItems($ListView) For $i = 1 To UBound($FoundEntries) - 1 For $a = 1 To UBound($ReadUnitsData) - 1 If StringInStr($FoundEntries[$i], $ReadUnitsData[$a][0]) Then GUICtrlCreateListViewItem($FoundEntries[$i] & "|" & $ReadUnitsData[$a][1], $ListView) EndIf Next Next EndIf EndIf GUICtrlSetData($SearchEquipmentInput, "") EndFunc ;==>_SearchEquipment Func _WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam Local $hWndListView = $ListView If Not IsHWnd($ListView) Then $hWndListView = GUICtrlGetHandle($ListView) Local $tNMHDR = DllStructCreate($tagNMLISTVIEW, $lParam) Local $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) Local $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndListView Switch $iCode Case $LVN_COLUMNCLICK ; A column was clicked _GUICtrlListView_SimpleSort($hWndListView, $g_bSortSense, DllStructGetData($tNMHDR, "SubItem")) ; Sort direction for next sort toggled by default EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>_WM_NOTIFY SearchWorkOrdersModule Global $Found, $ReadSerialNumberInput, $FoundCount = 0, $WorkOrdersGUI, $MainGUI, $DatabasePath, $SerialNumberInput, $SearchOrdersInput Global $SearchAll = 0, $ListView, $ViewWorkOrdersGUI, $MainGUI Global $g_bSortSense = True Dim $FoundEntries[1][4] Func _CreateWorkOrdersGui() Dim $FoundEntries[1] $Found = 0 $FoundCount = 0 $SearchAll = 0 $DatabasePath = FileSelectFolder("Select Folder...", @MyDocumentsDir) If $DatabasePath = "" Then MsgBox(48, "Error", "No database selected, cancelling operation!") Else GUISetState(@SW_DISABLE, $MainGUI) $CurrentGUI = "View Work Orders" $ViewWorkOrdersGUI = GUICreate("Work Orders", 600, 660) GUISetOnEvent($GUI_EVENT_CLOSE, "_CloseGUI") GUISetBkColor(0xFFFFFF) GUICtrlCreateLabel("Search Orders", 12, 20, 150, 40) GUICtrlSetFont(-1, 16) $SearchOrdersInput = GUICtrlCreateInput("", 160, 18, 250, 30) GUICtrlSetFont(-1, 16) $SearchOrdersButton = GUICtrlCreateButton("Search", 470, 5, 100, 50) GUICtrlSetOnEvent(-1, "_SearchWorkOrders") GUICtrlSetFont(-1, 16) $ListView = GUICtrlCreateListView("Work Orders", 10, 60, 580, 500, $LVS_SORTASCENDING) _GUICtrlListView_SetColumnWidth(-1, 0, 575) $ReadWorkOrders = _FileListToArray($DatabasePath, Default, 1) For $i = 1 To UBound($ReadWorkOrders) - 1 $SplitData = StringSplit($ReadWorkOrders[$i], ".") GUICtrlCreateListViewItem($SplitData[1], $ListView) Next $ViewWorkOrderButton = GUICtrlCreateButton("View", 60, 590, 220, 40) GUICtrlSetOnEvent(-1, "_ViewWorkOrder") GUICtrlSetFont(-1, 16) $CloseButton = GUICtrlCreateButton("Close", 320, 590, 220, 40) GUICtrlSetOnEvent(-1, "_CloseGUI") GUICtrlSetFont(-1, 16) GUISetState() EndIf EndFunc ;==>_CreateWorkOrdersGui Func _SearchWorkOrders() $SearchAll = 0 $Found = 0 Dim $FoundEntries[1] $ReadWorkOrderInput = GUICtrlRead($SearchOrdersInput) $ReadWorkOrders = _FileListToArray($DatabasePath, Default, 1) If $ReadWorkOrderInput = "all" Then $SearchAll = 1 _GUICtrlListView_DeleteAllItems($ListView) For $i = 1 To UBound($ReadWorkOrders) - 1 $SplitData = StringSplit($ReadWorkOrders[$i], ".") GUICtrlCreateListViewItem($SplitData[1], $ListView) Next Else For $i = 1 To UBound($ReadWorkOrders) - 1 $SplitData = StringSplit($ReadWorkOrders[$i], ".") If StringInStr($SplitData[1], $ReadWorkOrderInput) Then _ArrayInsert($FoundEntries, 0, $SplitData[1], 0) $Found = 1 $FoundCount += 1 EndIf Next If $Found = 0 Then MsgBox(48, "Error", "No work orders found with those search criterias!") Else _ArrayInsert($FoundEntries, 0, $FoundCount) _GUICtrlListView_DeleteAllItems($ListView) $ReadWorkOrders = _FileListToArray($DatabasePath, Default, 1) For $i = 1 To UBound($FoundEntries) - 1 For $a = 1 To UBound($ReadWorkOrders) - 1 $SplitData = StringSplit($ReadWorkOrders[$a], ".") If StringInStr($FoundEntries[$i], $SplitData[1]) Then GUICtrlCreateListViewItem($SplitData[1], $ListView) EndIf Next Next EndIf EndIf GUICtrlSetData($SearchOrdersInput, "") EndFunc ;==>_SearchWorkOrders Func _ViewWorkOrder() $ListViewGetSelection = _GUICtrlListView_GetSelectionMark($ListView) $GetSelectionInfo = _GUICtrlListView_GetItem($ListView, $ListViewGetSelection, 0) $ReadWorkOrders = _FileListToArray($DatabasePath & "\" & $ReadSerialNumberInput, Default, 1) For $i = 1 To UBound($ReadWorkOrders) - 1 If StringInStr($ReadWorkOrders[$i], $GetSelectionInfo[3]) Then ShellExecute($DatabasePath & "\" & $ReadSerialNumberInput & "\" & $ReadWorkOrders[$i]) EndIf Next EndFunc ;==>_ViewWorkOrder
  11. Hey, got a question for you guys. I have an array I am displaying and want to know if there is a way to auto adjust the width of the headers to the size of the header label? This is what I currently have when I display the array. But I want something more like this. Now I imagine I can't automatically adjust the size of the window but if I could adjust the size of the header's width that would be great. Any tips? Thanks!
  12. Trying to enter a line break every 60 chars to create a "centered" look on a long message in Input control. This was the only way I could find after looking around for awhile, if anyone has a better method let me know! #include <GUIConstantsEx.au3> #include <EditConstants.au3> Opt("GUIOnEventMode", 1) Global $Count = 0, $Message, $MessageDisplay Dim $Trim[4000] GUICreate("Dummy", 200, 200) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") $Message = "This is a long text that I would like to split up at 60 chars and then reinput into the Input control using a LB at 60 chars!" $Len = StringLen($Message) $Trim[$Count] = StringTrimRight($Message, $Len - 60) $Message = StringTrimLeft($Message, 60) For $i = 1 To 100 $Len = StringLen($Message) If $Len > 60 Then $Count += 1 $Trim[$Count] = StringTrimLeft($Message, 60) $Message = StringTrimLeft($Message, 60) Else $Count += 1 $Trim[$Count] = $Message ExitLoop EndIf Next For $i = 0 To $Count $MessageDisplay = $MessageDisplay & $Trim[$i] & @CRLF ; This is where I want to add in line breaks and recreate the entire message. Next $Display = GUICtrlCreateInput($MessageDisplay, 10, 10, 180, 180, BitOR($ES_CENTER, $ES_READONLY, $ES_MULTILINE)) GUISetState() Func _Exit() Exit EndFunc ;==>_Exit While 1 Sleep(10) WEnd
  13. I know I've made a few of these and there are quite a few out there already but just wanted to throw up a new one I did. Special thanks to Alexander Samuelsson AKA AdmiralAlkex for the JSON/Data Retrieve Sections as found in his version Forum Topic I wanted something that I could choose between Livestreamer or Browser when watching and also the ability to launch chat too (If I'm using Livestreamer) because I also use Hex Chat for that as well. Cleaned up the tray menus to my liking and voila. Thanks again and enjoy! GitHub YouTube Demo Source #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=Imgs\WatchIcon.ico #AutoIt3Wrapper_Compression=0 #AutoIt3Wrapper_Res_Fileversion=1.3.0.0 #AutoIt3Wrapper_Res_LegalCopyright=R.S.S. #AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker #AutoIt3Wrapper_Add_Constants=n #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ; *** Start added by AutoIt3Wrapper *** #include <StructureConstants.au3> ; *** End added by AutoIt3Wrapper *** #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.12.0 (Stable) Author: Damein / Special Thanks to Alexander Samuelsson AKA AdmiralAlkex for the JSON/Data Retrieve Sections Script Function: Stuff #ce ---------------------------------------------------------------------------- #include "Json.au3" #include <Date.au3> #include <Array.au3> #include <InetConstants.au3> #include <TrayConstants.au3> Opt("TrayMenuMode", 3) Opt("TrayOnEventMode", 1) Opt("WinTitleMatchMode", 2) $iPrintJSON = IniRead(@ScriptDir & "\Data/Settings.ini", "Section", "PrintJSON", "") ;PRINT ON JSON Global $sUsername, $LiveStreamsMenu, $FirstRun = 0, $LiveStreamData Global Enum $eTwitch Global Enum $eDisplayName, $eUrl, $ePreview, $eGame, $eCreated, $eTrayId, $eStatus, $eTime, $eOnline, $eService, $eMax Global $aStreams[0][$eMax] Dim $LiveStreams[4000][4000] $TrayOptionsMenu = TrayCreateMenu("Options") $TrayOptionsSetUsername = TrayCreateItem("Set Username...", $TrayOptionsMenu) TrayItemSetOnEvent(-1, "_SetUsername") $TrayOptionsRefresh = TrayCreateItem("Refresh...", $TrayOptionsMenu) TrayItemSetOnEvent(-1, "_Refresh") $TrayOptionsLiveStreamer = TrayCreateItem("Use Livestreamer...", $TrayOptionsMenu) TrayItemSetOnEvent(-1, "_LiveStreamer") $TrayOptionsUseBrowser = TrayCreateItem("Use Browser...", $TrayOptionsMenu) TrayItemSetOnEvent(-1, "_Browser") $TrayOptionsQuality = TrayCreateItem("Set Quality...", $TrayOptionsMenu) TrayItemSetOnEvent(-1, "_Quality") $TrayExit = TrayCreateItem("Exit...", $TrayOptionsMenu) TrayItemSetOnEvent(-1, "_Exit") TrayCreateItem("") $ChatOptionsMenu = TrayCreateMenu("Chat Options...") $TrayOptionsChat = TrayCreateItem("Load Chat...", $ChatOptionsMenu) TrayItemSetOnEvent(-1, "_LoadChat") $TrayOptionsChatBrowser = TrayCreateItem("Use Browser...", $ChatOptionsMenu) TrayItemSetOnEvent(-1, "_UseBrowser") $TrayOptionsChatHex = TrayCreateItem("Use Hex...", $ChatOptionsMenu) TrayItemSetOnEvent(-1, "_UseHex") $ReadFormat = IniRead(@ScriptDir & "/Data/Settings.ini", "Section", "Format", "NA") If $ReadFormat = "Livestreamer" Then TrayItemSetState($TrayOptionsUseBrowser, $TRAY_UNCHECKED) TrayItemSetState($TrayOptionsLiveStreamer, $TRAY_CHECKED) ElseIf $ReadFormat = "Browser" Then TrayItemSetState($TrayOptionsLiveStreamer, $TRAY_UNCHECKED) TrayItemSetState($TrayOptionsUseBrowser, $TRAY_CHECKED) EndIf $ReadChat = IniRead(@ScriptDir & "/Data/Settings.ini", "Section", "Chat", "NA") If $ReadChat = "1" Then TrayItemSetState($TrayOptionsChat, $TRAY_CHECKED) ElseIf $ReadFormat = "0" Then TrayItemSetState($TrayOptionsChat, $TRAY_UNCHECKED) EndIf $ReadChatType = IniRead(@ScriptDir & "/Data/Settings.ini", "Section", "ChatType", "NA") If $ReadChatType = "Browser" Then TrayItemSetState($TrayOptionsChatBrowser, $TRAY_CHECKED) TrayItemSetState($TrayOptionsChatHex, $TRAY_UNCHECKED) ElseIf $ReadChatType = "Hex" Then TrayItemSetState($TrayOptionsChatBrowser, $TRAY_UNCHECKED) TrayItemSetState($TrayOptionsChatHex, $TRAY_CHECKED) EndIf $sUsername = IniRead(@ScriptDir & "/Data/Settings.ini", "Section", "Username", "NA") If $sUsername = "NA" Or "" Then MsgBox(48, "Error", "Make sure to set a username from the tray menu before trying to search streams!") Else TrayTip("Updating...", "Getting live streams...", 2000) _TwitchGet($sUsername) EndIf Func _TwitchGet($sUsername) Dim $LiveStreams[4000][4000] Global $aStreams[0][$eMax] $iLimit = 100 $iOffset = 0 $sQuotedUsername = URLEncode($sUsername) $sBaseUrl = "https://api.twitch.tv/kraken/users/" & $sQuotedUsername & "/follows/channels" While True $sUrl = $sBaseUrl & OPTIONS_OFFSET_LIMIT_TWITCH($iOffset, $iLimit) $avTemp = FetchItems($sUrl, "follows") If UBound($avTemp) = 0 Then ExitLoop Local $sOptions For $iX = 0 To UBound($avTemp) - 1 $oChannel = Json_ObjGet($avTemp[$iX], "channel") $sName = Json_ObjGet($oChannel, "name") $sOptions &= $sName & ',' Next $sOptions = StringTrimRight($sOptions, 1) $sUrl = 'https://api.twitch.tv/kraken/streams?channel=' & $sOptions & '&limit=' & $iLimit $oChannel = FetchItems($sUrl, "streams") For $iX = 0 To UBound($oChannel) - 1 $oChannel2 = Json_ObjGet($oChannel[$iX], "channel") $sUrl = Json_ObjGet($oChannel2, "url") If $sUrl = "" Then $sUrl = "http://www.twitch.tv/" & Json_ObjGet($oChannel2, "name") $sDisplayName = Json_ObjGet($oChannel2, "display_name") $sStatus = Json_ObjGet($oChannel2, "status") $oPreview = Json_ObjGet($oChannel[$iX], "preview") $sMedium = Json_ObjGet($oPreview, "medium") $sGame = Json_ObjGet($oChannel[$iX], "game") $sCreated = Json_ObjGet($oChannel[$iX], "created_at") $asSplit = StringSplit($sCreated, "T") $asDate = StringSplit($asSplit[1], "-") $asTime = StringSplit(StringTrimRight($asSplit[2], 1), ":") $tSystemTime = DllStructCreate($tagSYSTEMTIME) $tSystemTime.Year = $asDate[1] $tSystemTime.Month = $asDate[2] $tSystemTime.Day = $asDate[3] $tSystemTime.Hour = $asTime[1] $tSystemTime.Minute = $asTime[2] $tSystemTime.Second = $asTime[3] $tFileTime = _Date_Time_SystemTimeToFileTime($tSystemTime) $tLocalTime = _Date_Time_FileTimeToLocalFileTime($tFileTime) $sTime = _Date_Time_FileTimeToStr($tLocalTime, 1) $iHours = _DateDiff("h", $sTime, _NowCalc()) $iMinutes = _DateDiff("n", $sTime, _NowCalc()) $iMinutes -= $iHours * 60 $sTime = StringFormat("%02i:%02i", $iHours, $iMinutes) _StreamSet($sDisplayName, $sUrl, $sMedium, $sGame, $sCreated, $sTime, $sStatus, $eTwitch) Next If UBound($oChannel) <= 100 Then ExitLoop $iOffset += $iLimit WEnd _WriteStreams() Return "Potato on a Stick" EndFunc ;==>_TwitchGet Func FetchItems($sUrl, $sKey, $sExtendedKey = Null) Local $sRetExtended $oJSON = getJson($sUrl) If IsObj($oJSON) = False Then Return "" If IsString($sExtendedKey) Then $sRetExtended = Json_ObjGet($oJSON, $sExtendedKey) EndIf $aFollows = Json_ObjGet($oJSON, $sKey) If UBound($aFollows) > 0 Then Return SetExtended($sRetExtended, $aFollows) Else Return SetExtended($sRetExtended, "") EndIf EndFunc ;==>FetchItems Func _StreamSet($sDisplayName, $sUrl, $sThumbnail, $sGame, $sCreated, $sTime, $sStatus, $iService) ConsoleWrite("Found streamer: " & $sDisplayName & @CRLF) For $iIndex = 0 To UBound($aStreams) - 1 If $aStreams[$iIndex][$eUrl] = $sUrl Then ExitLoop Next If $iIndex = UBound($aStreams) Then ReDim $aStreams[$iIndex + 1][$eMax] EndIf $aStreams[$iIndex][$eDisplayName] = $sDisplayName $aStreams[$iIndex][$eUrl] = $sUrl $aStreams[$iIndex][$ePreview] = $sThumbnail $aStreams[$iIndex][$eGame] = $sGame $aStreams[$iIndex][$eCreated] = $sCreated $aStreams[$iIndex][$eTime] = $sTime $aStreams[$iIndex][$eStatus] = $sStatus $aStreams[$iIndex][$eOnline] = True $aStreams[$iIndex][$eService] = $iService EndFunc ;==>_StreamSet Func OPTIONS_OFFSET_LIMIT_TWITCH($iOffset, $iLimit) Return '?offset=' & $iOffset & '&limit=' & $iLimit EndFunc ;==>OPTIONS_OFFSET_LIMIT_TWITCH Func getJson($sUrl) $dJsonString = InetRead($sUrl, $INET_FORCERELOAD) If $iPrintJSON Then ConsoleWrite(BinaryToString($dJsonString) & @CRLF) $oJSON = Json_Decode(BinaryToString($dJsonString)) Return $oJSON EndFunc ;==>getJson Func URLEncode($urlText) $url = "" For $i = 1 To StringLen($urlText) $acode = Asc(StringMid($urlText, $i, 1)) Select Case ($acode >= 48 And $acode <= 57) Or _ ($acode >= 65 And $acode <= 90) Or _ ($acode >= 97 And $acode <= 122) $url = $url & StringMid($urlText, $i, 1) Case $acode = 32 $url = $url & "+" Case Else $url = $url & "%" & Hex($acode, 2) EndSelect Next Return $url EndFunc ;==>URLEncode Func _WriteStreams() FileDelete(@ScriptDir & "/Data/Data.ini") FileCopy(@ScriptDir & "/Data/Default Data.ini", @ScriptDir & "/Data/Data.ini") For $i = 0 To UBound($aStreams) - 1 IniWrite(@ScriptDir & "/Data/Data.ini", "Live", $aStreams[$i][0], $aStreams[$i][1] & "|" & $aStreams[$i][3]) Next _SetTray() EndFunc ;==>_WriteStreams Func _Refresh() TrayTip("Updating...", "Getting live streams...", 2000) _TwitchGet($sUsername) EndFunc ;==>_Refresh Func _SetTray() TrayItemDelete($LiveStreamsMenu) If $FirstRun = 1 Then For $i = 1 To UBound($LiveStreamData) - 1 TrayItemDelete($LiveStreams[$i][$eTrayId]) Next EndIf $LiveStreamsMenu = TrayCreateMenu("Live Streams") $LiveStreamData = IniReadSection(@ScriptDir & "/Data/Data.ini", "Live") For $i = 1 To UBound($LiveStreamData) - 1 $SplitData = StringSplit($LiveStreamData[$i][1], "|") $LiveStreams[$i][$eTrayId] = TrayCreateItem($LiveStreamData[$i][0] & " - " & $SplitData[2], $LiveStreamsMenu) TrayItemSetOnEvent(-1, "_RunStream") Next TrayTip("Updating...", "Update complete!", 2000) $FirstRun = 1 EndFunc ;==>_SetTray Func _RunStream() $Tray = @TRAY_ID $Tray = TrayItemGetText($Tray) $Split = StringSplit($Tray, "-") $Tray = StringStripWS($Split[1], 8) $CheckVideoSource = IniRead(@ScriptDir & "/Data/Settings.ini", "Section", "Format", "NA") If $CheckVideoSource = "NA" Then MsgBox(48, "Error", "No format has been set, please do so in the options menu!") ElseIf $CheckVideoSource = "Livestreamer" Then $CheckVideoQuality = IniRead(@ScriptDir & "/Data/Settings.ini", "Section", "Quality", "NA") Run("livestreamer" & " twitch.tv/" & $Tray & " " & $CheckVideoQuality) Sleep(1000) ElseIf $CheckVideoSource = "Browser" Then ShellExecute("https://www.twitch.tv/" & $Tray) Sleep(1000) EndIf $ReadChat = IniRead(@ScriptDir & "/Data/Settings.ini", "Section", "Chat", "NA") $ReadChatType = IniRead(@ScriptDir & "/Data/Settings.ini", "Section", "ChatType", "NA") If $ReadChat = "1" Then If $ReadChatType = "Browser" Then ShellExecute("https://www.twitch.tv/" & $Tray & "/chat?popout=") ElseIf $ReadChatType = "Hex" Then WinActivate("HexChat:") Sleep(100) Send("/join {#}" & $Tray) Sleep(100) Send("{ENTER}") EndIf EndIf EndFunc ;==>_RunStream Func _SetUsername() $InputUsername = InputBox("Username...", "Please type out your username only. No Twitch.tv is needed!") If @error = 1 Then MsgBox(48, "Cancelled!", "You have cancelled this operation!") Else IniWrite(@ScriptDir & "/Data/Settings.ini", "Section", "Username", $InputUsername) $sUsername = $InputUsername MsgBox(0, "Username...", "Username: " & $InputUsername & " is set!") EndIf EndFunc ;==>_SetUsername Func _LiveStreamer() TrayItemSetState($TrayOptionsLiveStreamer, $TRAY_UNCHECKED) TrayItemSetState($TrayOptionsUseBrowser, $TRAY_UNCHECKED) TrayItemSetState($TrayOptionsLiveStreamer, $TRAY_CHECKED) MsgBox(0, "Video Source", "Now using Livestreamer by default!") IniWrite(@ScriptDir & "/Data/Settings.ini", "Section", "Format", "Livestreamer") EndFunc ;==>_LiveStreamer Func _Browser() TrayItemSetState($TrayOptionsLiveStreamer, $TRAY_UNCHECKED) TrayItemSetState($TrayOptionsUseBrowser, $TRAY_UNCHECKED) TrayItemSetState($TrayOptionsUseBrowser, $TRAY_CHECKED) MsgBox(0, "Video Source", "Now using default Browser by default!") IniWrite(@ScriptDir & "/Data/Settings.ini", "Section", "Format", "Browser") EndFunc ;==>_Browser Func _Quality() $InputQuality = InputBox("Quality Selection", "Please input a quality for Livestreamer" & @CRLF & "Mobile" & @CRLF & "Low" & @CRLF & "Medium" & @CRLF & "High" & @CRLF & "Source") If @error = 1 Then MsgBox(48, "Cancelled!", "You have cancelled this operation!") Else IniWrite(@ScriptDir & "/Data/Settings.ini", "Section", "Quality", $InputQuality) MsgBox(0, "Quality Selection", "Quality: " & $InputQuality & " has been set for Livestreamer use!") EndIf EndFunc ;==>_Quality Func _UseBrowser() TrayItemSetState($TrayOptionsChatBrowser, $TRAY_UNCHECKED) TrayItemSetState($TrayOptionsChatHex, $TRAY_UNCHECKED) TrayItemSetState($TrayOptionsChatBrowser, $TRAY_CHECKED) IniWrite(@ScriptDir & "/Data/Settings.ini", "Section", "ChatType", "Browser") EndFunc ;==>_UseBrowser Func _UseHex() TrayItemSetState($TrayOptionsChatBrowser, $TRAY_UNCHECKED) TrayItemSetState($TrayOptionsChatHex, $TRAY_UNCHECKED) TrayItemSetState($TrayOptionsChatHex, $TRAY_CHECKED) IniWrite(@ScriptDir & "/Data/Settings.ini", "Section", "ChatType", "Hex") EndFunc ;==>_UseHex Func _LoadChat() $ReadChat = IniRead(@ScriptDir & "/Data/Settings.ini", "Section", "Chat", "NA") If $ReadChat = "1" Then TrayItemSetState($TrayOptionsChat, $TRAY_UNCHECKED) IniWrite(@ScriptDir & "/Data/Settings.ini", "Section", "Chat", "0") ElseIf $ReadChat = 0 Then TrayItemSetState($TrayOptionsChat, $TRAY_CHECKED) IniWrite(@ScriptDir & "/Data/Settings.ini", "Section", "Chat", "1") EndIf EndFunc ;==>_LoadChat Func _Exit() Exit EndFunc ;==>_Exit While 1 Sleep(10) WEnd
  14. Ah, that would do it. Thanks @Danyfirex and thanks @Xandy for the attempts. As a side note, it turns out that you cannot manually run Edge by trying to run the .exe via Windows Explorer, they don't allow it. Weird. You have to create a shortcut linking to it to be able to execute it in any fashion other than the Taskbar/Start Menu. %windir%\explorer.exe shell:Appsfolder\Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge Funky!
×
×
  • Create New...