Search the Community
Showing results for tags 'sub'.
-
Hi, i would like to know if there is a possible way to use subsections for ini files? For example, my ini file would look something like this: Clientname.ini [Info] Country=USA Type=Distributor [Costs] [[JAN]] <----- subsection cost1=---- cost2=---- [[FEB]] cost1=---- cost2=---- [Sales] [[JAN]] <----- subsection sale1=---- sale2=---- [[FEB]] sale1=---- sale2=---- [Profits] [[JAN]] <----- subsection prof1=---- prof2=---- [[FEB]] prof1=---- prof2=---- The sales would be inputed everyday by the script, and then whenever viewed, i would be using an array to view every sale/cost/profit under the subsection Thanks for your time!
- 3 replies
-
- ini
- subsection
-
(and 3 more)
Tagged with:
-
I'm a bit confused about accelerator keys and checkboxes. 1) See my code below: Is this the correct way how I put them in the script? (First: reading the ini file to see if the checkbox is enabled then setting the checkbox state before "GUISetState(@SW_SHOW" Second: After having created the GUI, if the status of the checkbox changes disable or enable the accelerator keys (Case $CB3) Third: when the GUI is closed, write checkbox status in ini) 2) I've read in a reply of Melba in another topic that in order to disable the accelerator keys (in my case {enter}) It is needed to Send a CR to the control "ControlSend($hGUI, "", $hFocus, @CR)" I don't know why this is, I haven't understand it very well and I don't know where to put it in my case. (but it seems to work fine in my code without it) 3) In my code below I have inserted only 2 buttons (search and images) In reality I have a lot more buttons. The code between ";Focus and Accelerator key" and ";END Focus and Accelerator key" is almost the same in all Cases. The only thing different is the value of $focus. The value of $focus is the Case name. Is there a way to put this code in an external function to avoid multiplying the code many times? (I noted in the help file that there is not a GUI ID in GUICtrlSetState and GUISetAccelerators) #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <String.au3> #include <GuiButton.au3> #include <Constants.au3> #include <EditConstants.au3> HotKeySet("^4", "SearchMenu") While 1 Sleep(10000) WEnd Func SearchMenu() ;========GUI============= $MyFile = "d:\temp\RW-autoit.ini" Global $url $Form5= GUICreate("Search Menu", 345, 140, @DesktopWidth*0.65, @DesktopHeight*0.21) $RWSearch = GuiCtrlCreateEdit("", 16, 10, 270, 50) $textGoogle = GUICtrlCreateLabel("Google:", 20, 90, 100, 20) $bsearch = GUICtrlCreateButton("Search", 110, 90, 60, 20) $bimages = GUICtrlCreateButton("Images", 175, 90, 60, 20) $CB3 = GUICtrlCreateCheckbox("Enter=Send (^Enter=Enter)", 110, 120, 145, 20) If FileExists($MyFile) Then $State = IniRead($MyFile,"CheckBox","CB3",0) If $State == 1 Then GUICtrlSetState(($CB3), BitOr($GUI_ENABLE, $GUI_CHECKED)) Else GUICtrlSetState(($CB3), BitOr($GUI_ENABLE, $GUI_UNCHECKED)) EndIf $Focus = IniRead($MyFile,"Focus","Button",0) Else GUICtrlSetState(($CB3, BitOr($GUI_ENABLE, $GUI_CHECKED)) $Focus = "bsearch" EndIf GUISetState(@SW_SHOW) ;========END GUI========== Local $aAccelKeys[1][2] = [["{ENTER}", eval($focus)]] If _GUICtrlButton_GetCheck($CB3) Then GUISetAccelerators($aAccelKeys) Global $EnterSubmit = true Else GUISetAccelerators(0) Global $EnterSubmit = false EndIf ; Set the Default Key GUICtrlSetState(eval($focus), $GUI_DEFBUTTON) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE ; write status checkboxes in ini If FileExists($MyFile) Then If _GUICtrlButton_GetCheck($CB3) Then IniWrite($MyFile, "CheckBox", "CB3", 1) Else IniWrite($MyFile, "CheckBox", "CB3", 0) EndIf EndIf ; write focus in ini IniWrite($MyFile, "Focus", "Button", $Focus) GuiDelete($Form5) ExitLoop Case $CB3 If _GUICtrlButton_GetCheck($CB3) Then GUISetAccelerators($aAccelKeys) Global $EnterSubmit = true Else GUISetAccelerators(0) Global $EnterSubmit = false EndIf Case $bsearch $RWSearch1 = GUICtrlRead($RWSearch) $RWSearch2 = StringRegExpReplace($RWSearch1, "(\s+)", "+") ;Focus and Accelerator key $focus = "bsearch" GUICtrlSetState(eval($focus), $GUI_DEFBUTTON) If $EnterSubmit then GUISetAccelerators($aAccelKeys) Else GUISetAccelerators(0) Endif ;End Focus and Accelerator key $url = "https://www.google.com/search?q=" & $RWSearch2 SearchMenuExec() Case $bimages $RWSearch1 = GUICtrlRead($RWSearch) $RWSearch2 = StringRegExpReplace($RWSearch1, "(\s+)", "+") ;Focus and Accelerator key $focus = "bsearch" GUICtrlSetState(eval($focus), $GUI_DEFBUTTON) If $EnterSubmit then GUISetAccelerators($aAccelKeys) Else GUISetAccelerators(0) Endif ;End Focus and Accelerator key $url = "http://images.google.com/images?hl=en&q=" & $RWSearch2 SearchMenuExec() EndSwitch WEnd EndFunc ;==>SearchMenu Func SearchMenuExec() ClipPut($url) ShellExecute($url) EndFunc ;==>SearchMenuExec
- 16 replies
-
- accelerator
- checkbox
-
(and 2 more)
Tagged with: