Jump to content

goss34

Active Members
  • Posts

    118
  • Joined

  • Last visited

goss34's Achievements

Adventurer

Adventurer (3/7)

1

Reputation

  1. Not a problem, noted. Thanks again
  2. It certainly does Melba, thank you very much, i have managed to get what i want going now and can continue with the script. Cheers Dan
  3. Hi Teks, If you could post an example that would be great.
  4. Hi Teks, Is that possible when i want the gui to constantly refresh every 60 seconds without the user clicking any buttons on the gui? From what i have just read i cant see an example of how to do that. I only have the sleep in to stop the CPU maxing out. Cheers Dan
  5. Hi Computergroove, The help file for timerinit just appears to use a sleep, would that not just give me the same problem whereby while the sleep is active the gui would be unresponsive? Ta Dan
  6. Hi Guys, I am sure 99% of the members here will know the answer to this but I am having a problem figuring it out, iv searched the forums but cant find what i am after. Essentially I am trying to write a little monitor that refreshes a gui every minute, currently the gui reads an ini and displays it on the gui as desired, it also updates the gui constantly but if i extend the sleep timer in my while loop then i cannot exit the gui ... i know this isnt the right way to do it but i am unsure how to do it correctly. Heres my current code: #include <GUIConstantsEx.au3> Global $iL = 10 , $iT = 10 DetectDate() Func DetectDate() Global $Datestamp = @MDAY & "/" & @MON & "/" & @YEAR EndFunc ;==>DetectDate CreateGui() Func CreateGui() Global $GUI = GUICreate("BACS Monitor", 600, 600) EndFunc ;==>CreateGui Func ShowGui() Global $INI = ".\Test.ini" Global $aArray = IniReadSection($INI, $Datestamp) Local $DateLabel = GUICtrlCreateLabel($datestamp, 10,10) For $i = 1 To $aArray[0][0] Global $Status = IniRead($INI, $aArray[$i][0], "Status", "") If $Status = "Red" Then $Icon = "C:\Red.ico" ElseIf $Status = "Green" Then $Icon = "C:\Green.ico" EndIf GUICtrlCreateLabel($aArray[$i][0], $iL + 10 , $iT + 20) GUICtrlCreateIcon($Icon, -1, $iL + 100, $iT + 20,15,15) $iT = $iT + 20 Next GUISetState(@SW_SHOW, $GUI) Global $iL = 10 , $iT = 10 EndFunc ;==>ShowGui While 1 ; Loop until the user exits. Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case Else ShowGui() EndSwitch Sleep(50) WEndAt the moment the ShowGui function just runs and runs which is fine but its too fast, how do i slow it down to run that function every 60 seconds without making the GUI hang? By hang i mean the red cross (top right) is unresponsive which i assume is because the function is running so the GuiGetMsg is no longer monitoring for the click of the red cross. Thanks Dan
  7. Linking you to old thread i had issues getting the data from the virutal listview, hope it helps.
  8. Its hard to make sense of what you want to achieve and your code (for me at least) but i think this is what you want based on your code: #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 615, 437, 192, 124) $Input1 = GUICtrlCreateInput("Input1", 32, 32, 129, 21) $Input2 = GUICtrlCreateInput("lose", 216, 32, 153, 21) $Input3 = GUICtrlCreateInput("", 64, 112, 121, 21) $Label1 = GUICtrlCreateLabel("baca", 32, 120, 28, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 ;aaa() sleep(5000) bbb() $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func aaa() $baca = guictrlread($Input1) ConsoleWrite("Isi dari Input1 adalah : "&$baca&@CRLF) ;sleep(1000) EndFunc Func bbb() $baca = guictrlread($Input2, 1) if $baca = "AAAA" Then For $i = 5 To 1 Step -1 ConsoleWrite("Isi dari Input2 adalah : REPEATTTTTTTT"&@CRLF) $recheck = guictrlread($Input2, 1) If $recheck = "Input2" Then MsgBox(0, "", "Changed detected - " & $recheck) Exit EndIf sleep(1000) check() Next Elseif $baca = "Input2" Then ConsoleWrite("Isi dari Input2 adalah : EXITTTTT"&$baca&@CRLF) Else EndIf Exit sleep(1000) EndFunc FUnc check() aaa() EndFunc
  9. No problem Efo, its nice to be able to help someone else for a change rather than someone always helping me
  10. So here's an example for you to follow, this time you don't need test.doc, it will populate then format it as you wanted. Hope it helps. #include <Word.au3> ; Create application object Local $oRange, $oWord = _Word_Create() ; Open the test document Local $oDoc = _Word_DocAdd($oWord) ; Set default alignment 0= Left, 1 = Centre, 2 = Right Local $wdAlignParagraphJustify = 0 ; Select start of doc as range $oRange = _Word_DocRangeSet($oDoc, -1) ; Insert text before selected range ^^ $vRange = $oDoc.Range $vRange.InsertBefore("I am line 1" & @CR & "I am line 2" & @CR & "I am line 3") ; Move line 1 $oRange = _Word_DocRangeSet($oDoc, -1, $wdParagraph, 0, Default, 2) Local $wdAlignParagraphJustify = 2 $oRange.ParagraphFormat.Alignment = $wdAlignParagraphJustify ; Move line 2 $oRange = _Word_DocRangeSet($oDoc, 0, $wdParagraph, 1, Default, 2) Local $wdAlignParagraphJustify = 1 $oRange.ParagraphFormat.Alignment = $wdAlignParagraphJustify
  11. Tested on 2013 and opened as read only - try this: #include <Word.au3> ; Create application object Local $oRange, $oWord = _Word_Create() ; Open the test document Local $oDoc = _Word_DocOpen($oWord, @DesktopDir & "\Test.docx", Default, Default, False) ; Set default alignment 0= Left, 1 = Centre, 2 = Right Local $wdAlignParagraphJustify = 0 ; Move line 1 $oRange = _Word_DocRangeSet($oDoc, -1, $wdParagraph, 0, Default, 2) Local $wdAlignParagraphJustify = 2 $oRange.ParagraphFormat.Alignment = $wdAlignParagraphJustify ; Move line 2 $oRange = _Word_DocRangeSet($oDoc, 0, $wdParagraph, 1, Default, 2) Local $wdAlignParagraphJustify = 1 $oRange.ParagraphFormat.Alignment = $wdAlignParagraphJustifyText in my docx: (no character returns after each line) This is line 1 of the test document. This is line 2 of the test document. This is line 3 of the test document.
  12. Have you created a document called test.doc on your desktop and saved 3 lines of test in it before running the code? I am running version 3.3.12.0 and Word 2010 - I do not have access to 2013 currently but it works ok with my setup and the above code.
  13. Does this help? (test.doc has just 3 lines of text) #include <Word.au3> ; Create application object Local $oRange, $oWord = _Word_Create() ; Open the test document Local $oDoc = _Word_DocOpen($oWord, @DesktopDir & "\Test.doc", Default, Default, True) ; Set default alignment 0= Left, 1 = Centre, 2 = Right Local $wdAlignParagraphJustify = 0 ; Move line 1 $oRange = _Word_DocRangeSet($oDoc, -1, $wdParagraph, 0, Default, 2) Local $wdAlignParagraphJustify = 2 $oRange.ParagraphFormat.Alignment = $wdAlignParagraphJustify ; Move line 2 $oRange = _Word_DocRangeSet($oDoc, 0, $wdParagraph, 1, Default, 2) Local $wdAlignParagraphJustify = 1 $oRange.ParagraphFormat.Alignment = $wdAlignParagraphJustify
  14. Could you place the script here: %allusersprofile%/Start Menu\Programs\Startup This should then run when any user logs on.
×
×
  • Create New...