Jump to content

Script problem


Bert
 Share

Recommended Posts

I'm starting a new thread on this one..my b..b..b..brain is hurting somewhat bad here...

I have a application I have written (With help! - gafrost rocks!) and I need help with 2 issues.

1. When the script is ran, the Remove function doesn't work. I do not know how to make this work. I have made it so it simulates what I want it to do, but I do not know how to make it work.

2. When going from the sub window back to the main window, if you click cancel, it works fine. If you click on the X in the corner, the sub window remains open. Clicking on the X again will stop the script.

My brain is really starting to hurt on this one...please help! B)

Break(0)
#include <GuiConstants.au3>
#include <File.au3>
;-----------------------------
$main_gui = GUICreate("QuickText 1.0", 600, 65)
$Combo_2 = GUICtrlCreateCombo("", 20, 5, 500, 80)
$data1 = _LoadData(@ScriptDir & "\quicktext.ini", $Combo_2)
$button1 = GUICtrlCreateButton("Paste", 530, 5, 60, 20)
$button2 = GUICtrlCreateButton("Cancel", 530, 32, 60, 20)
$button3 = GUICtrlCreateButton("Add", 20, 32, 60, 20)
$button4 = GUICtrlCreateButton("Remove", 100, 32, 60, 20)
$button5 = GUICtrlCreateButton("Help", 180, 32, 60, 20)
$button10 = GUICtrlCreateButton("About", 260, 32, 60, 20)
; Run the GUI until it is closed
GUISetState()
While 1
   $msg = GUIGetMsg()
   Select
      Case $msg = $GUI_EVENT_CLOSE
         ExitLoop
       ;When button1 is pressed, label text is copied to the clipboard
      Case $msg = $button1
         $data = GUICtrlRead($Combo_2)
         ClipPut($data)
         Sleep(200)
         Exit
       ;When button2 is pressed, it will open a add text box.
      Case $msg = $button2
         Exit
       ;---------------------------------------
       ;this will open a sub GUI window to allow for adding or removing data
      Case $msg = $button3
         GUISetState(@SW_HIDE, $main_gui)
         $add_gui = GUICreate("Add entry to QuickText", 520, 65, @DesktopWidth / 2 - 160, @DesktopHeight / 2 - 45, -1, 0x00000018); WS_EX_ACCEPTFILES
         $file = GUICtrlCreateInput("", 10, 5, 500, 20)
         GUICtrlSetState(-1, $GUI_ACCEPTFILES)
         $button6 = GUICtrlCreateButton("Ok", 10, 30, 60, 20)
         $button7 = GUICtrlCreateButton("Cancel", 90, 30, 60, 20)
         GUISetState(@SW_SHOW, $add_gui)
         
         $msg = 0
         While $msg <> $GUI_EVENT_CLOSE
            $msg = GUIGetMsg()
            Select
               Case $msg = $button6; this will add data to the quicktest.ini file. It will make the file if it is missing
                  $adddata = GUICtrlRead($file)
                  $file1 = FileOpen("quicktext.ini", 1)
                  FileWrite($file1, $adddata & "|")
                        FileClose($file1)
                  GUIDelete($add_gui)
                  ExitLoop
                  
               Case $msg = $button7
                  GUIDelete($add_gui)
                  
                  ExitLoop
               EndSelect
                       
         WEnd
         _LoadData(@ScriptDir & "\quicktext.ini", $Combo_2)
         GUISetState(@SW_SHOW, $main_gui)
         
        ;----------------------------------------
        ;this will open a window that will remove a entry selected from the drop down list.
        Case $msg = $button4
         GUISetState(@SW_HIDE, $main_gui)
         $del_gui = GUICreate("Remove entry from QuickText", 520, 65, @DesktopWidth / 2 - 160, @DesktopHeight / 2 - 45, -1, 0x00000018); WS_EX_ACCEPTFILES
         $file = GUICtrlCreateCombo("Data is populated in this field from the quicktext.ini. The user picks what they want to delete from here", 10, 5, 500, 20)
         GUICtrlSetState(-1, $GUI_ACCEPTFILES)
         $button8 = GUICtrlCreateButton("Remove", 10, 30, 60, 20)
         $button9 = GUICtrlCreateButton("Cancel", 90, 30, 60, 20)
         GUISetState(@SW_SHOW, $del_gui)
         
         $msg = 0
         While $msg <> $GUI_EVENT_CLOSE
            $msg = GUIGetMsg()
            Select
               Case $msg = $button8; this will remove an entry from the quicktest.ini file. 

                      GUIDelete($del_gui)                     
                      msgbox(0+64,"Delete text", "the selected text from the dropdowncombo will be deleted from the quicktext.ini file")
                 
                  ExitLoop
                  
               Case $msg = $button9
                  GUIDelete($del_gui)                
                  ExitLoop
               EndSelect           
         WEnd       
         _LoadData(@ScriptDir & "\quicktext.ini", $Combo_2)
         GUISetState(@SW_SHOW, $main_gui)
        
        Case $msg = $button5
        msgbox(0+64, "How to use QuickType", "- To select what you want pasted to your current work, use the "& @CRLF _
                      & "  dropdown to select the item you want. Once selected, click OK."& @CRLF _
                      & ""& @CRLF _ 
                      & "- To enter a new item in the list, click ADD"& @CRLF _                 
                      & "  Type in what you want to have entered, then click OK."& @CRLF _
                      & ""& @CRLF _   
                      & "- To remove a entry, click on REMOVE"& @CRLF _
                      & "  Select from the dropdown what you wish to delete, then click OK."& @CRLF _
                      & ""& @CRLF _ 
                      & "- You can click CANCEL to back out if needed.")

        Case $msg = $button10
        msgbox(0+64, "AboutQuickType 1.0", "Designed and written by Volly"& @CRLF _
                      & "     XXXXXXXXXXXXXXXXXX"& @CRLF _
                      & ""& @CRLF _                 
                      & " To report a bug, call STnet XXX-XXXX")
                                                      
   EndSelect
   
   
WEnd
Exit

Func _LoadData($s_file, ByRef $h_Combo)
   $Shandle = FileOpen($s_file, 0)
   $note1 = FileReadLine($Shandle)
   FileClose($Shandle)
   GUICtrlSetData($h_Combo, "|" & $note1)
EndFunc ;==>_LoadData
Link to comment
Share on other sites

one problem change the $msg to $msg2 in the second loop

