Sign in to follow this  
Followers 0
Klexen

Pull back from file written to, into same boxes inputed to.

5 posts in this topic

This is what I got so far. It saves to a file, but I can't get it to view the file in a table.

What I want is what Valuater did with the "View All Customers" button.

http://www.autoitscript.com/forum/index.ph...c=37966&hl=

I want to be able to select the inputed customers from a list and view them in the same fields they were entered into.

If someone could please help me with that, I would greatly appreciate it.

Thanks in advance!

CODE
#include <GuiConstants.au3>

#include <IE.au3>

#Include <File.au3>

#Include <GuiListView.au3>

Dim $data_Location = @ScriptDir & "\Data\"

Dim $File_Location = @ScriptDir & "\Data\Customerinfo.ini"

DirGetSize($data_Location)

If @error= 1 Then

DirCreate($data_Location)

EndIf

Opt("GUIOnEventMode", 1) ; Change to OnEvent mode

$gui = GuiCreate("DellServ Notes", 510, 600)

#cs

Get tech login information.

#ce

GuiCtrlCreateGroup("Dellserv Login :", 5, 5, 400, 65)

GuiCtrlCreateLabel("User ID :", 10, 23)

$ibUserID = GuiCtrlCreateInput("", 10, 38, 100)

GuiCtrlCreateLabel("Password :", 130, 23)

$ibPass = GuiCtrlCreateInput("", 130, 38, 100,-1,$ES_PASSWORD)

GuiCtrlCreateLabel("Badge ID :", 250, 23)

$ibBadgeID = GuiCtrlCreateInput("", 250, 38, 100)

#cs

How to look up customer.

#ce

GuiCtrlCreateGroup("Look up customer by :", 5, 75, 400, 65)

GuiCtrlCreateLabel("ServiceTag :", 10, 90)

$ServiceTagLook = GuiCtrlCreateInput("", 10, 105, 100)

GuiCtrlCreateLabel("Case Number :", 130, 90)

$CaseNumberLook = GuiCtrlCreateInput("", 130, 105, 100,)

GuiCtrlCreateLabel("DPS Number :", 250, 90)

$DpsNumberLook = GuiCtrlCreateInput("", 250, 105, 100)

#cs

Get customer information.

#ce

GuiCtrlCreateGroup("Customer Information :", 5, 150, 400, 107)

GuiCtrlCreateLabel("First Name :", 10, 165)

$CustomerFirstName = GuiCtrlCreateInput("", 10, 180, 100)

GuiCtrlCreateLabel("Last Name :", 130, 165)

$CustomerLastName = GuiCtrlCreateInput("", 130, 180, 100,)

GuiCtrlCreateLabel("Customer Email :", 250, 165)

$CustomerEmail = GuiCtrlCreateInput("", 250, 180, 100)

GuiCtrlCreateLabel("Phone Number :", 10, 210)

$CustomerPnumber = GuiCtrlCreateInput("", 10, 225, 100)

GuiCtrlCreateLabel("Alt. Phone Number :", 130, 210)

$CustomerAltPnumber = GuiCtrlCreateInput("", 130, 225, 100,)

GuiCtrlCreateLabel("Problem Summary :", 10, 290)

$ProblemSummary = GuiCtrlCreateInput("", 10, 310, 390)

GuiCtrlCreateGroup("DellServ Notes :", 5, 345, 400, 175)

$DellServNotes = GuiCtrlCreateEdit("" ,10, 360, 390, 150)

$btnCase = GuiCtrlCreateButton("Create New Case", 75, 530,100)

$btnjournal = GUICtrlCreateButton("Create New Journal", 180, 530, 100)

$btnGetlist = GuiCtrlCreateButton("Find Customer", 285, 530,85)

$btnSave = GuiCtrlCreateButton("Save", 150, 560,75)

$btnClose = GuiCtrlCreateButton("Close", 230, 560,75)

GUICtrlSetOnEvent($btnCase, "NewCase_Button")

GUICtrlSetOnEvent($btnClose,"Close_Button")

GUICtrlSetOnEvent($btnJournal, "NewJournal_Button")

GUICtrlSetOnEvent($btnSave, "Save_Button")

GUICtrlSetOnEvent($btnGetlist, "Get_List")

GUISetOnEvent($GUI_EVENT_CLOSE, "CleanExit")

;GUISetOnEvent($GUI_EVENT_MINIMIZE,"Hide_to_tray")

GuiSetState(@SW_SHOW)

While (1)

sleep(2000)

WEnd

Func Close_Button()

CleanExit()

EndFunc

Func NewCase_Button()

$sURL = "private"

$oIE = _IECreate($sURL, 0, 0, 0)

$HWND = _IEPropertyGet($oIE, "hwnd")

WinSetState($HWND, "", @SW_MAXIMIZE)

_IEAction($oIE, "visible")

_IELoadWait($oIE)

WinActivate("Private")

ControlClick("Internet Explorer","",1,"left",1)

$dellservuserid = GUICtrlRead ($ibUserID)

$dellservpass = GUICtrlRead ($ibPass)

$dellservbadgeid = GUICtrlRead ($ibBadgeID)

$dellservnotesbox = GUICtrlRead ($DellServNotes)

$dellservservicetag = GUICtrlRead ($ServiceTagLook)

$dellservcasenumber = GUICtrlRead ($CaseNumberLook)

$dellservdpsnumber = GUICtrlRead ($DpsNumberLook)

$dellservservicetag = "9Z14QB1"

#cs

Delete Previous login information and put in new information

#ce

sleep(1000)

Send("+{END}{DELETE}")

Send($dellservuserid)

Send("{TAB}")

sleep(1000)

Send($dellservpass)

Send("{TAB}")

Send("+{END}{DELETE}")

sleep(1000)

Send($dellservbadgeid)

Send("{ENTER}")

if ($dellservdpsnumber <> "") Then

Send($dellservdpsnumber)

Send("{TAB}")

Send("{TAB}")

Send("{TAB}")

Send("{TAB}")

Send("{TAB}")

Send("{ENTER}")

ElseIf ($dellservservicetag <> "") Then

Send($dellservservicetag)

Send("{ENTER}")

Elseif ($dellservcasenumber <> "") Then

Send($dellservcasenumber)

Send("{TAB}")

Send("{TAB}")

Send("{TAB}")

Send("{TAB}")

Send("{TAB}")

Send("{TAB}")

Send("{TAB}")

Send("{TAB}")

Send("{ENTER}")

Else

MsgBox(0,"Please try again","Please enter a way to look up customer")

endif

;Get Case List

sleep(5000)

Send("{TAB}")

Send("{TAB}")

Send("{TAB}")

Send("{TAB}")

Send("{TAB}")

Send("{TAB}")

Send("{TAB}")

Send("{TAB}")

Send("{TAB}")

Send("{TAB}")

Send("{TAB}")

Send("{TAB}")

Send("{TAB}")

Send("{TAB}")

Send("{TAB}")

Send("{TAB}")

Send("{TAB}")

Send("{TAB}")

Send("{ENTER}")

;Create new Case

sleep(4000)

Send("{TAB}")

Send("{TAB}")

Send("{TAB}")

Send("{TAB}")

Send("{TAB}")

Send("{TAB}")

Send("{TAB}")

Send("{TAB}")

Send("{TAB}")

Send("{TAB}")

Send("{TAB}")

Send("{TAB}")

Send("{TAB}")

Send("{TAB}")

Send("{TAB}")

Send("{TAB}")

Send("{TAB}")

Send("{TAB}")

Send("{TAB}")

Send("{TAB}")

Send("{TAB}")

Send("{ENTER}")

;Insert Case notes

sleep(1000)

Send("{TAB}")

Send("{TAB}")

Send("{TAB}")

Send("{TAB}")

Send("{TAB}")

Send("{TAB}")

Send("{TAB}")

sleep(1000)

Send($dellservnotesbox)

EndFunc

Func CleanExit()

Exit

EndFunc

Func NewJournal_Button()

EndFunc

Func Save_Button()

If GUICtrlRead($ServiceTagLook) = "" then

MsgBox(262208, "Sorry...", "No information entered to save. ", 1)

Return

EndIf

$length = _FileCountLines($File_Location)

IniWrite($File_Location, "CustomerInfo", $length, GUICtrlRead($ibUserID)&","& GUICtrlRead($ibPass)&","& GUICtrlRead($ibBadgeID)&","& GUICtrlRead($ServiceTagLook)&","&GUICtrlRead($CaseNumberLook)&","& GUICtrlRead($DpsNumberLook)&","&GUICtrlRead($CustomerFirstName)&","&GUICtrlRead($CustomerLastName)&","&GUICtrlRead($CustomerEmail)&","&GUICtrlRead($CustomerPnumber)&","&GUICtrlRead($CustomerAltPnumber)&","&GUICtrlRead($ProblemSummary)&","&GUICtrlRead($DellServNotes))

MsgBox(262208, "Success!", "Customer has been added... ", 1)

EndFunc

Func Get_List()

EndFunc

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Nice job for a first post.... 8)

I added a bit more for you... not complete, but use the functions in my other post, thats all i did

#include <GuiConstants.au3>
#include <IE.au3>
#Include <File.au3>
#Include <GuiListView.au3>

Dim $data_Location = @ScriptDir & "\Data\"
Dim $File_Location = @ScriptDir & "\Data\Customerinfo.ini"

DirGetSize($data_Location)
If @error = 1 Then
    DirCreate($data_Location)
EndIf

Opt("GUIOnEventMode", 1) ; Change to OnEvent mode



$gui = GUICreate("DellServ Notes", 510, 600)
GUISetBkColor (0xE1E9F6)
#cs
    Get tech login information.
#ce

GUICtrlCreateGroup("Dellserv Login :", 5, 5, 400, 65)
GUICtrlCreateLabel("User ID :", 10, 23)
$ibUserID = GUICtrlCreateInput("", 10, 38, 100)
GUICtrlCreateLabel("Password :", 130, 23)
$ibPass = GUICtrlCreateInput("", 130, 38, 100, -1, $ES_PASSWORD)
GUICtrlCreateLabel("Badge ID :", 250, 23)
$ibBadgeID = GUICtrlCreateInput("", 250, 38, 100)

#cs
    How to look up customer.
#ce

GUICtrlCreateGroup("Look up customer by :", 5, 75, 400, 65)
GUICtrlCreateLabel("ServiceTag :", 10, 90)
$ServiceTagLook = GUICtrlCreateInput("", 10, 105, 100)
GUICtrlCreateLabel("Case Number :", 130, 90)
$CaseNumberLook = GUICtrlCreateInput("", 130, 105, 100)
GUICtrlCreateLabel("DPS Number :", 250, 90)
$DpsNumberLook = GUICtrlCreateInput("", 250, 105, 100)

#cs
    Get customer information.
#ce

GUICtrlCreateGroup("Customer Information :", 5, 150, 400, 107)
GUICtrlCreateLabel("First Name :", 10, 165)
$CustomerFirstName = GUICtrlCreateInput("", 10, 180, 100)
GUICtrlCreateLabel("Last Name :", 130, 165)
$CustomerLastName = GUICtrlCreateInput("", 130, 180, 100)
GUICtrlCreateLabel("Customer Email :", 250, 165)
$CustomerEmail = GUICtrlCreateInput("", 250, 180, 100)
GUICtrlCreateLabel("Phone Number :", 10, 210)
$CustomerPnumber = GUICtrlCreateInput("", 10, 225, 100)
GUICtrlCreateLabel("Alt. Phone Number :", 130, 210)
$CustomerAltPnumber = GUICtrlCreateInput("", 130, 225, 100)

GUICtrlCreateLabel("Problem Summary :", 10, 290)
$ProblemSummary = GUICtrlCreateInput("", 10, 310, 390)

GUICtrlCreateGroup("DellServ Notes :", 5, 345, 400, 175)
$DellServNotes = GUICtrlCreateEdit("", 10, 360, 390, 150)


$btnCase = GUICtrlCreateButton("Create New Case", 75, 530, 100)
$btnjournal = GUICtrlCreateButton("Create New Journal", 180, 530, 100)
$btnGetlist = GUICtrlCreateButton("Find Customer", 285, 530, 85)
$btnSave = GUICtrlCreateButton("Save", 150, 560, 75)
$btnClose = GUICtrlCreateButton("Close", 230, 560, 75)



GUICtrlSetOnEvent($btnCase, "NewCase_Button")
GUICtrlSetOnEvent($btnClose, "CleanExit")
GUICtrlSetOnEvent($btnjournal, "NewJournal_Button")
GUICtrlSetOnEvent($btnSave, "Save_Button")
GUICtrlSetOnEvent($btnGetlist, "Get_List")
GUISetOnEvent($GUI_EVENT_CLOSE, "CleanExit")
;GUISetOnEvent($GUI_EVENT_MINIMIZE,"Hide_to_tray")
GUISetState(@SW_SHOW)

$gui2 = GUICreate("Dellserv List :", 700, 500, 5, 5,$WS_BORDER, -1, $gui)
GUISetBkColor (0xE1E9F6)
$Listview = GUICtrlCreateListView("#|User ID|Password|Badge ID|Service Tag|Case Number|DPS Number|First Name|LastName|Customer Email|Phone #| Alt Phone #|Problem Summary|Notes", 10, 10, 680, 400, -1, BitOR($LVS_EX_REGIONAL, $LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES))
$Closer = GUICtrlCreateButton("Close", 460, 425, 180, 30)
;$Btn_view = GUICtrlCreateButton("View / Edit", 260, 425, 180, 30)
$Viewer = GUICtrlCreateButton("View Customers", 60, 425, 180, 30)
GUISetState(@SW_HIDE)

GUICtrlSetOnEvent($Closer, "Close_List")

While (1)
    Sleep(2000)
WEnd

Func Close_List()
    _GUICtrlListViewDeleteAllItems($listview)
    GUISetState(@SW_HIDE, $gui2)
    GUISetState(@SW_SHOW, $gui)
    GUISetState(@SW_RESTORE, $gui)
EndFunc


Func NewCase_Button()
    $sURL = "private"
    $oIE = _IECreate($sURL, 0, 0, 0)
    $HWND = _IEPropertyGet($oIE, "hwnd")
    WinSetState($HWND, "", @SW_MAXIMIZE)
    _IEAction($oIE, "visible")
    _IELoadWait($oIE)

    WinActivate("Private")
    ControlClick("Internet Explorer", "", 1, "left", 1)
    $dellservuserid = GUICtrlRead($ibUserID)
    $dellservpass = GUICtrlRead($ibPass)
    $dellservbadgeid = GUICtrlRead($ibBadgeID)

    $dellservnotesbox = GUICtrlRead($DellServNotes)
    $dellservservicetag = GUICtrlRead($ServiceTagLook)
    $dellservcasenumber = GUICtrlRead($CaseNumberLook)
    $dellservdpsnumber = GUICtrlRead($DpsNumberLook)

    $dellservservicetag = "9Z14QB1"

    #cs
        Delete Previous login information and put in new information
    #ce

    Sleep(1000)
    Send("+{END}{DELETE}")
    Send($dellservuserid)
    Send("{TAB}")
    Sleep(1000)
    Send($dellservpass)
    Send("{TAB}")
    Send("+{END}{DELETE}")
    Sleep(1000)
    Send($dellservbadgeid)
    Send("{ENTER}")


    If ($dellservdpsnumber <> "") Then
        Send($dellservdpsnumber)
        Send("{TAB 5}")
        Send("{ENTER}")
    ElseIf ($dellservservicetag <> "") Then
        Send($dellservservicetag)
        Send("{ENTER}")
    ElseIf ($dellservcasenumber <> "") Then
        Send($dellservcasenumber)
        Send("{TAB 8}")
        Send("{ENTER}")
    Else
        MsgBox(0, "Please try again", "Please enter a way to look up customer")
    EndIf
    ;Get Case List
    Sleep(5000)
    for $x = 1 to 18
    Send("{TAB}")
    Next
    Send("{ENTER}")
    ;Create new Case
    Sleep(4000)
    for $x = 1 to 21
    Send("{TAB}")
    Next
    Send("{ENTER}")
    ;Insert Case notes
    Sleep(1000)
    Send("{TAB 8}")
    Sleep(1000)
    Send($dellservnotesbox)

