Sign in to follow this  
Followers 0
mdwerne

Creating a ComboBox with values for schtasks /ST

5 posts in this topic

#1 ·  Posted (edited)

So I apologize in advance for the horrible mess you see below. While there may be many issues with my code, I only need help with one part. This GUI is an interface for customers to install software pushed via SCCM. While I have Continue and Abort buttons working just fine, I'm trying to implement a scheduler that will allow the customer to defer the install for later in the day up until 11:30pm.

I'd like to have the combobox display the current time (12 hour format) and then all hours (both top and bottom of the hour) until 11:30pm. So if they check the "Defer" box, select a time from the dropdown (such as 8:30pm) and click "Go"...the time chosen will be sent to my 'unfinished' Scheduler function which will then create a task to be executed at the specified time. I hope that all makes some sense.

So again, the only thing I would like some help with is how to correctly create the combobox with the possible values based on the current local time. I should be able to figure out the rest.

Thanks for any suggestions,

-Mike

Edit:...Oops, if the moderator would like to move this post to the "Graphical User Interface (GUI) Help and Support", I wasn't thinking when I hit submit...sorry.

#include "_XMLDomWrapper.au3"
#include <Constants.au3>
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Date.au3>

;Global $sFile = (@ScriptDir & "\Config.xml")
Global $hGUI, $FormTitle, $RTFName, $ProgramName, $TrayTip, $ShutdownTimer, $ParamName, $AbortAllowed, $AbortButtonName, $ContinueButtonName, $GoButton, $Scheduler
Global $hRichEdit, $ExitCode, $Width, $Height, $sHours

If @DesktopWidth > 1024 Then
    $Width = 1024
Else
    $Width = @DesktopWidth
EndIf

If @DesktopHeight > 768 Then
    $Height = 768
Else
    $Height = @DesktopHeight
EndIf

;_XMLFileOpen($sFile)

$FormTitle = _XMLGetAttrib("/MessageInfo/Title", "FormTitle")
$RTFName = _XMLGetAttrib("/MessageInfo/Display", "RTFName")
$ProgramName = _XMLGetAttrib("/MessageInfo/Program", "ProgramName")
$TrayTip = _XMLGetAttrib("/MessageInfo/TrayTip", "TrayTip")
$ShutdownTimer = _XMLGetAttrib("/MessageInfo/ShutdownTimer", "ShutdownTimer")
$ParamName = _XMLGetAttrib("/MessageInfo/Param", "ParamName")
$AbortAllowed = _XMLGetAttrib("/MessageInfo/Abort", "AbortAllowed")
$AbortButtonName = _XMLGetAttrib("/MessageInfo/ABN", "AbortButtonName")
$ContinueButtonName = _XMLGetAttrib("/MessageInfo/CBN", "ContinueButtonName")
$Scheduler = _XMLGetAttrib("/MessageInfo/Sched", "Scheduler")

_Main()

