Jump to content

zetaimmersion

Members
  • Posts

    10
  • Joined

  • Last visited

Everything posted by zetaimmersion

  1. yup. all good. thanks guys. appreciate the quick reply
  2. I have 2 items (a field box and a bypass checkbox). every time the box is checked i need the field to become writable. unchecked is read only displaying some text. this is as far as i got as I am stuck at making it read/write toggle #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <EditConstants.au3> #include <WindowsConstants.au3> $hGUI = GUICreate("Test", 500, 500) Global $hCombo = GUICtrlCreateInput("", 10, 10, 200, 20, BitOR($ES_AUTOHSCROLL,$ES_READONLY)) GUICtrlSetBkColor($hCombo,0xe7e5e5) Global $cbox = GUICtrlCreateCheckbox ("", 40,50,10,20) GUICtrlSetState($cbox, $GUI_Unchecked) GUISetState() Global $sCurrCombo = "" While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cbox If GUICtrlRead($cbox) <> $sCurrCombo Then $sCurrCombo = GUICtrlRead($cbox) GUICtrlSetStyle ($hCombo, $SS_LEFTNOWORDWRAP) GUICtrlSetBkColor($hCombo,0xFFFFFF) MsgBox(0, "Choice", "PLease enter the text") EndIf EndSwitch WEnd
  3. Hi all. I am trying to do 2 things but i cannot seem to get any traction on how to read/implement this idea. Premise: PowerPoint file in C\temp\presentation.pptx that contains on the first slide 2 entries as "<one>" and "<two>" which need to be replaced with "user1" and "user2", then a silent Outlook send mail containing the file with a predefined body and subject. I narrowed it down to COM objects as the Office does not like intrusive open AutoIt functions. I installed OLE/COM Object Viewer to understand how to create the commands but i am still stuck. So far i am trying to user water's code but i suck COM object i was originally trying to modify Dim $oPPT, $oPres $oPPT = ObjCreate("PowerPoint.Application") $oPPT.Visible = True $oPres = $oPPT.Presentations.Read Water's code below (0.1% modified) #include <File.au3> #include "PowerPoint.au3" #include <misc.au3> Global $sFile = "C:\temp\presentation.pptx" Global $sString2Search = "<username>", $sString2Replace = "Password", $iReplaceOnce = 1, $sFullLogFile = "C:\temp\pptxlog.txt" _ProcessPpt($sFile) Func _ProcessPpt($sFile) $oApp = _PPT_PowerPointApp() Local $bChange = False Local $oInterface = $oApp.Presentations Local $oPresentation = $oInterface.Open($sFile, False, False, False) If @error Then _FileWriteLog($sFullLogFile, "E Error " & @error & " opening File " & $sFile) Return SetError(1, 0, 0) EndIf ;it does not even open my file and from here not sure how to read the text and replace it EndFunc ;==>_ProcessPpt
  4. great success! - please close this before i get dumber! ... the final code to get user input looks like this. Hope it helps others. #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> Global $add_GUI = 9999, $del_GUI = 9999 Global $add_add = 9999, $close_add = 9999 Global $del_del = 9999, $close_del = 9999 Global $number_add, $number_del main_window_selection () Func main_window_selection () $main_GUI = GUICreate("Main Gui", 300, 200) Local $add_bttn = GUICtrlCreateButton("Add", 20, 20, 85, 25) Local $del_bttn = GUICtrlCreateButton("Delete", 20, 70, 85, 25) Local $close_bttn = GUICtrlCreateButton("Close", 210, 170, 85, 25) GUISetState() While 1 $get_gui_msg = GUIGetMsg(1) Switch $get_gui_msg[1] Case $main_GUI Switch $get_gui_msg[0] Case $GUI_EVENT_CLOSE, $close_bttn ExitLoop Case $add_bttn GUICtrlSetState($add_bttn, $GUI_DISABLE) ; disable button once pressed add_func () Case $del_bttn GUICtrlSetState($del_bttn, $GUI_ENABLE) ;re-enable buttons once gui2 closed del_func() EndSwitch Case $add_GUI Switch $get_gui_msg[0] Case $GUI_EVENT_CLOSE, $close_add GUIDelete($add_GUI) $add_add = 9999 $close_add = 9999 GUICtrlSetState($add_bttn, $GUI_ENABLE) ;re-enable buttons once gui2 closed Case $add_add ;Local $returned_user_add_input = 9999 MsgBox($MB_SYSTEMMODAL, "Adding", "Display Gui delete input " & GUICtrlRead($number_add)) EndSwitch Case $del_GUI Switch $get_gui_msg[0] Case $GUI_EVENT_CLOSE, $close_del GUIDelete($del_GUI) $del_del = 9999 $close_del = 9999 GUICtrlSetState($del_bttn, $GUI_ENABLE) ;re-enable buttons once gui2 closed Case $del_del MsgBox($MB_SYSTEMMODAL, "Adding", "Display Gui delete input " & GUICtrlRead($number_del)) EndSwitch EndSwitch WEnd EndFunc Func add_func () ; GUI size for the window $add_GUI = GUICreate("Add GUI", 350, 350) ;GUICtrlCreateLabel GUICtrlCreateLabel ("Input Field 1", 130,140) $number_add = GUICtrlCreateInput("", 130, 160, 90) $add_add = GUICtrlCreateButton("Add action", 210, 225) $close_add = GUICtrlCreateButton("Close", 230, 320,50) GUISetState() EndFunc Func del_func () ; GUI size for the window $del_GUI = GUICreate("Delete GUI", 350, 350) ;GUICtrlCreateLabel GUICtrlCreateLabel ("Input Field 1", 130,140) $number_del = GUICtrlCreateInput("", 130, 160, 90) $del_del = GUICtrlCreateButton("Delete action", 210, 225) $close_del = GUICtrlCreateButton("Close", 230, 320,50) GUISetState() EndFunc
  5. for example, the return is 0 and although i know why that is i am not sure how to use GuiCtrlRead to pick up the user input (for at least 1 variable) #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> Global $add_GUI = 9999, $del_GUI = 9999 Global $add_add = 9999, $close_add = 9999 Global $del_del = 9999, $close_del = 9999 main_window_selection () Func main_window_selection () $main_GUI = GUICreate("Main Gui", 300, 200) Local $add_bttn = GUICtrlCreateButton("Add", 20, 20, 85, 25) Local $del_bttn = GUICtrlCreateButton("Delete", 20, 70, 85, 25) Local $close_bttn = GUICtrlCreateButton("Close", 210, 170, 85, 25) GUISetState() While 1 $get_gui_msg = GUIGetMsg(1) Switch $get_gui_msg[1] Case $main_GUI Switch $get_gui_msg[0] Case $GUI_EVENT_CLOSE, $close_bttn ExitLoop Case $add_bttn GUICtrlSetState($add_bttn, $GUI_DISABLE) ; disable button once pressed add_func () Case $del_bttn GUICtrlSetState($del_bttn, $GUI_ENABLE) ;re-enable buttons once gui2 closed del_func() EndSwitch Case $add_GUI Switch $get_gui_msg[0] Case $GUI_EVENT_CLOSE, $close_add GUIDelete($add_GUI) $add_add = 9999 $close_add = 9999 GUICtrlSetState($add_bttn, $GUI_ENABLE) ;re-enable buttons once gui2 closed Case $add_add Local $number_add = "" MsgBox($MB_SYSTEMMODAL, "Adding", "Display Gui add input " & GUICtrlRead($number_add)) EndSwitch Case $del_GUI Switch $get_gui_msg[0] Case $GUI_EVENT_CLOSE, $close_del GUIDelete($del_GUI) $del_del = 9999 $close_del = 9999 GUICtrlSetState($del_bttn, $GUI_ENABLE) ;re-enable buttons once gui2 closed Case $del_del Local $number_del = "" MsgBox($MB_SYSTEMMODAL, "Adding", "Display Gui delete input " & GUICtrlRead($number_del)) EndSwitch EndSwitch WEnd EndFunc Func add_func () ; GUI size for the window $add_GUI = GUICreate("Add GUI", 350, 350) ;GUICtrlCreateLabel GUICtrlCreateLabel ("Input Field 1", 130,140) $number_add = GUICtrlCreateInput("", 130, 160, 90) $add_add = GUICtrlCreateButton("Add action", 210, 225) $close_add = GUICtrlCreateButton("Close", 230, 320,50) GUISetState() EndFunc Func del_func () ; GUI size for the window $del_GUI = GUICreate("Delete GUI", 350, 350) ;GUICtrlCreateLabel GUICtrlCreateLabel ("Input Field 1", 130,140) $number_del = GUICtrlCreateInput("", 130, 160, 90) $del_del = GUICtrlCreateButton("Delete action", 210, 225) $close_del = GUICtrlCreateButton("Close", 230, 320,50) GUISetState() EndFunc
  6. once I open the 2nd gui and click on the add or delete action button, how do i pipe the input box details to the msg box? previously it was easyer as the ctrlread was in the same place as the current guigetmsg for example at the Case $add_add how do i read GUICtrlRead($number_add) from the add_func such that MsgBox($MB_SYSTEMMODAL, "Adding", "Add action button pressed") includes the user's input details from the input box?
  7. next beer is on me man! this is exactly what i wanted.
  8. Think i got something going by changing a few things in the script Thank you Melba23, this is what i wanted. Appreciate the help. #include <GUIConstantsEx.au3> Global $add_GUI = 9999, $RUN_close = 9999 ; declare dummy gui variables main_window_selection () Func main_window_selection () $main_GUI = GUICreate("Main Gui", 300, 200) Local $add_bttn = GUICtrlCreateButton("Add", 20, 20, 85, 25) Local $del_bttn = GUICtrlCreateButton("Delete", 20, 70, 85, 25) Local $close_bttn = GUICtrlCreateButton("Close", 210, 170, 85, 25) GUICtrlSetState($del_bttn, $GUI_ENABLE) GUISetState() While 1 $get_gui_msg = GUIGetMsg(1) Switch $get_gui_msg[1] Case $main_GUI Switch $get_gui_msg[0] Case $GUI_EVENT_CLOSE, $close_bttn ExitLoop Case $add_bttn GUICtrlSetState($add_bttn, $GUI_DISABLE) ; disable buttons once 2nd gui is opeed GUICtrlSetState($del_bttn, $GUI_DISABLE) add_func () Case $del_bttn GUIDelete($add_GUI) GUICtrlSetState($add_bttn, $GUI_DISABLE) ;disable buttons once 2nd gui is opeed GUICtrlSetState($del_bttn, $GUI_DISABLE) delete_func () EndSwitch Case $add_GUI Switch $get_gui_msg[0] Case $GUI_EVENT_CLOSE, $RUN_close GUIDelete($add_GUI) GUICtrlSetState($add_bttn, $GUI_ENABLE) ;re-enable buttons once gui2 closed GUICtrlSetState($del_bttn, $GUI_ENABLE) EndSwitch EndSwitch WEnd EndFunc Func add_func () ; GUI size for the window $add_GUI = GUICreate("Add GUI", 350, 350) ;GUICtrlCreateLabel GUICtrlCreateLabel ("Input Field 1", 130,140) $number_add = GUICtrlCreateInput("", 130, 160, 90) $RUN_add = GUICtrlCreateButton("Delete action", 210, 225) $RUN_close = GUICtrlCreateButton("Close", 230, 320,50) GUISetState() EndFunc Func delete_func () ; GUI size for the window $add_GUI = GUICreate("Delete GUI", 350, 350) ;GUICtrlCreateLabel GUICtrlCreateLabel ("Input Field 1", 130,140) $number_add = GUICtrlCreateInput("", 130, 160, 90) $RUN_add = GUICtrlCreateButton("Add action", 210, 225) $RUN_close = GUICtrlCreateButton("Close", 230, 320,50) GUISetState() EndFunc
  9. Thank you for having me Melba23 previously i did have it run your way as a v0.1 with only 1 action but in my case i have it expanded to something as follows: 1. main window - separate add button and separate delete button 2. depending which button is selected then 2.a add - it perform adding to the ActiveDirectory and other scripts with a predefined form and questions 2.b delete - it performs other sets of questions and deletes ActiveDirectory entries and other things If i can get this working, the modularity of it would allow me to add other automation via another buttons as the script evolves
  10. i am creating 1 main gui and using 2 buttons i would like to create a 2'nd gui (which works fine). Is just i cannot close the subsequent gui windows and i don't know why #include <GUIConstantsEx.au3> Global $gui_dummy = 9999 ; declare dummy gui variables main_window_selection () Func main_window_selection () $main_GUI = GUICreate("Main Gui", 300, 200) Local $add_bttn = GUICtrlCreateButton("Add", 20, 20, 85, 25) Local $del_bttn = GUICtrlCreateButton("Delete", 20, 70, 85, 25) Local $close_bttn = GUICtrlCreateButton("Close", 210, 170, 85, 25) GUISetState() While 1 $get_gui_msg = GUIGetMsg(1) Switch $get_gui_msg[1] Case $main_GUI Switch $get_gui_msg[0] Case $GUI_EVENT_CLOSE ExitLoop Case $add_bttn GUICtrlSetState($add_bttn, $GUI_DISABLE) ; disable button wonce pressed add_func () Case $del_bttn GUICtrlSetState($del_bttn, $GUI_DISABLE) delete_func () Case $close_bttn ExitLoop EndSwitch Case $gui_dummy Switch $get_gui_msg[0] Case $GUI_EVENT_CLOSE GUIDelete($gui_dummy) GUICtrlSetState($add_bttn, $GUI_ENABLE) ;re-enable buttons once gui2 closed GUICtrlSetState($del_bttn, $GUI_ENABLE) EndSwitch EndSwitch WEnd EndFunc Func delete_func () ; GUI size for the window $delete_gui = GUICreate("Deletion GUI", 350, 350) ;GUICtrlCreateLabel GUICtrlCreateLabel ("Input Field 1", 30,40) $number_delete = GUICtrlCreateInput("", 30, 60, 90) $RUN_delete = GUICtrlCreateButton("Delete action", 210, 225) $RUN_close = GUICtrlCreateButton("Close", 230, 320,50) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $RUN_close ExitLoop Case $RUN_delete ; do other fucntions or checks and/or buttons EndSwitch WEnd EndFunc Func add_func () ; GUI size for the window $add_gui = GUICreate("Add GUI", 350, 350) ;GUICtrlCreateLabel GUICtrlCreateLabel ("Input Field 1", 130,140) $number_add = GUICtrlCreateInput("", 130, 160, 90) $RUN_add = GUICtrlCreateButton("Delete action", 210, 225) $RUN_close = GUICtrlCreateButton("Close", 230, 320,50) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $RUN_close ExitLoop Case $RUN_add ; do other fucntions or checks and/or buttons EndSwitch WEnd EndFunc
×
×
  • Create New...