EndFunc   ;==>NewCase_Button

Func CleanExit()
    Exit
EndFunc   ;==>CleanExit

Func NewJournal_Button()

EndFunc   ;==>NewJournal_Button

Func Save_Button()
    If GUICtrlRead($ServiceTagLook) = "" Then
        MsgBox(262208, "Sorry...", "No information entered to save. ", 1)
        Return
    EndIf
    $length = _FileCountLines($File_Location)
    If $length = 0 Then $length = 1
    IniWrite($File_Location, "CustomerInfo", $length, GUICtrlRead($ibUserID) & "," & GUICtrlRead($ibPass) & "," & GUICtrlRead($ibBadgeID) & "," & GUICtrlRead($ServiceTagLook) & "," & GUICtrlRead($CaseNumberLook) & "," & _
    GUICtrlRead($DpsNumberLook) & "," & GUICtrlRead($CustomerFirstName) & "," & GUICtrlRead($CustomerLastName) & "," & GUICtrlRead($CustomerEmail) & "," & GUICtrlRead($CustomerPnumber) & "," & GUICtrlRead($CustomerAltPnumber) & "," & _
    GUICtrlRead($ProblemSummary) & "," & GUICtrlRead($DellServNotes))
    MsgBox(262208, "Success!", "Customer has been added... ", 1)
EndFunc   ;==>Save_Button

Func Get_List()
    GUISetState(@SW_SHOW, $gui2)
    $length = _FileCountLines($File_Location)
    For $x = 1 To $length - 1
        $temp_file = IniRead($File_Location, "CustomerInfo", $x, "Not Found")
        If $temp_file = "Not Found" Then Return
        $temp_split = StringSplit($temp_file, ",")
        GUICtrlCreateListViewItem( $x & "|" & $temp_split[1] & "|" & $temp_split[2] & "|" & $temp_split[3] & "|" & $temp_split[4] & "|" & $temp_split[5] & "|" & $temp_split[6] & "|" & $temp_split[7] & "|" & $temp_split[8] &  _
         "|" & $temp_split[9] & "|" & $temp_split[10] & "|" & $temp_split[11] & "|" & $temp_split[12] & "|" & $temp_split[13],$listview)
    Next
EndFunc

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Thanks so much for that. I'm still having a little trouble getting some things to work. When I click View/Edit or view, the gui2 won't close. Also, when I add new customer it doesn't add "Dellserv" notes. So it also doesn't display dellserv notes that were typed when clicking view / edit. I saw that if Problem Summary is too long then it splits the notes between the "Problem Summary" field, and Dellserv notes.

P.S This is my 3rd day messing with AutoIt, so if I ask some not so bright questions, sorry. :)

CODE

#include <GuiConstants.au3>

#include <IE.au3>

#Include <File.au3>

#Include <GuiListView.au3>

Dim $data_Location = @ScriptDir & "\Data\"

Dim $File_Location = @ScriptDir & "\Data\Customerinfo.ini"

Dim $num = 0, $Input[14], $data_[14]

DirGetSize($data_Location)

If @error = 1 Then

DirCreate($data_Location)

EndIf

Opt("GUIOnEventMode", 1) ; Change to OnEvent mode

$gui = GUICreate("DellServ Notes", 510, 600)

GUISetBkColor (0xE1E9F6)

#cs

Get tech login information.

#ce

GUICtrlCreateGroup("Dellserv Login :", 5, 5, 400, 65)

GUICtrlCreateLabel("User ID :", 10, 23)

$Input[1] = GUICtrlCreateInput("", 10, 38, 100)

GUICtrlCreateLabel("Password :", 130, 23)

$Input[2] = GUICtrlCreateInput("", 130, 38, 100, -1, $ES_PASSWORD)

GUICtrlCreateLabel("Badge ID :", 250, 23)

$Input[3] = GUICtrlCreateInput("", 250, 38, 100)

#cs

How to look up customer.

#ce

GUICtrlCreateGroup("Look up customer by :", 5, 75, 400, 65)

GUICtrlCreateLabel("ServiceTag :", 10, 90)

$Input[4] = GUICtrlCreateInput("", 10, 105, 100)

GUICtrlCreateLabel("Case Number :", 130, 90)

$Input[5] = GUICtrlCreateInput("", 130, 105, 100)

GUICtrlCreateLabel("DPS Number :", 250, 90)

$Input[6] = GUICtrlCreateInput("", 250, 105, 100)

