Jump to content

Leaderboard

Popular Content

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

  1. jchd

    Is there a "shorter" way?

    If by "shorter" you mean "easier to shoot myself in the foot", then yes there are a fair number of ways. Among them: If $read1 & $read2 & $read3 & $read4 & $read5 & $read6 = "444444" Then But of course there are many other ways to setup creative bugs.
    2 points
  2. Yes!, there is a way to shorten: If $read1=4 And $read2=4 And $read3=4 And $read4=4 And $read5=4 And $read6=4 Then remove the spaces before and after the = sign .......
    1 point
  3. Jury

    Strings question ...

    Why not just use positive lookahead (?={) #include <Array.au3> $sString="{1} Blessed be He in Whose hands is the Dominion; and He has Power over all things; {2} It is He Who created Death" & _ "and Life, that He might put you to the test which of you is best in deed: And He is the Exalted in Might, the Oft-Forgiving;" & _ "{3} It is He Who created the seven heavens one above another: No want of proportion will you see in the Creation of Allah the" & _ "Most Gracious. So turn your sight again: Do you see any flaw? " $aArray=StringRegExp($sString,"(\{\d+.*?)(?=\{|\Z)",3) _ArrayDisplay($aArray)
    1 point
  4. But that doesn't come close to answering the question of making a one liner shorter. Your code turned making toast in a toaster to making toast with something that Rube Goldberg would have shuddered to contemplate.
    1 point
  5. junkew

    Is there a "shorter" way?

    if bitor($read1,$read2,$read3,$read4,$read5,$read6)=4 Then consolewrite("Yes its four") endIf
    1 point
  6. junkew

    Is there a "shorter" way?

    is the intention really shorter or more readable? if $read1=4 and _ $read2=4 and _ $read3=4 and _ $read4=4 and _ $read5=4 _ Then consolewrite("All are four") EndIf for the functionkeys you just could do $TerminateKey="F111" if stringregexp($TerminateKey,"(OFF)|(F[0-9])",0)=1 Then consolewrite("We matched 1" & @CRLF) EndIf If stringinstr("OFF,F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12", $TerminateKey) > 0 Then consolewrite("We matched 2" & @CRLF) EndIf I do not know if AutoIT can handle matrix comparison directly (for sure it will not be shorter http://www.extremeoptimization.com/QuickStart/CSharp/MatrixVectorOperations.aspx
    1 point
  7. @JohnOne - cleaner way of doing it: #include <WindowsConstants.au3> $form = GUICreate("Test", 900, 530, 518, 272, BitOR($WS_SYSMENU, $WS_POPUP), 0) Global $PSimages[4] For $i = UBound($PSimages) - 1 To 0 Step -1 $PSimages[$i] = GUICtrlCreatePic(@ScriptDir & "\image" & $i + 1 & ".jpg", 0, 0, 900, 530) Next GUISetState(@SW_SHOW, $form) ; start showing it For $i = 0 To UBound($PSimages) - 1 MsgBox(0, "slideshow", "slide " & $i + 1) ;wait for slide advance GUICtrlDelete($PSimages[$i]) Next
    1 point
  8. Depending on the script $read could be an array. Global $read[6] ; ... code to set values here $fCondition = True For $i = 0 to 5 If $read[$i] <> 4 then $fCondition = False Exitloop EndIf Next If $fCondition then ; Code here EndIf Of course that's not shorter...
    1 point
  9. MariusN, Depending on the possible values of the variables you might be able to use: If ($read1 + $read2 + $read3 + $read4 + $read5 + $read6) = 24 Then Obviously that will only work if the values are always numeric AND the value of each variable cannot be more than 4. M23
    1 point
  10. water

    Is there a "shorter" way?

    If you have to check 4 variables you have to check 4 variables. No shorter way I can think of.
    1 point
  11. Why not actually do it the way a two projector setup would. Load slide 1 in projector 1 turn on projector 1 lamp load slide 2 in projector 2 wait for slide advance turn on projector 2 lamp turn off projector 1 lamp load slide 3 in projector 1 wait for slide advance etc... #include <WindowsConstants.au3> $form=GUICreate("Test",900,530,518,272, BitOR($WS_SYSMENU,$WS_POPUP), 0) $PSimage1=GUICtrlCreatePic(@ScriptDir & "\image1.bmp", 0,0,900,530) ;load slide 1 for 'projector' 1 GUICtrlSetState($PSimage1, @SW_SHOW) ;show 'projector' 1 GUISetState(@SW_SHOW, $form) ; start showing it $PSimage2=GUICtrlCreatePic(@ScriptDir & "\image2.bmp", 0,0,900,530) ;load slide 2 for 'projector' 2 GUICtrlSetState($PSimage1, @SW_HIDE) ;hide 'projector' 2 MsgBox(0, "slideshow", "slide 1") ;wait for slide advance GUICtrlSetState($PSimage2, @SW_SHOW) ;show 'projector' 2 GUICtrlSetState($PSimage1, @SW_HIDE) ;hide 'projector' 1 GUICtrlSetImage($PSimage1,@ScriptDir & "\image3.bmp") ;load slide 3 for 'projector; 1 MsgBox(0, "slideshow", "slide 2") ;wait for slide advance GUICtrlSetState($PSimage1, @SW_SHOW) ;show 'projector' 1 GUICtrlSetState($PSimage2, @SW_HIDE) ;hide 'projector' 2 GUICtrlSetImage($PSimage2,@ScriptDir & "\image4.bmp") ;load slide 4 for 'projector; 2 MsgBox(0, "slideshow", "slide 3") ;wait for slide advance GUICtrlSetState($PSimage2, @SW_SHOW) ;show 'projector' 2 GUICtrlSetState($PSimage1, @SW_HIDE) ;hide 'projector' 1 ;GUICtrlSetImage($PSimage1,@ScriptDir & "\image5.bmp") ;load slide 5 for 'projector; 1 MsgBox(0, "slideshow", "slide 4") ;wait for slide advance Exit No flash on my system when I tested it.
    1 point
  12. cal, Do not hesitate to come back if you have any questions. Message handlers are not really that difficult to understand - honest! M23
    1 point
×
×
  • Create New...