Sign in to follow this  
Followers 0
Wolffe

Stupid(?) question

8 posts in this topic

this is my first post. And it may very well be a stupid question. But I can not find the answer anywhere else.

I would like the output in the case of the Failed output to be in red. To further illustrate the fact that it is an incorrect response. Is there a way to do this and I have just not looked in the right place? Or is this not possible for some reason?

If $selfcheck[$i] Then

$tempstring = " passed." & @CR

Else

$tempstring = " FAILED!" & @CR

EndIf

Thanks

:">

Share this post


Link to post
Share on other sites



this is my first post. And it may very well be a stupid question. But I can not find the answer anywhere else.

I would like the output in the case of the Failed output to be in red. To further illustrate the fact that it is an incorrect response. Is there a way to do this and I have just not looked in the right place? Or is this not possible for some reason?

If $selfcheck[$i] Then

$tempstring = " passed." & @CR

Else

$tempstring = " FAILED!" & @CR

EndIf

Thanks

:">

Things I have done like that just involved changing the font color to red. So if your output was in a label you could use.

$rLabel = GUICtrlCreateLabel ("my repsonse", 10,20)

Some function and then use the following to set the Response in the label with the red color.

$Response = "Failed"

GuiCtrlSetData($rLabel, $Response)

GUICtrlSetColor($rLabel, 0xff0000) ; Red

That's not complete code, just examples of what you could use.


EndFuncAutoIt is the shiznit. I love it.

Share this post


Link to post
Share on other sites

That does not seem to be working for me. Mayhap because I am still pretty new with Autoit. I will provide more information and perhaps then my issues will be easier to diagnose. Essentially I am trying to create a program that is going to install a bunch of software and change a bunch of settings in Windows automatically. As it is something that I have to do on a daily basis and just want to automate it. But I need to have feedback to ensure that the parts of the script run successfully. That is what this array is for.

$selfcheck = _ArrayCreate(1,0,1,1,1,0,0,1,0,1,0,1,1,1,0)

$outstring = ""

For $i = 0 to 14 step 1

If $selfcheck[$i] Then

$tempstring = " Passed." & @CR

Else

$tempstring = " FAILED!" & @CR

EndIf

Select

Case $i=0

$teststring = "Firewall"

Case $i=1

$teststring = "Auto Update"

Case $i=2

$teststring = "Set Display"

Case $i=3

$teststring = "Set Classic"

Case $i=4

$teststring = "Folder Options"

Case $i=5

$teststring = "1"

Case $i=6

$teststring = "2"

Case $i=7

$teststring = "3"

Case $i=8

$teststring = "4"

Case $i=9

$teststring = "5"

Case $i=10

$teststring = "6"

Case $i=11

$teststring = "7"

Case $i=12

$teststring = "8"

Case $i=13

$teststring = "9"

Case $i=14

$teststring = "10"

EndSelect

$outstring = $outstring & $teststring & $tempstring

Next

So it gives me an output in a list with a passed or failed after each one that has run (this is the test script that I am showing of course that is why it is giving the ones or zeros to the array at the top and not getting output from the program). Now, being that on Monday mornings I can be a bit slow I would like the "Failed" ones to show up in a nice bright red to emphasize that they are not working correctly. I couldn't figure out how to add what you mentioned into this script successfully. A little more help for the n00b perhaps? :-)

Share this post


Link to post
Share on other sites

This is not what you've asked for, but to make the failed messages stand out you could have

If $selfcheck[$i] Then
$tempstring = " Passed." & @CR
Else
$tempstring = "selfcheck[" & $i & "]--------------------------> FAILED!" & @CR
EndIf

or have 2 lists, one for passed and one for failed. You could have one list box for passed with black characters, another for failed with red characters.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Sorry, I forgot to add at the end of the script my output/message box. This is the format the output is in now.

msgbox(0,"These Programs Passed or Failed",$outstring)

Share this post


Link to post
Share on other sites
For $i = 0 to 14 step 1
    If $selfcheck[$i] Then
        $tempstring = " Passed." & @CR
    Else
        $tempstring = " FAILED!" & @CR
    EndIf
    Select
        Case $i=0
            $teststring = "Firewall"
        Case $i=1
            $teststring = "Auto Update"
        Case $i=2
            $teststring = "Set Display"
        Case $i=3
            $teststring = "Set Classic"
        Case $i=4
            $teststring = "Folder Options"
        Case $i=5
            $teststring = "1"
        Case $i=6
            $teststring = "2"
        Case $i=7
            $teststring = "3"
        Case $i=8
            $teststring = "4"
        Case $i=9
            $teststring = "5"
        Case $i=10
            $teststring = "6"
        Case $i=11
            $teststring = "7"
        Case $i=12
            $teststring = "8"
        Case $i=13
            $teststring = "9"
        Case $i=14
            $teststring = "10"
    EndSelect
    $outstring = $outstring & $teststring & $tempstring
NextoÝ÷ Ûú®¢×ºËm -ývƲ¶­¶¬q©ÛyÊ'uéìyÖÖ®¶­sdf÷"b33c¶ÒFòB7FW bb33c·6VÆf6V6µ²b33c¶ÒFVà b33c·FV×7G&ærÒgV÷C²76VBâgV÷C²fײ5  VÇ6P b33c·FV×7G&ærÒgV÷C²dÄTBb333²gV÷C²fײ5  VæD` 6VÆV7@ 66Rb33c¶Ó b33c·FW7G7G&ærÒgV÷C´f&WvÆÂgV÷C° 66Rb33c¶Ó b33c·FW7G7G&ærÒgV÷C´WFòWFFRgV÷C° 66Rb33c¶Ó  b33c·FW7G7G&ærÒgV÷Cµ6WBF7ÆgV÷C° 66Rb33c¶Ó0 b33c·FW7G7G&ærÒgV÷Cµ6WB6Æ762gV÷C° 66Rb33c¶Ó@ b33c·FW7G7G&ærÒgV÷C´föÆFW"÷Föç2gV÷C° VæE6VÆV7@ f÷"b33c¶ÒRFò@ 6VÆV7@ 66Rb33c¶Òb33c¶ b33c·FW7G7G&ærÒ7G&ærb33c¶ÓB VæG6VÆV7@ æW@¢b33c¶÷WG7G&ærÒb33c¶÷WG7G&ærfײb33c·FW7G7G&ærfײb33c·FV×7G&æp¤æW
:whistle:

Share this post


Link to post
Share on other sites

Thanks. But they aren't actually numbers. they are just proprietary information that I did not want to divulge. :-) But thanks anyway.

Share this post


Link to post
Share on other sites

Thanks. But they aren't actually numbers. they are just proprietary information that I did not want to divulge. :-) But thanks anyway.

Oh, well you can still shorten it :whistle: In fact, you can shorten it even more:

$Info=StringSplit("Firewall|Auto Update|Set Display|"& _
    "Set Classic|Folder Options|Info 1|Info 2|Info 3|Info n|Info 14")
For $i = 0 to $info[0]
    If $selfcheck[$i] Then
        $tempstring = " Passed." & @CR
    Else
        $tempstring = " FAILED!" & @CR
    EndIf
    
    For $a = 1 to $Info[0]
        Select
        Case $i = $a
            $teststring = $Info[$a]
        endselect
    Next
$outstring = $outstring & $teststring & $tempstring
Next

:P

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