#cs

Get customer information.

#ce

GUICtrlCreateGroup("Customer Information :", 5, 150, 400, 107)

GUICtrlCreateLabel("First Name :", 10, 165)

$Input[7] = GUICtrlCreateInput("", 10, 180, 100)

GUICtrlCreateLabel("Last Name :", 130, 165)

$Input[8] = GUICtrlCreateInput("", 130, 180, 100)

GUICtrlCreateLabel("Customer Email :", 250, 165)

$Input[9] = GUICtrlCreateInput("", 250, 180, 100)

GUICtrlCreateLabel("Phone Number :", 10, 210)

$Input[10] = GUICtrlCreateInput("", 10, 225, 100)

GUICtrlCreateLabel("Alt. Phone Number :", 130, 210)

$Input[11] = GUICtrlCreateInput("", 130, 225, 100)

GUICtrlCreateLabel("Problem Summary :", 10, 290)

$Input[12] = GUICtrlCreateInput("", 10, 310, 390)

GUICtrlCreateGroup("DellServ Notes :", 5, 345, 400, 175)

$Input[13] = GUICtrlCreateEdit("", 10, 360, 390, 150)

$btnCase = GUICtrlCreateButton("Create New Case", 75, 530, 100)

$btnjournal = GUICtrlCreateButton("Create New Journal", 180, 530, 100)

$btnGetlist = GUICtrlCreateButton("Find Customer", 285, 530, 85)

$btnSave = GUICtrlCreateButton("Save", 150, 560, 75)

$btnClose = GUICtrlCreateButton("Close", 230, 560, 75)

$btnClear = GUICtrlCreateButton("Clear", 310, 560, 75)

GUICtrlSetOnEvent($btnCase, "NewCase_Button")

GUICtrlSetOnEvent($btnClose, "CleanExit")

GUICtrlSetOnEvent($btnClear, "Clear_Fields")

GUICtrlSetOnEvent($btnjournal, "NewJournal_Button")

GUICtrlSetOnEvent($btnSave, "Save_Button")

GUICtrlSetOnEvent($btnGetlist, "Get_List")

GUISetOnEvent($GUI_EVENT_CLOSE, "CleanExit")

;GUISetOnEvent($GUI_EVENT_MINIMIZE,"Hide_to_tray")

GUISetState(@SW_SHOW)

$gui2 = GUICreate("Dellserv List :", 700, 500, 5, 5,$WS_BORDER, -1, $gui)

GUISetBkColor (0xE1E9F6)

$Listview = GUICtrlCreateListView("#|User ID|Password|Badge ID|Service Tag|Case Number|DPS Number|First Name|LastName|Customer Email|Phone #| Alt Phone #|Problem Summary|Notes", 10, 10, 680, 400, -1, BitOR($LVS_EX_REGIONAL, $LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES))

$Closer = GUICtrlCreateButton("Close", 460, 425, 180, 30)

$Btn_view = GUICtrlCreateButton("View / Edit", 260, 425, 180, 30)

$Viewer = GUICtrlCreateButton("View Customers", 60, 425, 180, 30)

GUISetState(@SW_HIDE)

GUICtrlSetOnEvent($Closer, "Close_List")

While (1)

Sleep(2000)

WEnd

Func Get_CNumber($x)

$temp_file = IniRead($File_Location, "CustomerInfo", $x, "Not Found")

If $temp_file = "Not Found" Then

MsgBox(262208, "Sorry...", "No Customer Found/Selected... ", 1)

Return

EndIf

$temp_split = StringSplit($temp_file, ",")

For $t = 1 To $temp_split[0] - 1

GUICtrlSetData($Input[$t], $temp_split[$t])

$num = $x

Next

EndFunc ;==>Get_CNumber

Func Close_List()

GUICtrlSetState( $Btn_view, $GUI_ENABLE)

Local $s_indices = _GUICtrlListViewGetSelectedIndices($listview)

Get_CNumber($s_indices + 1)

_GUICtrlListViewDeleteAllItems($listview)

GUISetState(@SW_HIDE, $gui2)

GUISetState(@SW_SHOW, $gui)

GUISetState(@SW_RESTORE, $gui)

EndFunc

Func NewCase_Button()

$sURL = "private"

$oIE = _IECreate($sURL, 0, 0, 0)

$HWND = _IEPropertyGet($oIE, "hwnd")

WinSetState($HWND, "", @SW_MAXIMIZE)

_IEAction($oIE, "visible")

_IELoadWait($oIE)

WinActivate("Private")

ControlClick("Internet Explorer", "", 1, "left", 1)

$dellservuserid = GUICtrlRead($Input[1])

$dellservpass = GUICtrlRead($Input[2])

$dellservbadgeid = GUICtrlRead($Input[3])

$dellservnotesbox = GUICtrlRead($Input[13])

$dellservservicetag = GUICtrlRead($Input[4])

$dellservcasenumber = GUICtrlRead($Input[5])

$dellservdpsnumber = GUICtrlRead($Input[6])

#cs

Delete Previous login information and put in new information

#ce

Sleep(1000)

Send("+{END}{DELETE}")

Send($dellservuserid)

Send("{TAB}")

Sleep(1000)

Send($dellservpass)

Send("{TAB}")