also move the guidelet's outside the loops

#include <GuiConstants.au3>
#include <File.au3>
;-----------------------------
$main_gui = GUICreate("QuickText 1.0", 600, 65)
$Combo_2 = GUICtrlCreateCombo("", 20, 5, 500, 80)
$data1 = _LoadData(@ScriptDir & "\quicktext.ini", $Combo_2)
$button1 = GUICtrlCreateButton("Paste", 530, 5, 60, 20)
$button2 = GUICtrlCreateButton("Cancel", 530, 32, 60, 20)
$button3 = GUICtrlCreateButton("Add", 20, 32, 60, 20)
$button4 = GUICtrlCreateButton("Remove", 100, 32, 60, 20)
$button5 = GUICtrlCreateButton("Help", 180, 32, 60, 20)
$button10 = GUICtrlCreateButton("About", 260, 32, 60, 20)
; Run the GUI until it is closed
GUISetState()
While 1
   $msg = GUIGetMsg()
   Select
      Case $msg = $GUI_EVENT_CLOSE
         ExitLoop
        ;When button1 is pressed, label text is copied to the clipboard
      Case $msg = $button1
         $data = GUICtrlRead($Combo_2)
         ClipPut($data)
         Sleep(200)
         Exit
        ;When button2 is pressed, it will open a add text box.
      Case $msg = $button2
         Exit
        ;---------------------------------------
        ;this will open a sub GUI window to allow for adding or removing data
      Case $msg = $button3
         GUISetState(@SW_HIDE, $main_gui)
         $add_gui = GUICreate("Add entry to QuickText", 520, 65, @DesktopWidth / 2 - 160, @DesktopHeight / 2 - 45, -1, 0x00000018); WS_EX_ACCEPTFILES
         $file = GUICtrlCreateInput("", 10, 5, 500, 20)
         GUICtrlSetState(-1, $GUI_ACCEPTFILES)
         $button6 = GUICtrlCreateButton("Ok", 10, 30, 60, 20)
         $button7 = GUICtrlCreateButton("Cancel", 90, 30, 60, 20)
         GUISetState(@SW_SHOW, $add_gui)
         
         $msg2 = 0
         While $msg2 <> $GUI_EVENT_CLOSE
            $msg2 = GUIGetMsg()
            Select
               Case $msg2 = $button6; this will add data to the quicktest.ini file. It will make the file if it is missing
                  $adddata = GUICtrlRead($file)
                  $file1 = FileOpen("quicktext.ini", 1)
                  FileWrite($file1, $adddata & "|")
                  FileClose($file1)
                  ExitLoop
                  
               Case $msg2 = $button7
                  
                  ExitLoop
            EndSelect
            
         WEnd
            GUIDelete($add_gui)
         _LoadData(@ScriptDir & "\quicktext.ini", $Combo_2)
         GUISetState(@SW_SHOW, $main_gui)
         
        ;----------------------------------------
        ;this will open a window that will remove a entry selected from the drop down list.
      Case $msg = $button4
         GUISetState(@SW_HIDE, $main_gui)
         $del_gui = GUICreate("Remove entry from QuickText", 520, 65, @DesktopWidth / 2 - 160, @DesktopHeight / 2 - 45, -1, 0x00000018); WS_EX_ACCEPTFILES
         $file = GUICtrlCreateCombo("Data is populated in this field from the quicktext.ini. The user picks what they want to delete from here", 10, 5, 500, 20)
         GUICtrlSetState(-1, $GUI_ACCEPTFILES)
         $button8 = GUICtrlCreateButton("Remove", 10, 30, 60, 20)
         $button9 = GUICtrlCreateButton("Cancel", 90, 30, 60, 20)
         GUISetState(@SW_SHOW, $del_gui)
         
         $msg2 = 0
         While $msg2 <> $GUI_EVENT_CLOSE
            $msg2 = GUIGetMsg()
            Select
               Case $msg2 = $button8; this will remove an entry from the quicktest.ini file.
                  
                  GUIDelete($del_gui)
                  MsgBox(0 + 64, "Delete text", "the selected text from the dropdowncombo will be deleted from the quicktext.ini file")
                  
                  ExitLoop
                  
               Case $msg2 = $button9
                  ExitLoop
            EndSelect
         WEnd
            GUIDelete($del_gui)
         _LoadData(@ScriptDir & "\quicktext.ini", $Combo_2)
         GUISetState(@SW_SHOW, $main_gui)
         
      Case $msg = $button5
         MsgBox(0 + 64, "How to use QuickType", "- To select what you want pasted to your current work, use the " & @CRLF _
                & "  dropdown to select the item you want. Once selected, click OK." & @CRLF _
                & "" & @CRLF _ 
                & "- To enter a new item in the list, click ADD" & @CRLF _                  
                & "  Type in what you want to have entered, then click OK." & @CRLF _
                & "" & @CRLF _    
                & "- To remove a entry, click on REMOVE" & @CRLF _
                & "  Select from the dropdown what you wish to delete, then click OK." & @CRLF _
                & "" & @CRLF _ 
                & "- You can click CANCEL to back out if needed.")
         
      Case $msg = $button10
         MsgBox(0 + 64, "AboutQuickType 1.0", "Designed and written by Volly" & @CRLF _
                & "   XXXXXXXXXXXXXXXXXX" & @CRLF _
                & "" & @CRLF _                  
                & " To report a bug, call STnet XXX-XXXX")
         
   EndSelect
   
   
WEnd
Exit

Func _LoadData($s_file, ByRef $h_Combo)
   $Shandle = FileOpen($s_file, 0)
   $note1 = FileReadLine($Shandle)
   FileClose($Shandle)
   GUICtrlSetData($h_Combo, "|" & $note1)
EndFunc  ;==>_LoadData
Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

#include <GuiConstants.au3>
#include <File.au3>
;-----------------------------
$main_gui = GUICreate("QuickText 1.0", 600, 65)
$Combo_2 = GUICtrlCreateCombo("", 20, 5, 500, 80)
$data1 = _LoadData(@ScriptDir & "\quicktext.ini", $Combo_2)
$button1 = GUICtrlCreateButton("Paste", 530, 5, 60, 20)
$button2 = GUICtrlCreateButton("Cancel", 530, 32, 60, 20)
$button3 = GUICtrlCreateButton("Add", 20, 32, 60, 20)
$button4 = GUICtrlCreateButton("Remove", 100, 32, 60, 20)
$button5 = GUICtrlCreateButton("Help", 180, 32, 60, 20)
$button10 = GUICtrlCreateButton("About", 260, 32, 60, 20)
; Run the GUI until it is closed
GUISetState()
While 1
   $msg = GUIGetMsg()
   Select
      Case $msg = $GUI_EVENT_CLOSE
         ExitLoop
       ;When button1 is pressed, label text is copied to the clipboard
      Case $msg = $button1
         $data = GUICtrlRead($Combo_2)
         ClipPut($data)
         Sleep(200)
         Exit
       ;When button2 is pressed, it will open a add text box.
      Case $msg = $button2
         Exit
       ;---------------------------------------
       ;this will open a sub GUI window to allow for adding or removing data
      Case $msg = $button3
         GUISetState(@SW_HIDE, $main_gui)
         $add_gui = GUICreate("Add entry to QuickText", 520, 65, @DesktopWidth / 2 - 160, @DesktopHeight / 2 - 45, -1, 0x00000018); WS_EX_ACCEPTFILES
         $file = GUICtrlCreateInput("", 10, 5, 500, 20)
         GUICtrlSetState(-1, $GUI_ACCEPTFILES)
         $button6 = GUICtrlCreateButton("Ok", 10, 30, 60, 20)
         $button7 = GUICtrlCreateButton("Cancel", 90, 30, 60, 20)
         GUISetState(@SW_SHOW, $add_gui)
         
         $msg2 = 0
         While $msg2 <> $GUI_EVENT_CLOSE
            $msg2 = GUIGetMsg()
            Select
               Case $msg2 = $button6; this will add data to the quicktest.ini file. It will make the file if it is missing
                  $adddata = GUICtrlRead($file)
                  $file1 = FileOpen(@ScriptDir & "\quicktext.ini", 1)
                  FileWrite($file1, $adddata & "|")
                  FileClose($file1)
                  ExitLoop
                  
               Case $msg2 = $button7
                  
                  ExitLoop
            EndSelect
            
         WEnd
            GUIDelete($add_gui)
         $data1 = _LoadData(@ScriptDir & "\quicktext.ini", $Combo_2)
         GUISetState(@SW_SHOW, $main_gui)
         
       ;----------------------------------------
       ;this will open a window that will remove a entry selected from the drop down list.
      Case $msg = $button4
            $rem_item = GUICtrlRead($Combo_2)
            If StringLen($rem_item) Then
                GUISetState(@SW_HIDE, $main_gui)
                $del_gui = GUICreate("Remove entry from QuickText", 520, 65, @DesktopWidth / 2 - 160, @DesktopHeight / 2 - 45, -1, 0x00000018); WS_EX_ACCEPTFILES
                $file = GUICtrlCreateCombo("Data is populated in this field from the quicktext.ini. The user picks what they want to delete from here", 10, 5, 500, 20)
                GUICtrlSetState(-1, $GUI_ACCEPTFILES)
                $button8 = GUICtrlCreateButton("Remove", 10, 30, 60, 20)
                $button9 = GUICtrlCreateButton("Cancel", 90, 30, 60, 20)
                GUISetState(@SW_SHOW, $del_gui)
                
                $msg2 = 0
                While $msg2 <> $GUI_EVENT_CLOSE
                    $msg2 = GUIGetMsg()
                    Select
                        Case $msg2 = $button8; this will remove an entry from the quicktest.ini file.
                                $data1 = StringReplace($data1,$rem_item & "|","")
                                $file1 = FileOpen(@ScriptDir & "\quicktext.ini", 2)
                                FileWrite($file1, $data1)
                                FileClose($file1)
                            
;~                 GUIDelete($del_gui)
;~                 MsgBox(0 + 64, "Delete text", "the selected text from the dropdowncombo will be deleted from the quicktext.ini file")
                            
                            ExitLoop
                            
                        Case $msg2 = $button9
                            ExitLoop
                    EndSelect
                WEnd
                GUIDelete($del_gui)
                $data1 = _LoadData(@ScriptDir & "\quicktext.ini", $Combo_2)
                GUISetState(@SW_SHOW, $main_gui)
            EndIf
         
      Case $msg = $button5
         MsgBox(0 + 64, "How to use QuickType", "- To select what you want pasted to your current work, use the " & @CRLF _
                & "  dropdown to select the item you want. Once selected, click OK." & @CRLF _
                & "" & @CRLF _ 
                & "- To enter a new item in the list, click ADD" & @CRLF _                  
                & "  Type in what you want to have entered, then click OK." & @CRLF _
                & "" & @CRLF _    
                & "- To remove a entry, click on REMOVE" & @CRLF _
                & "  Select from the dropdown what you wish to delete, then click OK." & @CRLF _
                & "" & @CRLF _ 
                & "- You can click CANCEL to back out if needed.")
         
      Case $msg = $button10
         MsgBox(0 + 64, "AboutQuickType 1.0", "Designed and written by Volly" & @CRLF _
                & "   XXXXXXXXXXXXXXXXXX" & @CRLF _
                & "" & @CRLF _                  
                & " To report a bug, call STnet XXX-XXXX")
         
   EndSelect
   
   
WEnd
Exit

Func _LoadData($s_file, ByRef $h_Combo)
   $Shandle = FileOpen($s_file, 0)
   $note1 = FileReadLine($Shandle)
   FileClose($Shandle)
   GUICtrlSetData($h_Combo, "|" & $note1)
    Return $note1
EndFunc ;==>_LoadData

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

That broke the add feature. It looks like it removes the pipes, but leaves the text. Also, it doesn't show the list that is used in the main GUI when you pick what you want removed.

updated, in case you don't select anything from the combo

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

I'm wondering, does it need to do this in this order?

1. Read what is displayed in the GUCtrlCreateCombo after the user picks what they want.

2. search in the quicktext.ini file to find the text that matches what was read.

3. replace what it finds with "" (including the | on the end of the entry) so the entry is deleated, but all other entries are intact.

Link to comment
Share on other sites

I tried it, and it doesn't show the list from the quicktext.ini. It has the dummy I put in. I cut and pasted the entire code into a test file to test it.

check your ini file from the previous test, you may need to put data in it again.

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

hi! i make work your last probleme! but i think the structure of this script is weird!

anyway! the function delete is ok! it delete it inside the file! but with dangerous mode! maybe you can makeit a backup before deleting entry! just to be sure! because when i do Fileopen i do it with 2 Overwrite!

