Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/10/2013 in all areas

  1. What you can do is to start the script from the main script and close it with WinClose() when ever you want. Prerequisite is that the child process is closeable with WinClose -> GUIGetMsg() = $GUI_EVENT_CLOSE. Further on child script you have to use OnAutoItExitRegister() to cleanup resouces on exit. Example: Main.au3 #include <WinAPIProc.au3> #include <Array.au3> $iPid = Run("Child.exe") Local $aData = _WinAPI_EnumProcessWindows($iPid, 0) ConsoleWrite($aData[1][0] & @LF) Sleep(2000) WinClose($aData[1][0]) Child.au3 #NoTrayIcon OnAutoItExitRegister("_Exit") $hGUI = GUICreate("Test") GUISetState() Do If GUIGetMsg() = -3 Then _Exit() Until Not Sleep(1000) Func _Exit() MsgBox(0, "Information", "Exit", 10) Exit EndFunc Compile Child.au3 and start Main.au3. Both should be in same dir. _WinAPI_EnumProcessWindows requires beta version. Br, UEZ
    1 point
  2. How do you call these pink pills in your area? Sure!
    1 point
  3. this is exactly what you are >looking for
    1 point
  4. Isn't reading & writing what a disk is being made for
    1 point
  5. Small language remark dickjones (dabl ou sevn), you wouldn't want to say: "Da li zelite otvoriti direktorij u kojem se nalaze izdane kartice?", what you should be saying is: "Zelite li otvoriti mapu s izdanim karticama?"
    1 point
  6. I have made some changes. Creating a picture control in a function without destroying the previous picture control is just add another one on top of the previous one. So put control creation in global code and update with GUICtrlSetImage. Replace some functions with Gui... equivalents so it remains handling by internal control ids. I left the picture and label control below the GuiSetState though you can move up into the main gui code if you would like to. Differcult for me to understand the language used so I cannot be sure of doing a good fix. #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Compile_Both=y #AutoIt3Wrapper_UseX64=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <DateTimeConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Date.au3> Opt("GUIOnEventMode", 1) HotKeySet("^x", "izlaz1") #region --- CodeWizard generated code Start --- ;SpashImage features: Title=No, Width=900, Height=400, Always On Top SplashImageOn("", "twisterfun.jpg", "900", "400", "-1", "-1", 1) Sleep(1000) SplashOff() #endregion --- CodeWizard generated code Start --- #region ### START Koda GUI section ### Form=C:\Documents and Settings\SlavonskiBrod01\My Documents\My Pictures\Form1.kxf $Form1_1 = GUICreate("Twisterichne kartice", 624, 450, 192, 114, $WS_BORDER) $MenuItem1 = GUICtrlCreateMenu("&Izbornik") $MenuItem4 = GUICtrlCreateMenuItem("&Nova kartica", $MenuItem1) GUICtrlSetOnEvent($MenuItem4, "svenovo1") $MenuItem9 = GUICtrlCreateMenuItem("&Izdane kartice", $MenuItem1) GUICtrlSetOnEvent($MenuItem9, "izdane1") $MenuItem7 = GUICtrlCreateMenu("&O programu") $MenuItem3 = GUICtrlCreateMenuItem("---------------", $MenuItem1) $MenuItem5 = GUICtrlCreateMenuItem("I&zlaz (Ctrl+x)", $MenuItem1) GUICtrlSetOnEvent($MenuItem5, "izlaz1") $imeprezime = GUICtrlCreateInput("", 100, 40, 120, 21, BitOR($ES_UPPERCASE, $ES_OEMCONVERT)) GUICtrlCreateLabel("Ime i prezime:", 20, 43, 80, 15) $adresa = GUICtrlCreateInput("", 100, 66, 120, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_UPPERCASE)) GUICtrlCreateLabel("Adresa:", 20, 69, 80, 15) $posta = GUICtrlCreateInput("", 100, 92, 120, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_NUMBER, $ES_OEMCONVERT)) GUICtrlSetLimit(-1, 5, 5) GUICtrlCreateLabel("Broj pošte:", 20, 95, 80, 15) $grad = GUICtrlCreateInput("", 100, 118, 120, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_UPPERCASE, $ES_OEMCONVERT)) GUICtrlCreateLabel("Grad:", 20, 121, 80, 15) $datum = GUICtrlCreateDate(_NowDate(), 20, 280, 200, 20, $DTS_SHORTDATEFORMAT) $datumx = _NowDate() $datumizd = GUICtrlCreateLabel("Datum izdavanja kartice", 20, 260, 118, 15) $vrijedido = GUICtrlCreateLabel("Vrijedi do:", 20, 320, 50, 17) ;~ $datumizdtxt2 = ControlGetText("Twisterichne kartice", "", "[ID:12]") $vrsta = GUICtrlCreateCombo("", 20, 170, 200, 25) ;~ $vrsta = GUICtrlCreateList("", 312, 272, 113, 110) GUICtrlSetData(-1, "Mjesecna|Polugodisnja|Godisnja", "") GUICtrlSetOnEvent($vrsta, "kartica1") $vrstakar = GUICtrlCreateLabel("Vrsta kartice", 20, 150, 200, 15) $brojkartlabel = GUICtrlCreateLabel("Broj kartice", 20, 200, 200, 15) $brojkart = GUICtrlCreateInput("", 20, 220, 60, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_NUMBER)) $djelatna = GUICtrlCreateLabel("Djelatnik:", 20, 17, 60, 15) $djelatnici = GUICtrlCreateCombo("", 100, 13, 119, 25) GUICtrlSetData(-1, "Anita Tihi|Nikolina Matanovic", "Anita Tihi") $Spremi = GUICtrlCreateButton("Spremi", 20, 368, 75, 25) GUICtrlSetOnEvent($Spremi, "spremi1") GUISetState(@SW_SHOW) #endregion ### END Koda GUI section ### ; *** create these here and not over and over in a function $pic = GUICtrlCreatePic("", 256, 0, 364, 228) $vrijedido2 = GUICtrlCreateLabel('', 80, 320, 100, 17) While 1 Sleep(10) ; *** it is oneventmode so GUIGetMsg will not work ;~ $msg = GUIGetMsg() ;~ Switch $msg ;~ Case $GUI_EVENT_CLOSE ;~ Exit ;~ EndSwitch WEnd Func svenovo1() ;put empty values into fields GUICtrlSetData($imeprezime, '') GUICtrlSetData($adresa, '') GUICtrlSetData($posta, '') GUICtrlSetData($grad, '') GUICtrlSetData($vrsta, '') GUICtrlSetData($brojkart, '') GUICtrlSetImage($pic, "") EndFunc ;==>svenovo1 Func kartica1() Switch GUICtrlRead($vrsta) Case "Mjesecna" GUICtrlSetImage($pic, "mjesecna.jpg") $dodandatum = _DateAdd('M', 1, _NowCalcDate()) $konvdatum = StringSplit($dodandatum, "/") $novidatum = Number($konvdatum[3]) & "." & Number($konvdatum[2]) & "." & StringRight($konvdatum[1], 4) Case "Polugodisnja" GUICtrlSetImage($pic, "polugodisnja.jpg") $dodandatum = _DateAdd('M', 6, _NowCalcDate()) $konvdatum = StringSplit($dodandatum, "/") $novidatum = Number($konvdatum[3]) & "." & Number($konvdatum[2]) & "." & StringRight($konvdatum[1], 4) Case "Godisnja" GUICtrlSetImage($pic, "godisnja.jpg") $dodandatum = _DateAdd('M', 12, _NowCalcDate()) $konvdatum = StringSplit($dodandatum, "/") $novidatum = Number($konvdatum[3]) & "." & Number($konvdatum[2]) & "." & StringRight($konvdatum[1], 4) EndSwitch GUICtrlSetData($vrijedido2, $novidatum) EndFunc ;==>kartica1 Func spremi1() $imeprezimetxt = GUICtrlRead($imeprezime) $adresatxt = GUICtrlRead($adresa) $postatxt = GUICtrlRead($posta) $gradtxt = GUICtrlRead($grad) $brojkarttxt = GUICtrlRead($brojkart) $datumizdtxt = GUICtrlRead($datum); *** $datum instead of $datumizd ? $djelatnicitxt = GUICtrlRead($djelatnici) $vrijedidotxt = GUICtrlRead($vrijedido) FileWrite(@ScriptDir & "\izdane kartice\" & $brojkarttxt & "_" & $imeprezimetxt & ".txt", @CRLF & "PREZIME I IME: " & $imeprezimetxt & @CRLF & "ADRESA: " & $adresatxt & @CRLF & "MJESTO: " & $postatxt & " " & $gradtxt & @CRLF & "BROJ KARTICE: " & $brojkarttxt & @CRLF & "KARTICA IZDANA: " & $datumizdtxt & @CRLF & "VRIJEDI DO: " & $vrijedidotxt & @CRLF & @CRLF & "DJELATNICA: " & $djelatnicitxt) MsgBox(4096, "Podatci", "Podatci spremljeni u txt file pod imenom:" & @CRLF & $brojkarttxt & "_" & $imeprezimetxt & ".txt") EndFunc ;==>spremi1 Func izdane1() ;~ MsgBox(4,"Pregled izdanih kartica","#Region --- CodeWizard generated code Start --- ;MsgBox features: Title=Yes, Text=Yes, Buttons=Yes and No, Icon=Question If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(36,"Pregled izdanih kartica","Da li zelite otvoriti direktorij u kojem se nalaze izdane kartice?") Select Case $iMsgBoxAnswer = 6 ;Yes Run("Explorer.exe " & @ScriptDir & "\izdane kartice") Case $iMsgBoxAnswer = 7 ;No Sleep(100) EndSelect #EndRegion --- CodeWizard generated code End --- EndFunc ;==>izdane1 Func izlaz1() Exit EndFunc ;==>izlaz1
    1 point
×
×
  • Create New...