Send("+{END}{DELETE}")

Sleep(1000)

Send($dellservbadgeid)

Send("{ENTER}")

If ($dellservdpsnumber <> "") Then

Send($dellservdpsnumber)

Send("{TAB 5}")

Send("{ENTER}")

ElseIf ($dellservservicetag <> "") Then

Send($dellservservicetag)

Send("{ENTER}")

ElseIf ($dellservcasenumber <> "") Then

Send($dellservcasenumber)

Send("{TAB 8}")

Send("{ENTER}")

Else

MsgBox(0, "Please try again", "Please enter a way to look up customer")

EndIf

;Get Case List

Sleep(5000)

for $x = 1 to 18

Send("{TAB}")

Next

Send("{ENTER}")

;Create new Case

Sleep(4000)

for $x = 1 to 21

Send("{TAB}")

Next

Send("{ENTER}")

;Insert Case notes

Sleep(1000)

Send("{TAB 8}")

Sleep(1000)

Send($dellservnotesbox)

EndFunc ;==>NewCase_Button

Func CleanExit()

Exit

EndFunc ;==>CleanExit

Func NewJournal_Button()

EndFunc ;==>NewJournal_Button

Func Save_Button()

If GUICtrlRead($Input[4] ) = "" Then

MsgBox(262208, "Sorry...", "No information entered to save. ", 1)

Return

EndIf

$length = _FileCountLines($File_Location)

If $length = 0 Then $length = 1

IniWrite($File_Location, "CustomerInfo", $length, GUICtrlRead($Input[1]) & "," & GUICtrlRead($Input[2]) & "," & GUICtrlRead($Input[3] ) & "," & GUICtrlRead($Input[4] ) & "," & GUICtrlRead($Input[5]) & "," & _

GUICtrlRead($Input[6]) & "," & GUICtrlRead($Input[7]) & "," & GUICtrlRead($Input[8]) & "," & GUICtrlRead($Input[9]) & "," & GUICtrlRead($Input[10]) & "," & GUICtrlRead($Input[11] ) & "," & _

GUICtrlRead($Input[12]) & "," & GUICtrlRead($Input[13]))

MsgBox(262208, "Success!", "Customer has been added... ", 1)

EndFunc ;==>Save_Button

Func Get_List()

GUISetState(@SW_SHOW, $gui2)

$length = _FileCountLines($File_Location)

For $x = 1 To $length - 1

$temp_file = IniRead($File_Location, "CustomerInfo", $x, "Not Found")

If $temp_file = "Not Found" Then Return

$temp_split = StringSplit($temp_file, ",")

GUICtrlCreateListViewItem( $x & "|" & $temp_split[1] & "|" & $temp_split[2] & "|" & $temp_split[3] & "|" & $temp_split[4] & "|" & $temp_split[5] & "|" & $temp_split[6] & "|" & $temp_split[7] & "|" & $temp_split[8] & _

"|" & $temp_split[9] & "|" & $temp_split[10] & "|" & $temp_split[11] & "|" & $temp_split[12] & "|" & $temp_split[13],$listview)

Next

EndFunc

Func Clear_Fields()

EndFunc

#cs

$Input[1] $ibUserID

$Input[2] $ibPass

$Input[3] $ibBadgeID

$Input[4] $ServiceTagLook

$Input[5] $CaseNumberLook

$Input[6] $DpsNumberLook

$Input[7] $CustomerFirstName

$Input[8] $CustomerLastName

$Input[9] $CustomerEmail

$Input[10] $CustomerPnumber

$Input[11] $CustomerAltPnumber

$Input[12] $ProblemSummary

$Input[13] $DellServNotes

#ce

Edited by Klexen

Share this post


Link to post
Share on other sites

Okay, I got most of it to work. Pretty much only thing I can't get to work, is when you click "View / Edit" it does not close the gui, you have to click close. I've been trying to get it to work forever. If someone could help with that, I'm just about done. :) Thanks!

CODE
#include <GuiConstants.au3>

#include <IE.au3>

#Include <File.au3>

#Include <GuiListView.au3>

Dim $data_Location = @ScriptDir & "\Data\"

Dim $File_Location = @ScriptDir & "\Data\Customerinfo.ini"

Dim $num = 0, $Input[15], $data_[15]

DirGetSize($data_Location)

If @error = 1 Then

DirCreate($data_Location)

EndIf

Opt("GUIOnEventMode", 1) ; Change to OnEvent mode

$gui = GUICreate("DellServ Notes", 410, 600)

GUISetBkColor (0xE1E9F6)

#cs

Get tech login information.

#ce

GUICtrlCreateGroup("Dellserv Login :", 5, 5, 400, 65)

GUICtrlCreateLabel("User ID :", 10, 23)

$Input[1] = GUICtrlCreateInput("", 10, 38, 100)

GUICtrlCreateLabel("Password :", 130, 23)

$Input[2] = GUICtrlCreateInput("", 130, 38, 100, -1, $ES_PASSWORD)

GUICtrlCreateLabel("Badge ID :", 250, 23)

$Input[3] = GUICtrlCreateInput("", 250, 38, 100)

#cs

How to look up customer.

#ce

GUICtrlCreateGroup("Look up customer by :", 5, 75, 400, 65)

GUICtrlCreateLabel("ServiceTag :", 10, 90)