; Functions
Func _Main()
    Local $msg, $AbortButton, $ContinueButton, $ScheduleBox
    $hGUI = GUICreate($FormTitle, $Width - 20, $Height - 100, -1, 10, -1)
    $hRichEdit = _GUICtrlRichEdit_Create($hGUI, "", 10, 10, $Width - 40, $Height - 150, BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
    ;GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
    _GUICtrlRichEdit_SetEventMask($hRichEdit, $ENM_LINK)
    _GUICtrlRichEdit_AutoDetectURL($hRichEdit, True)
    $ContinueButton = GUICtrlCreateButton($ContinueButtonName, $Width - 500, $Height - 133, 100, 25)
    GUICtrlSetFont($ContinueButton, 10, 800, 0, "Tahoma")
    $AbortButton = GUICtrlCreateButton($AbortButtonName, $Width - 390, $Height - 133, 100, 25)
    GUICtrlSetFont($AbortButton, 10, 800, 0, "Tahoma")
    $ScheduleBox = GUICtrlCreateCheckbox("Defer", $Width - 280, $Height - 133, 75, 25)
    GUICtrlSetFont($ScheduleBox, 10, 800, 0, "Tahoma")

    Global $hCombo = GUICtrlCreateCombo("", $Width - 200, $Height - 132, 90, 25)
    GUICtrlSetData(-1, @HOUR + 1 & "|" & @HOUR + 2 & "|" & @HOUR + 3 & "|" & @HOUR + 4 & "|" & @HOUR + 5 & "|" & @HOUR + 6 & "|" & @HOUR + 7 & "|" & @HOUR + 8)

    $GoButton = GUICtrlCreateButton("Go", $Width - 75, $Height - 133, 50, 25)
    GUICtrlSetFont($GoButton, 10, 800, 0, "Tahoma")

    GUISetState()
    _GUICtrlRichEdit_StreamFromFile($hRichEdit, $RTFName)
    _GUICtrlRichEdit_SetReadOnly($hRichEdit)
    _GUICtrlRichEdit_GotoCharPos($hRichEdit, 0)
    MouseClick("main", @DesktopWidth / 2, @DesktopHeight / 2, 0)
    Sleep(1000)
    ;GUISetState(@SW_MINIMIZE)
    GUISetState(@SW_SHOW)

    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $ContinueButton
                Opt("TrayIconHide", 1)
                GUISetState(@SW_HIDE)
                $ExitCode = RunWait(@ScriptDir & "\" & $ProgramName)
                _GUICtrlRichEdit_Destroy($hRichEdit)
                ;MsgBox(0, "Program Exit Code", $ExitCode)
                Exit $ExitCode
            Case $msg = $GoButton
                Opt("TrayIconHide", 1)
                GUISetState(@SW_HIDE)
                ;Scheduler()
                _GUICtrlRichEdit_Destroy($hRichEdit)
                Exit
            Case $msg = $GUI_EVENT_CLOSE Or $msg = $AbortButton
                _GUICtrlRichEdit_Destroy($hRichEdit)
                Exit -1
        EndSelect
    WEnd
EndFunc   ;==>_Main

;~ Func Scheduler()
;~  Local $sXtra_Parms
;~  Local $sDateTime = _DateAdd('h', $sHours, _NowCalc())
;~  Local $sStartDate = StringMid($sDateTime, 6, 3) & StringMid($sDateTime, 9, 2) & "/" & StringLeft($sDateTime, 4)
;~  $sStartTime = StringRight($sDateTime, 8)

;~  If @OSVersion = "WIN_VISTA" Or @OSVersion = "WIN_7" Or @OSVersion = "WIN_8" Then $sXtra_Parms = " /Z /V1"

;~  Local $QueryTask = Run("SCHTASKS /QUERY /TN " & $FormTitle, "", @SW_HIDE, $STDOUT_CHILD)

;~  Local $line = ""

;~  While 1
;~      $line &= StdoutRead($QueryTask)
;~      If @error Then ExitLoop
;~  WEnd

;~  If $line = "" Then
;~      $sCmd = 'SCHTASKS /CREATE /SC ONCE /TN ' & $FormTitle & ' /TR ' & $ProgramName & ' /SD ' & $sStartDate & ' /ST ' & $sStartTime & ' /RU SYSTEM' & $sXtra_Parms
;~      Run($sCmd, "", @SW_HIDE)
;~      ;MsgBox(0, "", $sCmd) ; for testing
;~  Else
;~      $sCmd = 'SCHTASKS /CHANGE /TN ' & $FormTitle & ' /SD ' & $sStartDate & ' /ST ' & $sStartTime
;~      Run($sCmd, "", @SW_HIDE)
;~      ;MsgBox(0, "", $sCmd) ; for testing
;~  EndIf
;~ EndFunc   ;==>Scheduler

Here is the Config.xml file if you're interested.

<?xml version="1.0"?>
<MessageInfo>
    <Title FormTitle="EMET 4.1"/>
    <Display RTFName="RichText.rtf"/>
    <Program ProgramName="Emet installer.exe /sccm"/>
    <TrayTip TrayTip="EMET 4.1 Available"/>
    <ShutdownTimer ShutdownTimer="300000"/>
    <Param ParamName=""/>
    <Abort AbortAllowed="Y" />
    <ABN AbortButtonName="Not Now"/>
    <CBN ContinueButtonName="Continue"/>
    <Sched Scheduler="0"/>
</MessageInfo>
Edited by mdwerne

Share this post


Link to post
Share on other sites

Anyone have any suggestions on this, I've been poking at this for a couple days and not really making any progress.

If the mess above is too confusing, I can simplify and restate.

Thanks for taking a look,

-Mike

Share this post


Link to post
Share on other sites

Okay...I was left to my own devices long enough and actually came up with something, not pretty, but it seems to work.

(?) My question now is, where is the "0" coming from at the end of my ComboBox, and do I remove the "0". (?)

#include <GuiComboBox.au3>
#include <GUIConstantsEx.au3>
#include <Date.au3>

Global $CurrentTime, $i, $AMPM

If @HOUR > 12 Then
    $AMPM = "PM"
ElseIf @HOUR = 0 Then
    $AMPM = "AM"
Else
    $AMPM = "AM"
EndIf

GUICreate("ComboTest", 200, 40)
Global $hCombo = GUICtrlCreateCombo("New install time:", 10, 10, 180, 25)
GUICtrlSetData(-1, GetTimes())
GUISetState()
While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd

Func GetTimes()
    Local $CurrentHour = StringTrimRight(_NowTime(), 9)
    For $i = $CurrentHour To 11 Step +1
        _GUICtrlComboBox_BeginUpdate($hCombo)
        _GUICtrlComboBox_InsertString($hCombo, $i & ":00 " & $AMPM, -1)
        _GUICtrlComboBox_InsertString($hCombo, $i & ":30 " & $AMPM, -1)
        _GUICtrlComboBox_EndUpdate($hCombo)
    Next
EndFunc   ;==>GetTimes

Thanks for your time,

-Mike

Share this post


Link to post
Share on other sites

GetTimes() returns 0 so do not use GUICtrlSetData to add the return value of 0 to the combo.

Updated code

#include <GuiComboBox.au3>
#include <GUIConstantsEx.au3>
#include <Date.au3>

Global $CurrentTime, $i, $AMPM

If @HOUR > 12 Then
    $AMPM = "PM"
ElseIf @HOUR = 0 Then
    $AMPM = "AM"
Else
    $AMPM = "AM"
EndIf

GUICreate("ComboTest", 200, 40)
Global $hCombo = GUICtrlCreateCombo("New install time:", 10, 10, 180, 25)
; function returns value of 0
GetTimes()
GUISetState()
While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd

Func GetTimes()
    Local $CurrentHour = StringTrimRight(_NowTime(), 9)
    _GUICtrlComboBox_BeginUpdate($hCombo)
    For $i = $CurrentHour To 11
        _GUICtrlComboBox_InsertString($hCombo, $i & ":00 " & $AMPM, -1)
        _GUICtrlComboBox_InsertString($hCombo, $i & ":30 " & $AMPM, -1)
    Next
    _GUICtrlComboBox_EndUpdate($hCombo)
EndFunc   ;==>GetTimes
1 person likes this

Share this post


Link to post
Share on other sites

Thanks MHz, your correction and code clean up helped me learn a bit more.

All the best!

-Mike

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

  • Similar Content

    • Grasoft
      By Grasoft
      Greetings everyone,
      I'm writing a software that edit an ini file section by section with adding/renaming abilities
      but whenever I manually change the combobox to value other than constducted previously, I cannot get this value.
      THIS is a clean version of the code:
      #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GuiStatusBar.au3> #include <GuiEdit.au3> #include <MsgBoxConstants.au3> #Region ### START Koda GUI section ### Form=C:\Program Files (x86)\AutoIt3\SciTE\Koda\Forms\QuickRepEditList7.kxf $SecMgr = GUICreate("Sections Manager", 1159, 690) GUISetFont(12, 800, 0, "MS Sans Serif") $EditSec = GUICtrlCreateEdit("", 45, 45, 1090, 644, BitOR($ES_AUTOVSCROLL, $ES_AUTOHSCROLL, $ES_WANTRETURN, $WS_HSCROLL, $ES_NOHIDESEL)) $Edit2 = GUICtrlCreateEdit("", 11, 45, 33, 617, BitOR($ES_RIGHT, $ES_READONLY, $ES_WANTRETURN)) GUICtrlSetData(-1, StringFormat(" 1:\r\n 2:\r\n 3:\r\n 4:\r\n 5:\r\n 6:\r\n 7:\r\n 8:\r\n 9:\r\n10:\r\n11:\r\n12:\r\n13:\r\n14:\r\n15:\r\n16:\r\n17:\r\n18:\r\n19:\r\n20:\r\n21:\r\n22:\r\n23:\r\n24:\r\n25:\r\n26:\r\n27:\r\n28:\r\n29:\r\n30:")) $Label1 = GUICtrlCreateLabel("Select Section:", 7, 13, 126, 24) GUICtrlSetFont(-1, 11, 800, 0, "MS Sans Serif") $Savesec = GUICtrlCreateButton("Save Changes", 375, 7, 129, 33) $NewSec = GUICtrlCreateButton("New Section", 700, 7, 121, 33) $SecDwn = GUICtrlCreateButton("Section Down", 830, 7, 137, 33) $SecUp = GUICtrlCreateButton("Section Up", 980, 7, 129, 33) $copystrs = GUICtrlCreateButton("*******", 507, 7, 73, 33) GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") $HeavySep = GUICtrlCreateButton("====", 581, 7, 73, 33) GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") Global $SecSel Global $secno Global $secn = "NULLz" Global $sFilePathtemp Global $aArray Global $SecNames Global $secnnew Global $ssecn $SecSel = GUICtrlCreateCombo("", 110, 10, 257, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) queysecs() Filledit() GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $secno=GUICtrlRead($SecSel) $changed=0 While 1 $secn = GUICtrlRead($SecSel) $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE saveeditedmsg() Exit Case $SecSel $secno=GUICtrlRead($SecSel) queysecs() Filledit() Case $Savesec saveeditedmsg() queysecs() Case $NewSec Case $SecDwn Case $SecUp Case $copystrs ClipPut("**************************************************************************************************************************************************************") Case $HeavySep ClipPut("==============================================================================================================================================================") EndSwitch WEnd Func queysecs();query section names $sFilePath = @ScriptDir & "\" & "Txt_Reps.ini" $aArray = IniReadSectionNames($sFilePath) $SecNames = $aArray[1] If $secn = "NULLz" Then $secn = $aArray[1] EndIf If Not @error Then For $i = 2 To $aArray[0] $SecNames = $SecNames & "|" & $aArray[$i] Next GUICtrlSetData($SecSel, "", "") GUICtrlSetData($SecSel, $SecNames, $secn) $secno = $secn EndIf EndFunc ;==>queysecs Func Filledit(); transfer section values on the edit box GUICtrlSetData($EditSec, "") $sFilePath = @ScriptDir & "\" & "Txt_Reps.ini" For $i = 1 To 30 $sRead = IniRead($sFilePath, $secn, $i, "") GUICtrlSetData($EditSec, $sRead & @CRLF, 1) Next GUISetState(@SW_SHOW) EndFunc ;==>Filledit Func saveeditedmsg(); save or rename modified section If $secn <> $secno Then $iMsgBoxAnswer = MsgBox(3, "NEW/RENAME", "Press YES to Add this as NEW section" & @CRLF & "Press NO to rename and save this section from " & $secno & "To" & $secn) Select Case $iMsgBoxAnswer = 6 ;YES $secn = $secno save($secn) $secn = GUICtrlRead($SecSel) $secno = $secn Case 7 ;NO $sFilePath = @ScriptDir & "\" & "Txt_Reps.ini" IniRenameSection($sFilePath, $secno, $secn) save($secn) $secn = GUICtrlRead($SecSel) $secno = $secn EndSelect Else $iMsgBoxAnswer = MsgBox(4, "Do you want to save changes to this section", "Save Section: " & $secn) Select Case $iMsgBoxAnswer = 6 ;yes save($secn) EndSelect EndIf EndFunc ;==>saveeditedmsg ;MsgBox(4, "Do you want to add this to Database?",$secn) Func save($ssecn); save edit control to a file and then rewrite modified values by line order. $sFilePathtemp = FileOpen(@ScriptDir & "\" & "tempo.quickrep", $FO_READ + $FO_OVERWRITE + $FO_CREATEPATH + $FO_UTF8) $sFilePath = @ScriptDir & "\" & "Txt_Reps.ini" FileWrite($sFilePathtemp, GUICtrlRead($EditSec)) $sFilePathtemp = FileOpen(@ScriptDir & "\" & "tempo.quickrep", $FO_READ + $FO_UTF8) For $i = 1 To 30 $sRead = FileReadLine($sFilePathtemp, $i) IniWrite($sFilePath, $ssecn, $i, $sRead) Next GUISetState(@SW_SHOW) EndFunc ;==>save And this is with som test msg boxes to know how to get it
      #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GuiStatusBar.au3> #include <GuiEdit.au3> #include <MsgBoxConstants.au3> #Region ### START Koda GUI section ### Form=C:\Program Files (x86)\AutoIt3\SciTE\Koda\Forms\QuickRepEditList7.kxf $SecMgr = GUICreate("Sections Manager", 1159, 690) GUISetFont(12, 800, 0, "MS Sans Serif") $EditSec = GUICtrlCreateEdit("", 45, 45, 1090, 644, BitOR($ES_AUTOVSCROLL, $ES_AUTOHSCROLL, $ES_WANTRETURN, $WS_HSCROLL, $ES_NOHIDESEL)) $Edit2 = GUICtrlCreateEdit("", 11, 45, 33, 617, BitOR($ES_RIGHT, $ES_READONLY, $ES_WANTRETURN)) GUICtrlSetData(-1, StringFormat(" 1:\r\n 2:\r\n 3:\r\n 4:\r\n 5:\r\n 6:\r\n 7:\r\n 8:\r\n 9:\r\n10:\r\n11:\r\n12:\r\n13:\r\n14:\r\n15:\r\n16:\r\n17:\r\n18:\r\n19:\r\n20:\r\n21:\r\n22:\r\n23:\r\n24:\r\n25:\r\n26:\r\n27:\r\n28:\r\n29:\r\n30:")) $Label1 = GUICtrlCreateLabel("Select Section:", 7, 13, 126, 24) GUICtrlSetFont(-1, 11, 800, 0, "MS Sans Serif") $Savesec = GUICtrlCreateButton("Save Changes", 375, 7, 129, 33) $NewSec = GUICtrlCreateButton("New Section", 700, 7, 121, 33) $SecDwn = GUICtrlCreateButton("Section Down", 830, 7, 137, 33) $SecUp = GUICtrlCreateButton("Section Up", 980, 7, 129, 33) ;$LineNo = GUICtrlCreateInput("LineNo", 664, 7, 65, 28) $copystrs = GUICtrlCreateButton("*******", 507, 7, 73, 33) GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") $HeavySep = GUICtrlCreateButton("====", 581, 7, 73, 33) GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") Global $SecSel Global $secno Global $secn = "NULLz" Global $sFilePathtemp Global $aArray Global $SecNames Global $secnnew Global $ssecn $SecSel = GUICtrlCreateCombo("", 110, 10, 257, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) queysecs() Filledit() GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $secno=GUICtrlRead($SecSel) $changed=0 While 1 $secn = GUICtrlRead($SecSel) ;If $secn <> $secno and $changed=0 Then ; $secns = $secn ; $changed=1 ;EndIf $nMsg = GUIGetMsg() ;MsgBox(4, "TEST1?", $secn) Switch $nMsg Case $GUI_EVENT_CLOSE saveeditedmsg() Exit Case $SecSel ;MsgBox(4, "TEST?", GUICtrlRead($SecSel)) ;MsgBox(4, "TEST1?", $secns) ;MsgBox(4, "TEST2?", $secn) $secno=GUICtrlRead($SecSel) ;saveeditedmsg() queysecs() Filledit() ;$changed=0 Case $Savesec saveeditedmsg() queysecs() Case $NewSec Case $SecDwn Case $SecUp Case $copystrs ClipPut("**************************************************************************************************************************************************************") Case $HeavySep ClipPut("==============================================================================================================================================================") EndSwitch ; MsgBox(4, "TEST2?", $secn) WEnd Func queysecs();query section names $sFilePath = @ScriptDir & "\" & "Txt_Reps.ini" $aArray = IniReadSectionNames($sFilePath) $SecNames = $aArray[1] ; MsgBox(4, "test3?", $secn) If $secn = "NULLz" Then $secn = $aArray[1] EndIf If Not @error Then For $i = 2 To $aArray[0] $SecNames = $SecNames & "|" & $aArray[$i] Next GUICtrlSetData($SecSel, "", "") GUICtrlSetData($SecSel, $SecNames, $secn) $secno = $secn ;MsgBox(4, "test4?", $secn) EndIf EndFunc ;==>queysecs Func Filledit(); transfer section values on the edit box GUICtrlSetData($EditSec, "") $sFilePath = @ScriptDir & "\" & "Txt_Reps.ini" For $i = 1 To 30 $sRead = IniRead($sFilePath, $secn, $i, "") GUICtrlSetData($EditSec, $sRead & @CRLF, 1) Next GUISetState(@SW_SHOW) EndFunc ;==>Filledit Func saveeditedmsg(); save or rename modified section If $secn <> $secno Then $iMsgBoxAnswer = MsgBox(3, "NEW/RENAME", "Press YES to Add this as NEW section" & @CRLF & "Press NO to rename and save this section from " & $secno & "To" & $secn) Select Case $iMsgBoxAnswer = 6 ;YES $secn = $secno save($secn) $secn = GUICtrlRead($SecSel) $secno = $secn Case 7 ;NO $sFilePath = @ScriptDir & "\" & "Txt_Reps.ini" IniRenameSection($sFilePath, $secno, $secn) save($secn) $secn = GUICtrlRead($SecSel) $secno = $secn EndSelect Else $iMsgBoxAnswer = MsgBox(4, "Do you want to save changes to this section", "Save Section: " & $secn) Select Case $iMsgBoxAnswer = 6 ;yes save($secn) EndSelect EndIf EndFunc ;==>saveeditedmsg ;MsgBox(4, "Do you want to add this to Database?",$secn) Func save($ssecn); save edit control to a file and then rewrite modified values by line order. $sFilePathtemp = FileOpen(@ScriptDir & "\" & "tempo.quickrep", $FO_READ + $FO_OVERWRITE + $FO_CREATEPATH + $FO_UTF8) $sFilePath = @ScriptDir & "\" & "Txt_Reps.ini" FileWrite($sFilePathtemp, GUICtrlRead($EditSec)) $sFilePathtemp = FileOpen(@ScriptDir & "\" & "tempo.quickrep", $FO_READ + $FO_UTF8) For $i = 1 To 30 $sRead = FileReadLine($sFilePathtemp, $i) IniWrite($sFilePath, $ssecn, $i, $sRead) Next GUISetState(@SW_SHOW) EndFunc ;==>save The ini file withthe au3 attached
      This is how I want: when the user changes the combo, the script will check the text combo. In case of changed text it will ask user if I should rename or add it as a new section and then save. If not changed the text of combo it will ask to save only.
      IF NOT possible, Will it possible with _GUICtrlComboBox__GUICtrlComboBoxEx_Create or _GUICtrlComboBoxEx_Create or not
       
      THANK you very much in advance
      QuickSecEdit.zip
    • computergroove
      By computergroove
      I've made a form in Koda where I make a list of 3 user definable elements that I want to be able to replicate with a button press so a user can add data that can be used as part of the program. 
      #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form=D:\Carbonite Important\0 - Programing\Scite and Autoit\Koda 1.7.3.0\Forms\Mileage Estimator.kxf $Form1 = GUICreate("Save Project", 614, 1126, 298, 141) $Location = GUICtrlCreateInput("Location", 40, 112, 345, 21) $Distance = GUICtrlCreateInput("Distance", 400, 112, 89, 21) $AddLocation = GUICtrlCreateButton("AddLocation", 288, 80, 97, 25) $Label1 = GUICtrlCreateLabel("Location", 40, 88, 45, 17) $Label2 = GUICtrlCreateLabel("Distance", 400, 88, 46, 17) $HomeBase = GUICtrlCreateInput("HomeBase", 312, 32, 121, 21) $LeapYear = GUICtrlCreateCheckbox("LeapYear", 464, 32, 17, 17) $Label3 = GUICtrlCreateLabel("Leap Year?", 488, 32, 59, 17) $Variance = GUICtrlCreateInput("Variance", 504, 112, 81, 21) $Label4 = GUICtrlCreateLabel("Variance", 504, 88, 46, 17) $Label5 = GUICtrlCreateLabel("Home Base", 312, 8, 59, 17) $Button1 = GUICtrlCreateButton("Button1", 144, 56, 1, 57) $Save = GUICtrlCreateButton("Save Project", 40, 16, 121, 25) $Load = GUICtrlCreateButton("Load Project", 176, 16, 121, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Form1 Case $AddLocation EndSwitch WEnd I want to press the "add location" button and have the fields {Location, Distance and variance} create a new blank record located under the existing 3 input boxes. Since the fields can number over 30 locations in some examples I am thinking about having these items in a scrolling window. What is the best way to do this and can auto it add a variable while running by pressing a button?
    • XaelloNegative
      By XaelloNegative
      Hi,
      I made a small blunder with my code. I created the GUI under 1920x1080 resolution however, my user is configured to ONLY 1080x720 and cannot go any further than that.
      What do you guys think is the best way to correct this one? Resolution mathematics is something that came to mind however I do not have access to his PC to check  from time to time if  my estimation is correct and the resolution on my PC doesn't go down to 1080x720.
      Please help.
      ~XN~
    • KING_NK
      By KING_NK
      #RequireAdmin
      Global $x=0
      Global $y=0
      Func Start()
      While 1
      AutoItSetOption('MouseCoordMode',0)
      AutoItSetOption('SendKeyDelay',10)
      WinActivate('XXX')
      MouseClick('Primary',852,62,1,10)
      sleep(2200)
      MouseClick('Primary',880,196,1,10)
      Send('260',0)      -----------------------> $a as 260
      MouseClick('Primary',880,196,1,0)
      sleep(2200)
      MouseClick('Primary',1019,194,1,10)
      Sleep(2200)
      Send('98',0) ------------------------->$b as 98
      sleep(1000)
      Wend
      EndFunc
       
       
      I want to use Different number in every loop in the place of $a and  $b.
      Is it possble?If it possible Kindly help me
    • davidacrozier
      By davidacrozier
      Hello all ~
      I am running an autoit script on Windows 10 inside VMware Workstation 12 Pro version 12.5.2.  Technically I am remoting into ESXi which has a Domain Controller (DC), WebServer, FilServer, Windows 10, etc.  Using the GUI (i.e. running explorer.exe) I am able to open several different folders successfully.  The desktop, documents, USB external all open without issue.  The network share opening gives me issues.  Whenever I attempt to open \\filserver\users\user\sharedfolder I get the documents folder instead.  I understand that the documents folder is the default for explorer.  I have also attempted to use the letter drive mapped to the network share (Z:) and receive the same result.  When I run this script on Windows 10 alone without  the VM or the ESXi I am able to open the network share without problems.  I have tried to use the net use command to designate a letter M: to the network share folder prior to running the script.  This did not work for me.  
      One additional avenue I think might work is to use the systreeview321 and _GUICtrlTreeView_FindItem to step through the tree looking for the network share.  Once found,  double click on it and see if that opens the shared network folder.  I can click inside the VM with my mouse on the network share and it opens just fine.  Not sure if running up against GUI issues, or permission issues, or what?
      Thanks in advance,
      Davida Crozier
      TestNetworkShare.au3
      This script is a subset of a much larger program, but it illustrates what I am dealing with.