after i rewrite the file! but if you lose power in the operation everything will be destrioy! anyway i hoep it help!

#include <GuiConstants.au3>
#include <File.au3>
#Include <GuiCombo.au3>
;-----------------------------
$main_gui = GUICreate("QuickText 1.0", 600, 65)
$Combo_2 = GUICtrlCreateCombo("", 20, 5, 500, 80)
$data1 = _LoadData(@ScriptDir & "\quicktext.ini", $Combo_2)
$button1 = GUICtrlCreateButton("Paste", 530, 5, 60, 20)
$button2 = GUICtrlCreateButton("Cancel", 530, 32, 60, 20)
$button3 = GUICtrlCreateButton("Add", 20, 32, 60, 20)
$button4 = GUICtrlCreateButton("Remove", 100, 32, 60, 20)
$button5 = GUICtrlCreateButton("Help", 180, 32, 60, 20)
$button10 = GUICtrlCreateButton("About", 260, 32, 60, 20)
; Run the GUI until it is closed
GUISetState()
While 1
   $msg = GUIGetMsg()
   Select
      Case $msg = $GUI_EVENT_CLOSE
         ExitLoop
       ;When button1 is pressed, label text is copied to the clipboard
      Case $msg = $button1
         $data = GUICtrlRead($Combo_2)
         ClipPut($data)
         Sleep(200)
         Exit
       ;When button2 is pressed, it will open a add text box.
      Case $msg = $button2
         Exit
       ;---------------------------------------
       ;this will open a sub GUI window to allow for adding or removing data
      Case $msg = $button3
         GUISetState(@SW_HIDE, $main_gui)
         $add_gui = GUICreate("Add entry to QuickText", 520, 65, @DesktopWidth / 2 - 160, @DesktopHeight / 2 - 45, -1, 0x00000018); WS_EX_ACCEPTFILES
         $file = GUICtrlCreateInput("", 10, 5, 500, 20)
         GUICtrlSetState(-1, $GUI_ACCEPTFILES)
         $button6 = GUICtrlCreateButton("Ok", 10, 30, 60, 20)
         $button7 = GUICtrlCreateButton("Cancel", 90, 30, 60, 20)
         GUISetState(@SW_SHOW, $add_gui)
         
         $msg2 = 0
         While $msg2 <> $GUI_EVENT_CLOSE
            $msg2 = GUIGetMsg()
            Select
               Case $msg2 = $button6; this will add data to the quicktest.ini file. It will make the file if it is missing
                  $adddata = GUICtrlRead($file)
                  $file1 = FileOpen("quicktext.ini", 1)
                  FileWrite($file1, $adddata & "|")
                  FileClose($file1)
                  ExitLoop
                  
               Case $msg2 = $button7
                  
                  ExitLoop
            EndSelect
            
         WEnd
            GUIDelete($add_gui)
         _LoadData(@ScriptDir & "\quicktext.ini", $Combo_2)
         GUISetState(@SW_SHOW, $main_gui)
         
       ;----------------------------------------
       ;this will open a window that will remove a entry selected from the drop down list.
      Case $msg = $button4
         GUISetState(@SW_HIDE, $main_gui)
         $del_gui = GUICreate("Remove entry from QuickText", 520, 65, @DesktopWidth / 2 - 160, @DesktopHeight / 2 - 45, -1, 0x00000018); WS_EX_ACCEPTFILES
         $file = GUICtrlCreateCombo("Data is populated in this field from the quicktext.ini. The user picks what they want to delete from here", 10, 5, 500, 20)
         _LoadData(@ScriptDir & "\quicktext.ini", $file)
         GUICtrlSetState(-1, $GUI_ACCEPTFILES)
         $button8 = GUICtrlCreateButton("Remove", 10, 30, 60, 20)
         $button9 = GUICtrlCreateButton("Cancel", 90, 30, 60, 20)
         GUISetState(@SW_SHOW, $del_gui)
         
         $msg2 = 0
         While $msg2 <> $GUI_EVENT_CLOSE
            $msg2 = GUIGetMsg()
            Select
            Case $msg2 = $button8; this will remove an entry from the quicktest.ini file.
                $vcDelete = GUICtrlRead($file)
                  $vfHandle = FileOpen("quicktext.ini", 0)
                  $vfWhole = FileReadLine($vfHandle)
                  FileClose($vfHandle)
                  $vfFinal = StringReplace($vfwhole,$vcDelete&"|", "",1,1)
                  $vfHandle = FileOpen("quicktext.ini", 2)
                  FileWriteLine($vfHandle,$vfFinal)
                  FileClose($vfHandle)
                  GUIDelete($del_gui)
                  MsgBox(0 + 64, "Delete text", "the selected text: """&$vcDelete&""" from the dropdowncombo will be deleted from the quicktext.ini file")
                  
                  ExitLoop
                  
               Case $msg2 = $button9
                  ExitLoop
            EndSelect
         WEnd
            GUIDelete($del_gui)
         _LoadData(@ScriptDir & "\quicktext.ini", $Combo_2)
         _LoadData(@ScriptDir & "\quicktext.ini", $file)
         GUISetState(@SW_SHOW, $main_gui)
         
      Case $msg = $button5
         MsgBox(0 + 64, "How to use QuickType", "- To select what you want pasted to your current work, use the " & @CRLF _
                & "  dropdown to select the item you want. Once selected, click OK." & @CRLF _
                & "" & @CRLF _ 
                & "- To enter a new item in the list, click ADD" & @CRLF _                  
                & "  Type in what you want to have entered, then click OK." & @CRLF _
                & "" & @CRLF _    
                & "- To remove a entry, click on REMOVE" & @CRLF _
                & "  Select from the dropdown what you wish to delete, then click OK." & @CRLF _
                & "" & @CRLF _ 
                & "- You can click CANCEL to back out if needed.")
         
      Case $msg = $button10
         MsgBox(0 + 64, "AboutQuickType 1.0", "Designed and written by Volly" & @CRLF _
                & "   XXXXXXXXXXXXXXXXXX" & @CRLF _
                & "" & @CRLF _                  
                & " To report a bug, call STnet XXX-XXXX")
         
   EndSelect
   
   
WEnd
Exit

Func _LoadData($s_file, ByRef $h_Combo)
   $Shandle = FileOpen($s_file, 0)
   $note1 = FileReadLine($Shandle)
   FileClose($Shandle)
   GUICtrlSetData($h_Combo, "|" & $note1)
EndFunc ;==>_LoadData

bye bye

GreenseedMCSE+I, CCNA, A+Canada, QuebecMake Love Around You.

Link to comment
Share on other sites

My bad...its working, but I discovered a bug. If you click add, and then click ok, it will put the item in. If you then remove the item, then try to add a new item, the drop down on the main GUI is blank. When I look at the INI, the items are on the second line. It has to be on the first line. For some reason, it is adding a carriage return when there is only one item in the list, and you remove the item.

Edited by vollyman
Link to comment
Share on other sites

My bad...its working, but I discovered a bug. If you click add, and then click ok, it will put the item in. If you then remove the item, then try to add a new item, the drop down on the main GUI is blank. When I look at the INI, the items are on the second line. It has to be on the first line. For some reason, it is adding a carriage return when there is only one item in the list, and you remove the item.

can't duplicate your problem with the script that i posted.

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

I tested it several times. This is what happens:

1. Starting off with the quicktext.ini file missing. When you run the script, it will make the ini file.

2. Add one entry called "test1". It will show up as "test1|" in the ini file

3. Use the remove function to remove test1

4. Add a new entry as "test2". When you check the dropdown, it is blank.

5. When I check the ini, I find a cariage return so it looks like this

"

test2|".

I'm using greenseed's code, for it has the remove function working correctly. I have also noticed it will do the carriage return if you remove the last item in the list. If you remove any item before the last one, it works fine.

Edited by vollyman
Link to comment
Share on other sites

#include <GuiConstants.au3>
#include <File.au3>
;-----------------------------
$main_gui = GUICreate("QuickText 1.0", 600, 65)
$Combo_2 = GUICtrlCreateCombo("", 20, 5, 500, 80)
$data1 = _LoadData(@ScriptDir & "\quicktext.ini", $Combo_2)
$button1 = GUICtrlCreateButton("Paste", 530, 5, 60, 20)
$button2 = GUICtrlCreateButton("Cancel", 530, 32, 60, 20)
$button3 = GUICtrlCreateButton("Add", 20, 32, 60, 20)
$button4 = GUICtrlCreateButton("Remove", 100, 32, 60, 20)
$button5 = GUICtrlCreateButton("Help", 180, 32, 60, 20)
$button10 = GUICtrlCreateButton("About", 260, 32, 60, 20)
; Run the GUI until it is closed
GUISetState()
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        ;When button1 is pressed, label text is copied to the clipboard
        Case $msg = $button1
            $data = GUICtrlRead($Combo_2)
            ClipPut($data)
            Sleep(200)
            Exit
        ;When button2 is pressed, it will open a add text box.
        Case $msg = $button2
            Exit
        ;---------------------------------------
        ;this will open a sub GUI window to allow for adding or removing data
        Case $msg = $button3
            GUISetState(@SW_HIDE, $main_gui)
            $add_gui = GUICreate("Add entry to QuickText", 520, 65, @DesktopWidth / 2 - 160, @DesktopHeight / 2 - 45, -1, 0x00000018); WS_EX_ACCEPTFILES
            $file = GUICtrlCreateInput("", 10, 5, 500, 20)
            GUICtrlSetState(-1, $GUI_ACCEPTFILES)
            $button6 = GUICtrlCreateButton("Ok", 10, 30, 60, 20)
            $button7 = GUICtrlCreateButton("Cancel", 90, 30, 60, 20)
            GUISetState(@SW_SHOW, $add_gui)
            
            $msg2 = 0
            While $msg2 <> $GUI_EVENT_CLOSE
                $msg2 = GUIGetMsg()
                Select
                    Case $msg2 = $button6; this will add data to the quicktest.ini file. It will make the file if it is missing
                        $adddata = GUICtrlRead($file)
                        _SaveData(@ScriptDir & "\quicktext.ini", $data1 & $adddata & "|")
                        ExitLoop
                        
                    Case $msg2 = $button7
                        
                        ExitLoop
                EndSelect
                
            WEnd
            GUIDelete($add_gui)
            $data1 = _LoadData(@ScriptDir & "\quicktext.ini", $Combo_2)
            GUISetState(@SW_SHOW, $main_gui)
            
        ;----------------------------------------
        ;this will open a window that will remove a entry selected from the drop down list.
        Case $msg = $button4
            $rem_item = GUICtrlRead($Combo_2)
            If StringLen($rem_item) Then
                GUISetState(@SW_HIDE, $main_gui)
                $del_gui = GUICreate("Remove entry from QuickText", 520, 65, @DesktopWidth / 2 - 160, @DesktopHeight / 2 - 45, -1, 0x00000018); WS_EX_ACCEPTFILES
                $file = GUICtrlCreateCombo("Data is populated in this field from the quicktext.ini. The user picks what they want to delete from here", 10, 5, 500, 20)
                GUICtrlSetState(-1, $GUI_ACCEPTFILES)
                $button8 = GUICtrlCreateButton("Remove", 10, 30, 60, 20)
                $button9 = GUICtrlCreateButton("Cancel", 90, 30, 60, 20)
                GUISetState(@SW_SHOW, $del_gui)
                
                $msg2 = 0
                While $msg2 <> $GUI_EVENT_CLOSE
                    $msg2 = GUIGetMsg()
                    Select
                        Case $msg2 = $button8; this will remove an entry from the quicktest.ini file.
                            $data1 = StringReplace($data1, $rem_item & "|", "")
                            _SaveData(@ScriptDir & "\quicktext.ini", $data1)
                            
;~                 GUIDelete($del_gui)
;~                 MsgBox(0 + 64, "Delete text", "the selected text from the dropdowncombo will be deleted from the quicktext.ini file")
                            
                            ExitLoop
                            
                        Case $msg2 = $button9
                            ExitLoop
                    EndSelect
                WEnd
                GUIDelete($del_gui)
                $data1 = _LoadData(@ScriptDir & "\quicktext.ini", $Combo_2)
                GUISetState(@SW_SHOW, $main_gui)
            EndIf
            
        Case $msg = $button5
            MsgBox(0 + 64, "How to use QuickType", "- To select what you want pasted to your current work, use the " & @CRLF _
                     & "  dropdown to select the item you want. Once selected, click OK." & @CRLF _
                     & "" & @CRLF _ 
                     & "- To enter a new item in the list, click ADD" & @CRLF _                 
                     & "  Type in what you want to have entered, then click OK." & @CRLF _
                     & "" & @CRLF _   
                     & "- To remove a entry, click on REMOVE" & @CRLF _
                     & "  Select from the dropdown what you wish to delete, then click OK." & @CRLF _
                     & "" & @CRLF _ 
                     & "- You can click CANCEL to back out if needed.")
            
        Case $msg = $button10
            MsgBox(0 + 64, "AboutQuickType 1.0", "Designed and written by Volly" & @CRLF _
                     & "      XXXXXXXXXXXXXXXXXX" & @CRLF _
                     & "" & @CRLF _                 
                     & " To report a bug, call STnet XXX-XXXX")
            
    EndSelect
    
    
WEnd
Exit

Func _LoadData($s_file, ByRef $h_Combo)
    $note1 = IniRead($s_file, "QuickType", "items", "")
    GUICtrlSetData($h_Combo, "|" & $note1)
    Return $note1
EndFunc  ;==>_LoadData

Func _SaveData($s_file, $s_data)
    IniWrite($s_file, "QuickType", "items", $s_data)
EndFunc  ;==>_SaveData

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

I tested it, and I made one small change to the remove feature so it acts like a warning before you delete the entry. Other than that, it works like a champ! Let me know what you think.

;QuickText 1.0
;Written by Gafrost, Greenseed, and Volly. (Thanks for all the help!)
;Nov 2005
;----------------------------

#include <GuiConstants.au3>
#include <File.au3>
;-----------------------------
$main_gui = GUICreate("QuickText 1.0", 600, 65)
$Combo_2 = GUICtrlCreateCombo("", 20, 5, 500, 80)
$data1 = _LoadData(@ScriptDir & "\quicktext.ini", $Combo_2)
$button1 = GUICtrlCreateButton("Paste", 530, 5, 60, 20)
$button2 = GUICtrlCreateButton("Cancel", 530, 32, 60, 20)
$button3 = GUICtrlCreateButton("Add", 20, 32, 60, 20)
$button4 = GUICtrlCreateButton("Remove", 100, 32, 60, 20)
$button5 = GUICtrlCreateButton("Help", 180, 32, 60, 20)
$button10 = GUICtrlCreateButton("About", 260, 32, 60, 20)
; Run the GUI until it is closed
GUISetState()
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
       ;When button1 is pressed, label text is copied to the clipboard
        Case $msg = $button1
            $data = GUICtrlRead($Combo_2)
            ClipPut($data)
            Sleep(200)
            Exit
       ;When button2 is pressed, it will open a add text box.
        Case $msg = $button2
            Exit
       ;---------------------------------------
       ;this will open a sub GUI window to allow for adding or removing data
        Case $msg = $button3
            GUISetState(@SW_HIDE, $main_gui)
            $add_gui = GUICreate("Add entry to QuickText", 520, 65, @DesktopWidth / 2 - 160, @DesktopHeight / 2 - 45, -1, 0x00000018); WS_EX_ACCEPTFILES
            $file = GUICtrlCreateInput("", 10, 5, 500, 20)
            GUICtrlSetState(-1, $GUI_ACCEPTFILES)
            $button6 = GUICtrlCreateButton("Ok", 10, 30, 60, 20)
            $button7 = GUICtrlCreateButton("Cancel", 90, 30, 60, 20)
            GUISetState(@SW_SHOW, $add_gui)
            
            $msg2 = 0
            While $msg2 <> $GUI_EVENT_CLOSE
                $msg2 = GUIGetMsg()
                Select
                    Case $msg2 = $button6; this will add data to the quicktest.ini file. It will make the file if it is missing
                        $adddata = GUICtrlRead($file)
                        _SaveData(@ScriptDir & "\quicktext.ini", $data1 & $adddata & "|")
                        ExitLoop
                        
                    Case $msg2 = $button7
                        
                        ExitLoop
                EndSelect
                
            WEnd
            GUIDelete($add_gui)
            $data1 = _LoadData(@ScriptDir & "\quicktext.ini", $Combo_2)
            GUISetState(@SW_SHOW, $main_gui)
            
       ;----------------------------------------
       ;this will open a window that will remove a entry selected from the drop down list.
        Case $msg = $button4
            $rem_item = GUICtrlRead($Combo_2)
            If StringLen($rem_item) Then
                GUISetState(@SW_HIDE, $main_gui)
                $del_gui = GUICreate("Remove entry from QuickText?", 500, 130) 
                $file = GUICtrlCreateLabel ("Are you sure you wish to delete the entry:", 5, 5)
                $file1 = GUICtrlCreateedit ($rem_item, 5, 25, 490, 80, $WS_VSCROLL + $ES_READONLY)
                GUICtrlSetState(-1, $GUI_ACCEPTFILES)
                $button8 = GUICtrlCreateButton("Yes, remove it", 150, 108, 100, 20)
                $button9 = GUICtrlCreateButton("Cancel", 270, 108, 60, 20)
                GUISetState(@SW_SHOW, $del_gui)
                
                $msg2 = 0
                While $msg2 <> $GUI_EVENT_CLOSE
                    $msg2 = GUIGetMsg()
                    Select
                        Case $msg2 = $button8; this will remove an entry from the quicktest.ini file.
                            $data1 = StringReplace($data1, $rem_item & "|", "")
                            _SaveData(@ScriptDir & "\quicktext.ini", $data1)
                                                       
                            ExitLoop
                            
                        Case $msg2 = $button9
                            ExitLoop
                    EndSelect
                WEnd
                GUIDelete($del_gui)
                $data1 = _LoadData(@ScriptDir & "\quicktext.ini", $Combo_2)
                GUISetState(@SW_SHOW, $main_gui)
            EndIf
            
        Case $msg = $button5
            MsgBox(0 + 64, "How to use QuickType", "- To select what you want pasted to your current work, use the " & @CRLF _
                     & "  dropdown to select the item you want. Once selected, click OK." & @CRLF _
                     & "" & @CRLF _
                     & "- To enter a new item in the list, click ADD" & @CRLF _                 
                     & "  Type in what you want to have entered, then click OK." & @CRLF _
                     & "" & @CRLF _   
                     & "- To remove a entry, select the item you wanto to remove, then click on REMOVE" & @CRLF _
                     & "  If you are sure this is what you wish to remove, click YES, REMOVE IT." & @CRLF _
                     & "" & @CRLF _
                     & "- You can click CANCEL to back out if needed.")
            
        Case $msg = $button10
            MsgBox(0 + 64, "About QuickType 1.0", "Designed and written by Volly" & @CRLF _
                     & "      XXXXXXXXXXXXXXXXXX" & @CRLF _
                     & "" & @CRLF _                 
                     & " To report a bug, call STnet XXX-XXXX")
            
    EndSelect
    
    
WEnd
Exit

Func _LoadData($s_file, ByRef $h_Combo)
    $note1 = IniRead($s_file, "QuickType", "items", "")
    GUICtrlSetData($h_Combo, "|" & $note1)
    Return $note1
EndFunc ;==>_LoadData

Func _SaveData($s_file, $s_data)
    IniWrite($s_file, "QuickType", "items", $s_data)
EndFunc ;==>_SaveData

Again, I like to thank the both of you for your help on this little project. B)

Edited by vollyman
Link to comment
Share on other sites

Sorry for my buggy function in the last post! but like i said! i have big probleme to understand the structure of your script!

i wrote you, a brand new one! who work fine with me! everything work fine!

this is the code i hope it help!

;Made By Greenseed On 29 November 2005! After 37 Hours Of No Sleep!
;I was a Little Slow! hehe! it take me about 2 Hours!
;Helped By Volly And Gafrost 
;Thx Dude!


#Region Option Declaration
Opt("CaretCoordMode", 1)      ;1=absolute, 0=relative
Opt("ColorMode", 0)            ;0 = Colors are defined as RGB 1 = Colors are defined as BGR (0xBBGGRR)
Opt("ExpandEnvStrings", 0)    ;0=don't expand, 1=do expand
Opt("ExpandVarStrings",    0)     ;Changes how literal strings and variable/macro ($ and @) symbols are interpreted 0=Default
Opt("FtpBinaryMode" , 1)    ;Binary=1 AscII=0
Opt("GUICloseOnESC", 0)        ; 0=Default
Opt("GUICoordMode",1)        ; 0=relative to CTRL 1=absolute To Box(default) 2= Cell Positioning
Opt("GUIDataSeparatorChar","|"); default "|"
Opt("GUIOnEventMode",0)        ;Default =0
Opt("GUIResizeMode",0)        ;Default=0 See Resize mode
Opt("GUIEventCompatibilityMode",0); default=0  1= Absolute 2=Client Area
Opt("MouseClickDelay", 10)    ;10 milliseconds
Opt("MouseClickDownDelay", 10);10 milliseconds
Opt("MouseClickDragDelay", 250);250 milliseconds
Opt("MouseCoordMode",0)        ;Default=0
Opt("MustDeclareVars", 0)      ;0=no, 1=require pre-declare
Opt("OnExitFunc","OnAutoItExit");Default=OnAutoItExit
Opt("PixelCoordMode", 1)      ;1=absolute, 0=relative
Opt("RunErrorsFatal", 0)      ;1=fatal, 0=silent set @error
Opt("SendAttachMode", 0)      ;0=don't attach, 1=do attach
Opt("SendCapslockMode", 1)    ;1=store and restore, 0=don't
Opt("SendKeyDelay", 8)        ;5 milliseconds
Opt("SendKeyDownDelay", 1)    ;1 millisecond
Opt("TCPTimeout",100)        ;Default=100
Opt("TrayAutoPause",0)        ;Default=1
Opt("TrayIconDebug", 1)        ;0=no info, 1=debug line info
Opt("TrayIconHide", 0)        ;0=show, 1=hide tray icon
Opt("TrayMenuMode",0)        ;2=User 1=Disable
Opt("TrayOnEventMode",0)    ;Default=0
Opt("WinDetectHiddenText", 0)  ;0=don't detect, 1=do detect
Opt("WinSearchChildren", 1)    ;0=no, 1=search children also
Opt("WinTextMatchMode",1)    ;Default=1 2=modeFast
Opt("WintitleMatchMode", 1)    ;1=start, 2=subStr, 3=exact, 4=...
Opt("WinWaitDelay", 250)      ;250 milliseconds
#endregion

#region Declaration Variables et Include files
#include <GuiConstants.au3>
#include <File.au3>
#Include <GuiCombo.au3>
Global Const $DataFile = "data.dbit"
Global Const $DataPath = @ScriptDir
Dim $Datas
Dim $sData
Dim $AddButtonCancel
Dim $DelButtonCancel
Dim $MainAddGui
Dim $MainDelGui
Dim $DelCombo
Dim $AddButtonOk
Dim $AddInput
Dim $DelButtonRemove

#endregion

FileCheck()

;Main Gui Add Menu
$MainAddGui = GUICreate("Add entry to QuickText", 520, 65, @DesktopWidth / 2 - 160, @DesktopHeight / 2 - 45, -1, 0x00000018)
GUISetState(@SW_HIDE)
$AddInput = GUICtrlCreateInput("Enter Text To Add", 10, 5, 500, 20)
;~ GUICtrlSetState(-1, $GUI_ACCEPTFILES)
;~ GUICtrlSetStyle(-1,-1,$WS_EX_ACCEPTFILES) 
$AddButtonOk = GUICtrlCreateButton("Ok", 10, 30, 60, 20)
$AddButtonCancel = GUICtrlCreateButton("Cancel", 90, 30, 60, 20)
 
;main Gui Delete Menu
$MainDelGui = GUICreate("Remove entry from QuickText", 520, 65, @DesktopWidth / 2 - 160, @DesktopHeight / 2 - 45, -1, 0x00000018); WS_EX_ACCEPTFILES
GUISetState(@SW_HIDE)
$DelCombo = GUICtrlCreateCombo("Data is populated in this field from the quicktext.ini. The user picks what they want to delete from here", 10, 5, 500, 20)
GUICtrlSetState(-1, $GUI_ACCEPTFILES)
GUICtrlSetStyle(-1,-1,$WS_EX_ACCEPTFILES)
$DelButtonRemove = GUICtrlCreateButton("Remove", 10, 30, 60, 20)
$DelButtonCancel = GUICtrlCreateButton("Cancel", 90, 30, 60, 20)


;-----------------------------
$MainGui = GUICreate("QuickText 1.0", 600, 100,-1,-1,$GUI_SS_DEFAULT_GUI+$WS_CLIPCHILDREN)
$MainCombo = GUICtrlCreateCombo("Make Your Selection", 20, 5, 500, 80)
LoadData(-1)
$Buttonpaste = GUICtrlCreateButton("Paste", 530, 5, 60, 20)
$ButtonCancel = GUICtrlCreateButton("Cancel", 530, 32, 60, 20)
$ButtonAdd = GUICtrlCreateButton("Add", 20, 32, 60, 20)
$ButtonRemove = GUICtrlCreateButton("Remove", 100, 32, 60, 20)
$Buttonhelp = GUICtrlCreateButton("Help", 180, 32, 60, 20)
$ButtonAbout = GUICtrlCreateButton("About", 260, 32, 60, 20)
; Run the GUI until it is closed
GUISetState(@SW_SHOW,$MainGui)






While 1
    $msg = GUIGetMsg(1)
    Select
        Case $msg[0] = $GUI_EVENT_CLOSE And $msg[1] = $MainGui or $msg[0] = $ButtonCancel
                Exit
        Case $msg[0] = $GUI_EVENT_CLOSE And $msg[1] = $MainAddGui or $msg[0] = $AddButtonCancel
            GUISetState(@SW_SHOW,$MainGui)
            GUISetState(@SW_HIDE, $MainAddGui)
        Case $msg[0] = $GUI_EVENT_CLOSE And $msg[1] = $MainDelGui or $msg[0] = $DelButtonCancel
            GUISetState(@SW_SHOW,$MainGui)
            GUISetState(@SW_HIDE, $MainDelGui)
    ;When button1 is pressed, label text is copied to the clipboard
        Case $msg[0] = $Buttonpaste
             $sData = GUICtrlRead($MainCombo)
             ClipPut($sData)
             $sData = ""
             Sleep(200)
            ;Exit
          ;---------------------------------------
          ;this will open a sub GUI window to allow for adding or removing data
        Case $msg[0] = $ButtonAdd
            GUISetState(@SW_HIDE,$MainGui)
            GUISetState(@SW_SHOW, $MainAddGui)
        ; this will add data to the quicktest.ini file. It will make the file if it is missing
        Case $msg[0] = $AddButtonOk
            AddData(GUICtrlRead($AddInput))
            GUICtrlSetData($AddInput,"")
            LoadData($MainCombo)
            LoadData($DelCombo)
          ;----------------------------------------
          ;this will open a window that will remove a entry selected from the drop down list.
        Case $msg[0] = $ButtonRemove
            GUISetState(@SW_HIDE,$MainGui)
             LoadData(-1)
            GUISetState(@SW_SHOW, $MainDelGui)             
        Case $msg[0] = $DelButtonRemove; this will remove an entry from the quicktest.ini file.
            LoadData($DelCombo)
            DeleteData(GUICtrlRead($DelCombo))
            LoadData($MainCombo)
            LoadData($DelCombo)
        Case $msg[0] = $Buttonhelp
            MsgBox(0 + 64, "How to use QuickType", "- To select what you want pasted to your current work, use the " & @CRLF _
                    & "  dropdown to select the item you want. Once selected, click OK." & @CRLF _
                    & "" & @CRLF _ 
                    & "- To enter a new item in the list, click ADD" & @CRLF _                    
                    & "  Type in what you want to have entered, then click OK." & @CRLF _
                    & "" & @CRLF _      
                    & "- To remove a entry, click on REMOVE" & @CRLF _
                    & "  Select from the dropdown what you wish to delete, then click OK." & @CRLF _
                    & "" & @CRLF _ 
                    & "- You can click CANCEL to back out if needed.")
             
          Case $msg[0] = $ButtonAbout
            MsgBox(0 + 64, "AboutQuickType 1.0", "Designed and written by Volly" & @CRLF _
                    & "      XXXXXXXXXXXXXXXXXX" & @CRLF _
                    & "" & @CRLF _                    
                    & " To report a bug, call STnet XXX-XXXX")
    EndSelect
WEnd
Exit


;Add Specific Data To Data Files
Func AddData($AddedData)
    Local $fHandle
    LoadData(-2)
    $Datas = $Datas&$AddedData&"|"
    $fHandle=FileOpen($DataPath&"\"&$Datafile, 2)
    FileWriteLine($fHandle, $Datas)
    FileClose($fHandle)
    LoadData(-2)
EndFunc



;Erase specific data ($removabledata) from Database File
Func DeleteData($removabledata)
    Local $fHandle
    $Datas = StringReplace(LoadData(-2),$removabledata&"|", "",1,1)
    $fHandle = FileOpen($DataPath&"\"&$Datafile,2)    
    FileWriteLine($fHandle,$Datas)
    FileClose($fHandle)
    if @error then
        return 0
    else 
        return 1
    EndIf
EndFunc



;Load Data to $Datas and set the data to combobox ID if -2 is combobox ID the Only $Datas Is updated
Func LoadData($ComboBoxID=-1)
    Local $fHandle
    Local $fRead
    $fHandle=FileOpen($DataPath&"\"&$Datafile,0)
    $fRead=FileReadLine($fHandle)
    $Datas=$fRead
    FileClose($fHandle)
    if $ComboBoxID <> -2 then
        GUICtrlSetData($ComboBoxID,"|")
        GUICtrlSetData($ComboBoxID,$Datas)
    EndIf
    Return $Datas
EndFunc;==>_LoadData


;Check If The file Exist if not create and check for file have no more than 1 line if not script exit
Func FileCheck()
    Local $fHandle
    Local $Check
    if not FileExists($DataPath&"\"&$Datafile) Then
        $fHandle=FileOpen($DataPath&"\"&$Datafile,2)
        FileClose($fHandle)
    Else
        $Check =_FileCountLines($DataPath&"\"&$Datafile) 

        if $check >= 2 or $check <= -1 then
            MsgBox(0,"QuickText 1.0","Error When Checking File: "&@CRLF&"   "&$DataPath&"\"&$Datafile&@CRLF&"You Should Check The File." )
            Exit
        endif
    EndIf
    Return 1
EndFunc

it fast and refresh dynamic the Combo Box!

Oups! I see you manage to make a final version! bah! i send you this one! maybe it better or worst! let me know please! bye bye!

Edited by Greenseed

GreenseedMCSE+I, CCNA, A+Canada, QuebecMake Love Around You.

Link to comment
Share on other sites

Create an account or sign in to comment

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

Create an account

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

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...