$Input[4] = GUICtrlCreateInput("", 10, 105, 100)

GUICtrlCreateLabel("Case Number :", 130, 90)

$Input[5] = GUICtrlCreateInput("", 130, 105, 100)

GUICtrlCreateLabel("DPS Number :", 250, 90)

$Input[6] = GUICtrlCreateInput("", 250, 105, 100)

#cs

Get customer information.

#ce

GUICtrlCreateGroup("Customer Information :", 5, 150, 400, 107)

GUICtrlCreateLabel("First Name :", 10, 165)

$Input[7] = GUICtrlCreateInput("", 10, 180, 100)

GUICtrlCreateLabel("Last Name :", 130, 165)

$Input[8] = GUICtrlCreateInput("", 130, 180, 100)

GUICtrlCreateLabel("Customer Email :", 250, 165)

$Input[9] = GUICtrlCreateInput("", 250, 180, 100)

GUICtrlCreateLabel("Phone Number :", 10, 210)

$Input[10] = GUICtrlCreateInput("", 10, 225, 100)

GUICtrlCreateLabel("Alt. Phone Number :", 130, 210)

$Input[11] = GUICtrlCreateInput("", 130, 225, 100)

$FusionIt = GUICtrlCreateCheckbox ("Fusion It", 10, 265, 55, 20)

GUICtrlCreateLabel("Problem Summary :", 10, 290)

$Input[12] = GUICtrlCreateInput("", 10, 310, 390)

GUICtrlCreateGroup("DellServ Notes :", 5, 345, 400, 175)

$NotesBox = GUICtrlCreateEdit("", 10, 360, 390, 150)

$btnCase = GUICtrlCreateButton("Create New Case", 50, 530, 100)

$btnjournal = GUICtrlCreateButton("Create New Journal", 155, 530, 100)

$btnGetlist = GUICtrlCreateButton("Find Customer", 260, 530, 100)

$btnSave = GUICtrlCreateButton("Save", 50, 560, 100)

$btnClose = GUICtrlCreateButton("Close", 155, 560, 100)

$btnClear = GUICtrlCreateButton("Clear", 260, 560, 100)

GUICtrlSetOnEvent($btnCase, "NewCase_Button")

GUICtrlSetOnEvent($btnClose, "CleanExit")

GUICtrlSetOnEvent($btnjournal, "NewJournal_Button")

GUICtrlSetOnEvent($btnSave, "Save_Button")

GUICtrlSetOnEvent($btnGetlist, "Get_List")

GUICtrlSetOnEvent($btnClear, "Clear_Fields")

GUISetOnEvent($GUI_EVENT_CLOSE, "CleanExit")

;GUISetOnEvent($GUI_EVENT_MINIMIZE,"Hide_to_tray")

GUISetState(@SW_SHOW)

$gui2 = GUICreate("Dellserv List :", 700, 500, 5, 5,$WS_BORDER, -1, $gui)

GUISetBkColor (0xE1E9F6)

$Listview = GUICtrlCreateListView("#|User ID|Password|Badge ID|Service Tag|Case Number|DPS Number|First Name|LastName|Customer Email|Phone #| Alt Phone #|Problem Summary|Notes", 10, 10, 680, 400, -1, BitOR($LVS_EX_REGIONAL, $LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES))

$Closer = GUICtrlCreateButton("Close", 460, 425, 180, 30)

$Btn_view = GUICtrlCreateButton("View / Edit", 60, 425, 180, 30)

GUISetState(@SW_HIDE)

GUICtrlSetOnEvent($Closer, "Close_List")

While (1)

Sleep(2000)

WEnd

Func Close_List()

Local $s_indices = _GUICtrlListViewGetSelectedIndices($listview)

Get_CNumber($s_indices + 1)

GUISetState(@SW_HIDE, $gui2)

_GUICtrlListViewDeleteAllItems($listview)

GUICtrlSetState( $Btn_view, $GUI_ENABLE)

_GUICtrlListViewDeleteAllItems($listview)

GUISetState(@SW_HIDE, $gui2)

GUISetState(@SW_SHOW, $gui)

GUISetState(@SW_RESTORE, $gui)

EndFunc

Func NewCase_Button()

$sURL = "private"

$oIE = _IECreate($sURL, 0, 0, 0)

$HWND = _IEPropertyGet($oIE, "hwnd")

WinSetState($HWND, "", @SW_MAXIMIZE)

_IEAction($oIE, "visible")

_IELoadWait($oIE)

WinActivate("Private")

ControlClick("Internet Explorer", "", 1, "left", 1)

$dellservuserid = GUICtrlRead($Input[1])

$dellservpass = GUICtrlRead($Input[2])

$dellservbadgeid = GUICtrlRead($Input[3])

$NotesBoxset = GUICtrlRead($NotesBox)

$dellservservicetag = GUICtrlRead($Input[4])

$dellservcasenumber = GUICtrlRead($Input[5])

$dellservdpsnumber = GUICtrlRead($Input[6])

#cs

Delete Previous login information and put in new information

#ce

Sleep(1000)

Send("+{END}{DELETE}")

Send($dellservuserid)

Send("{TAB}")

Sleep(1000)

Send($dellservpass)

Send("{TAB}")

