Jump to content

Recommended Posts

Posted

What have you tried so far (code, forum search, google ...)?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted (edited)
11 minutes ago, Jos said:

So, please explain what exactly you want to accomplish here as your initial post doesn't explain anything!

i edit the topic

 

Edited by ahmeddzcom
Posted

Nine, great idea with the wingdings. Here's an example how that could work.

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("Form1", 625, 443)
$Label1 = GUICtrlCreateLabel("S", 88, 96, 36, 17)
GUICtrlSetFont(-1, 12, 400, 0, "Wingdings 2")
GUICtrlSetCursor (-1, 0)
$Label2 = GUICtrlCreateLabel("Click Me", 104, 98, 70, 17)
GUICtrlSetCursor (-1, 0)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Label1
            _ReverseSelection()
        Case $Label2
            _ReverseSelection()
    EndSwitch
WEnd

Func _ReverseSelection()
    $current = GUICtrlRead($Label1)
    If $current = "S" Then
        GUICtrlSetData($Label1, Chr("163"))
    Else
        GUICtrlSetData($Label1, "S")
    EndIf
EndFunc

 

Posted
Posted

@abberration  You could streamlined your code like this :

#include <GUIConstants.au3>

GUICreate ("Test")
$idCheckBox = GUICtrlCreateLabel (ChrW (0xA3),100, 70, 18, 18)
GUICtrlSetFont(-1, 15, 500, -1, "Wingdings 2")
$idLabelCheckBox = GUICtrlCreateLabel ("CheckBox", 122, 74, 100, 18)
GUISetState ()
While 1
  Switch GUIGetMsg()
    Case $GUI_EVENT_CLOSE
      ExitLoop
    Case $idCheckBox, $idLabelCheckBox
      GUICtrlSetData ($idCheckBox, GUICtrlRead ($idCheckBox) = ChrW (0xA3) ? ChrW (0x51) : ChrW (0xA3))
  EndSwitch
Wend

 

Posted

Nine, that is really cool. I learned a few things from your example. First, I used to try and have a case for two items and used OR and it never worked. Now I know to use a comma. Also, I looked up in the help file and found the conditional operator you used for switching the between the characters. Nice. I have seen some videos on how to program with Autoit, but they were all simple stuff, nothing advanced. I wish there were a better way to learn.

Posted
1 hour ago, abberration said:

I wish there were a better way to learn.

Help file is one of the greatest assets of the language.  Most of the functions have a runable example, and many are not that trivial.  Reading it and studying the examples is probably the best way to learn AutoIt. Glad you liked my example :)

Posted

Yes, I love the help file. It is very useful. I have spent more time reading it than actually programming. The biggest problem with it is more complicated things like regular expressions cannot be fully explained. That could be a book on its own. And functions were explained how parameters are used, but not the underlying concept of what a function does, why we use them or when is the best time to use them. I fully understand them now, but it took a while to get it.

Unless I just stumbled upon the section that talked about conditional operators, I would never have known it existed. In other words, until today, I thought the way I wrote the script was the only way to do it. The help file cannot tell you "hey, there's a better way - check out this section...". And looking at the Case section, I now see the comma separating the two variable expressions, but the help file did not make that clear to me or show an example of more than one variable.

Posted

It takes time to understand the "know-how" of most parts of AutoIt, time and experience.  But you can always rely to this community when you need help.  Or sometimes, just to attest if the code you made is optimal.  

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...