Send("+{END}{DELETE}")

Sleep(1000)

Send($dellservbadgeid)

Send("{ENTER}")

If ($dellservdpsnumber <> "") Then

Send($dellservdpsnumber)

Send("{TAB 5}")

Send("{ENTER}")

ElseIf ($dellservservicetag <> "") Then

Send($dellservservicetag)

Send("{ENTER}")

ElseIf ($dellservcasenumber <> "") Then

Send($dellservcasenumber)

Send("{TAB 8}")

Send("{ENTER}")

Else

MsgBox(0, "Please try again", "Please enter a way to look up customer")

EndIf

;Get Case List

Sleep(5000)

for $x = 1 to 18

Send("{TAB}")

Next

Send("{ENTER}")

;Create new Case

Sleep(4000)

for $x = 1 to 21

Send("{TAB}")

Next

Send("{ENTER}")

;Insert Case notes

Sleep(1000)

Send("{TAB 8}")

Sleep(1000)

Send($NotesBoxset)

EndFunc ;==>NewCase_Button

Func CleanExit()

Exit

EndFunc ;==>CleanExit

Func NewJournal_Button()

EndFunc ;==>NewJournal_Button

Func Save_Button()

If GUICtrlRead($Input[4]) = "" Then

MsgBox(262208, "Sorry...", "No information entered to save. ", 1)

Return

EndIf

$length = _FileCountLines($File_Location)

If $length = 0 Then $length = 1

IniWrite($File_Location, "CustomerInfo", $length, GUICtrlRead($Input[1]) & "," & GUICtrlRead($Input[2]) & "," & GUICtrlRead($Input[3]) & "," & GUICtrlRead($Input[4]) & "," & GUICtrlRead($Input[5]) & "," & _

GUICtrlRead($Input[6]) & "," & GUICtrlRead($Input[7]) & "," & GUICtrlRead($Input[8]) & "," & GUICtrlRead($Input[9]) & "," & GUICtrlRead($Input[10]) & "," & GUICtrlRead($Input[11]) & "," & _

GUICtrlRead($Input[12]) & "," & GUICtrlRead($NotesBox))

Clear_List()

MsgBox(262208, "Success!", "Customer has been added... ", 1)

EndFunc ;==>Save_Button

Func Get_List()

GUISetState(@SW_SHOW, $gui2)

$length = _FileCountLines($File_Location)

For $x = 1 To $length - 1

$temp_file = IniRead($File_Location, "CustomerInfo", $x, "Not Found")

If $temp_file = "Not Found" Then Return

$temp_split = StringSplit($temp_file, ",")

GUICtrlCreateListViewItem( $x & "|" & $temp_split[1] & "|" & $temp_split[2] & "|" & $temp_split[3] & "|" & $temp_split[4] & "|" & $temp_split[5] & "|" & $temp_split[6] & "|" & $temp_split[7] & "|" & $temp_split[8] & _

"|" & $temp_split[9] & "|" & $temp_split[10] & "|" & $temp_split[11] & "|" & $temp_split[12] & "|" & $temp_split[13],$listview)

Next

EndFunc

Func Clear_List()

FileDelete($data_Location & "CustomerInfo.bak")

FileDelete(@TempDir & "\new.ini")

FileCopy($File_Location, $data_Location & "CustomerInfo.bak", 1)

FileWriteLine(@TempDir & "\new.ini", "[CustomerInfo]")

$t = 0

$length = _FileCountLines($File_Location)

For $x = 1 To $length - 1

$temp_file = IniRead($File_Location, "CustomerInfo", $x, "Not Found")

If $temp_file = "Not Found" Then Return

$temp_split = StringSplit($temp_file, ",")

If $temp_split[1] = "" Then ContinueLoop

$t = $t + 1

IniWrite(@TempDir & "\new.ini", "CustomerInfo", $t, $temp_split[1] & "," & $temp_split[2] & "," & $temp_split[3] & "," & $temp_split[4] & "," & $temp_split[5] & "," & $temp_split[6] & "," & $temp_split[7] & "," & $temp_split[8] & "," & $temp_split[9] & "," & $temp_split[10] & "," & $temp_split[11] & "," & $temp_split[12] & "," & $temp_split[13])

Next

FileCopy(@TempDir & "\new.ini", $File_Location, 1)

EndFunc

Func Get_CNumber($x)

$temp_file = IniRead($File_Location, "CustomerInfo", $x, "Not Found")

If $temp_file = "Not Found" Then

MsgBox(262208, "Sorry...", "No Customer Found/Selected... ", 1)

Return

EndIf

$temp_split = StringSplit($temp_file, ",")

For $t = 1 To $temp_split[0] - 1

GUICtrlSetData($Input[$t], $temp_split[$t])

$num = $x

Next

GUICtrlSetData($NotesBox, $temp_split[13])

Return

EndFunc ;==>Get_CNumber

Func Clear_Fields()

If GUICtrlRead($Input[1]) = "" then Return

for $x = 1 to 12

GUICtrlSetData($Input[$x], "")

Next

GUICtrlSetData($NotesBox, "")

Clear_List()

EndFunc

Share this post


Link to post
Share on other sites

Okay, nevermind, I got everything to work. Sorry about the tripple postage! And thanks again Valuator for your awesome code!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0