Jump to content

Real n00b here, capturing input?


Recommended Posts

  • Moderators

Don't think it was me.

I usually don't mess with the regular examples only the UDFs.

I only assumed you did because it had your Example() function in it that you use for the UDFs.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

I wrote an example of how to do this 2 different ways for the old help files, but it looks like Gary took them out.

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Example()

Func Example()
    Local $checkCN, $msg
    GUICreate("My GUI Checkbox")  ; will create a dialog box that when displayed is centered
    $checkCN = GUICtrlCreateCheckbox("CHECKBOX 1", 10, 10, 120, 20)
    GUISetState()       ; will display an  dialog box with 1 checkbox

    ; Run the GUI until the dialog is closed
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                Exit
            Case $checkCN
                If GUICtrlRead($checkCN) = $GUI_CHECKED Then
                    MsgBox(64, "Checked", "Checkbox is checked.")
                EndIf
        EndSwitch
    WEnd
EndFunc   ;==>Example
Thanks for this. I'm sorry I'm not making much headway. But I got slapped down so hard in the forum that I don't know what to do to go further. I've plugged in values, as per normal, and modified to what my degree of knowledge dictates and all I've succeeded in doing is giving myself another near headache! <g> <sigh> What I wish I could do is take a computer course somewhere so that everything wasn't such a big hurdle (no time and money, however. A common problem, I'm sure.). This example is great. But it's only one checkbox and it gives a message box as a result. I have ultimately in the vicinity of 15 checkboxes and the end result will be to link together the information that will be embedded in the script. It's about choosing via a checkbox. Completely different application for the same thing, I guess.

I'll have to withdraw from this one for now and just keep trying and trying on my own. I foresee more frustrating times ahead. But hey, what can be done ... The help file is a great resource, and we're so lucky to have it. But it's not something I get much help from. The better results come from extensive searches in the forum. The first time I looked I didn't get far re checkboxes but later realized that it's because I'd put in "check list" (can you tell I've not done much checkbox work??<g>). When I searched for check BOXES, got a whole lot more but holy cow, so complex.

Thanks. I really appreciate it. This forum is a priceless resource.

Link to comment
Share on other sites

Have a look at this script - it will show you an example with checkboxes.

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

Opt("GUIOnEventMode", 1)
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 188, 222, 193, 125)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
$Label1 = GUICtrlCreateLabel("Checkbox Test", 16, 8, 76, 17)
$Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 10, 40, 121, 25)
GUICtrlSetOnEvent(-1, "Checkbox1Click")
$Checkbox2 = GUICtrlCreateCheckbox("Checkbox1", 10, 65, 121, 25)
GUICtrlSetOnEvent(-1, "Checkbox2Click")
$Checkbox3 = GUICtrlCreateCheckbox("Checkbox1", 10, 90, 121, 25)
GUICtrlSetOnEvent(-1, "Checkbox3Click")
$Checkbox4 = GUICtrlCreateCheckbox("Checkbox1", 10, 115, 121, 25)
GUICtrlSetOnEvent(-1, "Checkbox4Click")
$Checkbox5 = GUICtrlCreateCheckbox("Checkbox1", 10, 140, 121, 25)
GUICtrlSetOnEvent(-1, "Checkbox5Click")
$Button1 = GUICtrlCreateButton("Test Them", 24, 184, 145, 25, 0)
GUICtrlSetOnEvent(-1, "Button1Click")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    Sleep(100)
WEnd

Func Button1Click()
    $status = ""        ;initializing a string
    If GUICtrlRead($Checkbox1) = $GUI_CHECKED Then $status &= "Checkbox1"&@CRLF ;if the checkbox is checked we update the string value
    If GUICtrlRead($Checkbox2) = $GUI_CHECKED Then $status &= "Checkbox2"&@CRLF
    If GUICtrlRead($Checkbox3) = $GUI_CHECKED Then $status &= "Checkbox3"&@CRLF
    If GUICtrlRead($Checkbox4) = $GUI_CHECKED Then $status &= "Checkbox4"&@CRLF
    If GUICtrlRead($Checkbox5) = $GUI_CHECKED Then $status &= "Checkbox5"&@CRLF
    MsgBox (0, "Checked", $status)      ;display the string
EndFunc
Func Checkbox1Click()   ;demo function
    If GUICtrlRead($Checkbox1) = $GUI_CHECKED Then      ;if is checked
        MsgBox (0, "State", "Checkbox1 checked")
    Else                                                ;if not
        MsgBox (0, "State", "Checkbox1 unchecked")
    EndIf
EndFunc
Func Checkbox2Click()

EndFunc
Func Checkbox3Click()

EndFunc
Func Checkbox4Click()

EndFunc
Func Checkbox5Click()

EndFunc
Func Form1Close()
    Exit
EndFunc

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Link to comment
Share on other sites

(Sorry for delay in responding. Intermittent internet access at home. Having a technician over next Saturday since only other hours of availability are when I'm working. Internet already down again today, twice, so rushing to get my results in here before connection goes again!)

Have a look at this script - it will show you an example with checkboxes.

YES!! THANK YOU, THANK YOU! I do so appreciate the example. Always very helpful <g>.

Initial GUI work I did just a few months ago was regular GUIs with no user inputs. Once I stumbled upon Koda (yeah, stumbled upon it myself and not messages here, too funny), learned how to work with them relatively quickly. Longest break was between that and user input ones. Got that squared away due to fantastic help in the earlier part of this thread re typed user input. So last hurdle with basic GUI-building was user selection via checkboxes. There are radio buttons left, but suspect that now that I have checkboxes and other GUI experience, hope to be able to figure that out on my own. This checkbox thing was a major hurdle <g>.

You may not recognize what I've done to your code, though! <g>

Here's what I did with it now that I could integrate a couple of things now that I know more or less what has to go where:

;
; AutoIt 3x
;
#include <_PartitionLetters.au3>
#include <ButtonConstants.au3>
#include <GUIConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#NoTrayIcon     ; AutoIt's icon doesn't show in systray
TraySetIcon("shell32.dll", 171)
AutoItSetOption("WinTitleMatchMode", 2)     ; this allows partial window titles to be valid!

Beep(3500,50)
Beep(2500,75)


;-- NAMES AND EMAILS (edit this part only): -----
$Addressee1 = "Cassandra"
$AddresseeEmail1 = "Address1@hotmail.com"
;------------------
$Addressee2 = "Stanley"
$AddresseeEmail2 = "Address2@hotmail.com"
;------------------
$Addressee3 = "Jetform"
$AddresseeEmail3 = "Address3@hotmail.com"
;------------------
$Addressee4 = "Leopold"
$AddresseeEmail4 = "Address4@hotmail.com"
;------------------
$Addressee5 = "Bugs Bunny"
$AddresseeEmail5 = "Address5@hotmail.com"
;------------------------------------------------


;===== GUI BOX (do not edit anything here with regards to names and email addresses (edit in area above): =============
Opt("GUIOnEventMode", 1)
;----------------------------------------------------------
$Form1 = GUICreate("EMAIL, SELECT RECIPIENTS.", 290, 225, 400, 150)     ; width, height, left, top
GUISetIcon("shell32.dll", 171)     ; this changes icon in upper left-hand corner to your chosen one
;----------------------------------------------------------
$Label1 = GUICtrlCreateLabel("Send email to:", 25, 15, 125, 20)     ; left, top, width, height
;----------------------------------------------------------
$Checkbox1 = GUICtrlCreateCheckbox("  " & $Addressee1, 35, 40, 200, 25)     ; left, top, width, height
GUICtrlSetOnEvent(-1, "Checkbox1Click")
;----------------------------------------------------------
$Checkbox2 = GUICtrlCreateCheckbox("  " & $Addressee2, 35, 65, 200, 25)     ; left, top, width, height
GUICtrlSetOnEvent(-1, "Checkbox2Click")
;----------------------------------------------------------
$Checkbox3 = GUICtrlCreateCheckbox("  " & $Addressee3, 35, 90, 200, 25)     ; left, top, width, height
GUICtrlSetOnEvent(-1, "Checkbox3Click")
;----------------------------------------------------------
$Checkbox4 = GUICtrlCreateCheckbox("  " & $Addressee4, 35, 115, 200, 25)    ; left, top, width, height
GUICtrlSetOnEvent(-1, "Checkbox4Click")
;----------------------------------------------------------
$Checkbox5 = GUICtrlCreateCheckbox("  " & $Addressee5, 35, 140, 200, 25)    ; left, top, width, height
GUICtrlSetOnEvent(-1, "Checkbox5Click")
;----------------------------------------------------------
$GoButton = GUICtrlCreateButton("OK, send", 65, 185, 75, 25, 0)    ; left, top, width, height, ?
GUICtrlSetOnEvent(-1, "GoButtonclick")
; ---------------------------------------------------------
$CancelButton = GUICtrlCreateButton("Cancel", 165, 185, 50, 25, 0)    ; left, top, width, height, ?
GUICtrlSetOnEvent(-1, "CancelClick")
; ---------------------------------------------------------
GUISetState(@SW_SHOW)
;======================================================================================================================

While 1
    Sleep(100)
WEnd

; No need to edit anything here below.  You need edit the names and addresses at the top, only.

Func Checkbox1Click()     ; Email address #1
    $Checkbox1 = $AddresseeEmail1
EndFunc
Func Checkbox2Click()     ; Email address #2
    $Checkbox2 = $AddresseeEmail2
EndFunc
Func Checkbox3Click()     ; Email address #3
    $Checkbox3 = $AddresseeEmail3
EndFunc
Func Checkbox4Click()     ; Email address #4
    $Checkbox4 = $AddresseeEmail4
EndFunc
Func Checkbox5Click()     ; Email address #5
    $Checkbox5 = $AddresseeEmail5
EndFunc


; No need to edit anything here below.  You need edit the names and addresses at the top, only.
Func GoButtonclick()
    ShellExecute("Mailto:" & $Checkbox1 & "," & $Checkbox2 & "," &  $Checkbox3 & "," &  $Checkbox4 & "," & $Checkbox5)
    Exit     ; finished
EndFunc

Func CancelClick()
    Exit     ; finished
EndFunc

Func Close()
    Exit     ; finished
EndFunc

Pls forgive my simplistic, rather linear thinking. Like Kahn, as I love to say, I betray my "2-dimensional thinking" in 3-dimensional space (if you don't know that one, watch "Star Trek II, The Wrath of Khan" if you like.) There are probably a hundred different ways to do this better. But it's the best I can do and it works so far <g>.

The only problem I have is what happens when any of the boxes aren't selected. There is still output in the form of a number. For the life of me, can't figure out how to fix that <g>.

To explain, let's say I choose boxes 1 and 5. The results I get are this:

Address1@hotmail.com,5,6,7,Address5@hotmail.com

How can one eliminate the "5,6,7" number deal going on there, anyone know?

Thanks! muttley

Edited by Diana (Cda)
Link to comment
Share on other sites

There are many ways to skin a cat. Very many.... muttley

;
; AutoIt 3x
;
;#include <_PartitionLetters.au3>       This doen't seem to do anything?
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>       ;More future-proof
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#NoTrayIcon ; AutoIt's icon doesn't show in systray
Opt("GUIOnEventMode", 1);this sort of Opt are usually placed after includes
;TraySetIcon("shell32.dll", 171)    This doesn't make sense because if you change the icon it will show again.
;AutoItSetOption("WinTitleMatchMode", 2)    ;You aren't working with window titles so this is unnecessary

Beep(3500,50)
Beep(2500,75)

Global $EMailArray[1]
For $ForLoopA = 1 To Random(3, 8, 1)
    ReDim $EMailArray[$ForLoopA][2]
    
    For $ForLoopB = 1 To Random(1, 3, 1)
        $Random = Random(0, 9, 1)
        $EMailArray[$ForLoopA-1][0] &= $Random
        $EMailArray[$ForLoopA-1][1] &= $Random
    Next
    
    $EMailArray[$ForLoopA-1][1] &= "@hotmail.com"
Next

;===================================================================================================


$Form1 = GUICreate("EMAIL, SELECT RECIPIENTS.", 290, 100, 400, 150) ; width, height, left, top
WinMove($Form1, "", 400, 150, 290, 100+UBound($EMailArray, 1)*25+20+25) ;Dynamic height
GUISetIcon("shell32.dll", 171)  ; this changes icon in upper left-hand corner to your chosen one
GUISetOnEvent($GUI_EVENT_CLOSE, "Close");You couldn't use the "X" to exit before!
;----------------------------------------------------------
$Label1 = GUICtrlCreateLabel("Send email to:", 25, 15, 125, 20) ; left, top, width, height
;----------------------------------------------------------
For $ForLoop = 0 To UBound($EMailArray, 1)-1        ;More dynamic way of creating checkboxes
    GUICtrlCreateCheckbox("  " & $EMailArray[$ForLoop][0], 35, 40+$ForLoop*25, 200, 25)
Next
;----------------------------------------------------------
$GoButton = GUICtrlCreateButton("OK, send", 65, 40+UBound($EMailArray, 1)*25+20, 75, 25, 0)   ; left, top, width, height, ?
GUICtrlSetOnEvent(-1, "GoButtonclick")
; ---------------------------------------------------------
$CancelButton = GUICtrlCreateButton("Cancel", 165, 40+UBound($EMailArray, 1)*25+20, 50, 25, 0)   ; left, top, width, height, ?
GUICtrlSetOnEvent(-1, "Close")  ;Unnecessary to give this an own function when it does the same as the "X"
; ---------------------------------------------------------
GUISetState(@SW_SHOW)
;===================================================================================================



While 1
    Sleep(100)
WEnd

Func GoButtonclick()
    Local $Receivers = "Mailto:", $FirstAddress = 1
    For $ForLoop = $Label1+1 To $GoButton-1     ;More dynamic way of reading checkboxes
        If GUICtrlRead($ForLoop) = $GUI_CHECKED Then
            If Not $FirstAddress = 1 Then
                $Receivers &= ","
            Else
                $FirstAddress = 0
            EndIf
            $Receivers &= $EMailArray[$ForLoop-$Label1-1][1]
        EndIf
    Next
    ShellExecute($Receivers)
    Exit    ; finished
EndFunc

Func Close()
    Exit    ; finished
EndFunc
Link to comment
Share on other sites

There are many ways to skin a cat. Very many.... :)

<lol> You're right! Um, one question, I cheated in the email addresses because I just copy-pasted, but ... this type of thing is not going to have only hotmail addresses. I don't know about you, but I have people with varying emails and, in fact, only 2 have hotmail ones. Kewl trick above, but the static hotmail.com thingie, hmmm ... <lol>

I've copied your code and put it away. It is really cool, but I can't work with that at my level of understanding/knowledge at present. Looking at it wants my brain to go into headache mode <g>. I'm wondering how long it'll take me to get to the point where I can understand what all you're doing other than on a superficial, intellectual level. Can't wait for that <g>.

The good thing is that I can start using mine tomorrow at work. I'll dump in the real names and addresses and add as many more as I need. This might be seem to be a cumbersome system, but everything I do is in response to a problem I run into. Current contract doesn't use Outlook. I don't want to have to start carrying around yet _another_ address book for another email client, too. And since .pab files are really frowned upon (Outlook's old-style portable address book), thought I'd start doing something different all around and avoiding the .pab and multiple email clients issues entirely. This multiple choice box is the answer. I'll carry that and start using it anywhere I go. It will make life easier.

The only problem is, of course, that for some reason, unchecked boxes still return a value, a number, for some unfathomable reason <g>. Once that gets seen to, this will be good to go. I'm living with that now as I still don't know what's causing it. Anywho, thanks!

Cheers! muttley

Edited by Diana (Cda)
Link to comment
Share on other sites

Ehhm the 2 for-loops filled with Random() was only as an example, remove them and change

Global $EMailArray[1]

to

Global $EMailArray[5][2]=[["Cassandra", "Address1@hotmail.com"], ["Stanley", "Address2@hotmail.com"], ["Jetform", "Address3@hotmail.com"], ["Leopold", "Address4@hotmail.com"], ["Bugs Bunny", "Address5@hotmail.com"]]

and it will work as the one you did, except that when you add more people in the array it will adjust to them dynamically. With a little modification you could also place the names and addresses in a ini-file and use IniReadSection()/IniRead()

Link to comment
Share on other sites

For #1 it's probably because the files you are trying to include are not in the AutoIt3\Include folder To #include a file that is not located there, use

#Include "Drive\FolderPath\My_File.au3". If The file is in the same folder as the script then you can use #Include "My_File.au3"

The #Include<File.au3> method only works when the file is in the same path as your standard UDFs which are installed with AutoIt.

Okay, this was a neat one to figure out. I plugged and plugged away till something worked.

(For other noobs:)

My UDFs are all in the place they should be. No problem there. The problem must lie in that I use AI as a standalone. Though less frequently these days, I test so much sofware that I can crash my OS rather more frequently than the average person. Years ago figured out the workaround to all the installing I was doing was to partition the hdd and start using the apps in standalone mode.

That's what happened with AI. I haven't used an installed version in a long time. I associate the AU3 files with the EXE and it seems that although everything has always worked 100%, turns out that exception is when compiling. I imagine a simple registry filepath fix would clear that up but I'm more frequently on computers that don't have administrator access.

So I came up with this workaround below.

Once again, I've probably come up with something a bit more cumbersome than a more advanced AI user would, but it does the job of changing the paths. Though I always prefer relative paths, nothing but a full path worked here with drive letter and all folders.

To avoid confusion, I'm going to explain now, references to "<_PartitionLetters.au3>" and "$Fldr_Programs_DriveLtr" are my way of eliminating drive letter issues. Turns out that I must forego using "Computer Management" as a means to change drive letters at home (not reliable) and won't always have ability to use that anywhere else anyway, so no longer have any need to modify my scripts for anything other than relative filepaths (i.e., using things like @ScriptDir). For all these other ones, I just change a handful of drive letters once in my "_PartitionLetters.au3" and I'm good to go. All other scripts that can't use AI standard relative path syntax look to this file now for drive letters. Only mention the above to hopefully avoid confusion as to why they appear below.

So, when there is a script that I need to compile, I run this here (which I've called "COMPILING, for- complete path to UDFs (w-prompts) ...") and it helps me when doing the search/replace so that I don't have to hunt down all the replacement filepaths. I don't even have to remember all the steps, it prompts me then gives me the data. <g>

;
; AutoIt 3x
;
#include <_PartitionLetters.au3>     ; this replaces drive letters
#include<_WEReplacement.au3>     ; references a Windows Explorer replacement program
AutoItSetOption("WinTitleMatchMode", 2)     ; this allows partial window titles to be valid!



;----- Box #1: ------------------------------------------------------------------------------------
If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer
$iMsgBoxAnswer = MsgBox(262193,"UDFs, pathnames.","Do a SEARCH and REPLACE for the ''Include <'' part of the script below." & @CRLF & @CRLF & _
    "1.  The text to search for will be placed in the clipboard once you press ''OK'' below.     ")

Select
    Case $iMsgBoxAnswer = 1 ;OK
        ClipPut('Include <')
    Case $iMsgBoxAnswer = 2 ;Cancel
        Exit     ; finished
EndSelect
;------------------------------------------------
If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer
$iMsgBoxAnswer = MsgBox(262193,"UDFs, pathnames.","Press ''OK'' below once you're ready to to continue ...     ")

Select
    Case $iMsgBoxAnswer = 1 ;OK

Case $iMsgBoxAnswer = 2 ;Cancel
        Exit     ; finished
EndSelect
;----- Box #2: ------------------------------------------------------------------------------------
If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer
$iMsgBoxAnswer = MsgBox(262193,"UDFs, pathnames.","2.  The text to replace with will be placed in the clipboard once you press ''OK'' below.     ")

Select
    Case $iMsgBoxAnswer = 1 ;OK
        ClipPut('Include "' & $Fldr_Programs_DriveLtr & '\AutoIt\APP- AutoIt v3.2.10.0\Include\')
    Case $iMsgBoxAnswer = 2 ;Cancel
        Exit     ; finished
EndSelect
;------------------------------------------------
If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer
$iMsgBoxAnswer = MsgBox(262193,"UDFs, pathnames.","Press ''OK'' below once you're ready to to continue ...     ")

Select
    Case $iMsgBoxAnswer = 1 ;OK
        Send("{CTRLDOWN}{HOME}{CTRLUP}")

Case $iMsgBoxAnswer = 2 ;Cancel
        Exit     ; finished
EndSelect
;----- Box #3: ------------------------------------------------------------------------------------
If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer
$iMsgBoxAnswer = MsgBox(262193,"UDFs, pathnames.","Once again do a SEARCH and REPLACE." & @CRLF & @CRLF & _
    "1.  The text to search for will be placed in the clipboard once you press ''OK'' below.     ")

Select
    Case $iMsgBoxAnswer = 1 ;OK
        ClipPut('>')
    Case $iMsgBoxAnswer = 2 ;Cancel
        Exit     ; finished
EndSelect
;------------------------------------------------
If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer
$iMsgBoxAnswer = MsgBox(262193,"UDFs, pathnames.","Press ''OK'' below once you're ready to to continue ...     ")

Select
    Case $iMsgBoxAnswer = 1 ;OK

Case $iMsgBoxAnswer = 2 ;Cancel
        Exit     ; finished
EndSelect
;----- Box #4: ------------------------------------------------------------------------------------
If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer
$iMsgBoxAnswer = MsgBox(262193,"UDFs, pathnames.","2.  The text to replace with will be placed in the clipboard once you press ''OK'' below.     ")

Select
    Case $iMsgBoxAnswer = 1 ;OK
        ClipPut('"')
        Sleep(8000)
    Case $iMsgBoxAnswer = 2 ;Cancel
        Exit     ; finished
EndSelect
;----- Box #5: ------------------------------------------------------------------------------------
If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer
$iMsgBoxAnswer = MsgBox(262193,"UDFs, pathnames.","Once you're done this, you're finished.     ")

Select
    Case $iMsgBoxAnswer = 1 ;OK
        ClipPut('"')
    Case $iMsgBoxAnswer = 2 ;Cancel
        Exit     ; finished
EndSelect

The above changes something like:

#include <ButtonConstants.au3>
#include <GUIConstants.au3>
...
to:
#Include "K:\AutoIt\APP- AutoIt v3.2.10.0\Include\ButtonConstants.au3"
#Include "K:\AutoIt\APP- AutoIt v3.2.10.0\Include\GUIConstants.au3"
...

Next OS install, it will automatically write in new drive letter AutoIt is currently residing in. Never is the same in any successive OS reinstall.

Thanks GS for the help! For the most part, I've been able to compile scripts easily without all the bother of the above because in the GUI formats that I use repeatedly, the syntax that is pulled from the UDFs was minimal, 3 or 4 lines at most. Easy enough to transfer those lines and their references to my scripts. So those GUI files compile as is, without any editing at all by me as if the UDF filepath references worked. This workaround above is for the ones that have more than 3 or 4 UDFs or for formats not frequently used so going to bother of extracting syntax from "include" files is silly. Easier to just change filepaths.

Hoping this helps other newbies if they ever run into this problem.

Thanks! muttley

Link to comment
Share on other sites

Ehhm the 2 for-loops filled with Random() was only as an example, remove them and change

Global $EMailArray[1]

to

Global $EMailArray[5][2]=[["Cassandra", "Address1@hotmail.com"], ["Stanley", "Address2@hotmail.com"], ["Jetform", "Address3@hotmail.com"], ["Leopold", "Address4@hotmail.com"], ["Bugs Bunny", "Address5@hotmail.com"]]

and it will work as the one you did, except that when you add more people in the array it will adjust to them dynamically. With a little modification you could also place the names and addresses in a ini-file and use IniReadSection()/IniRead()

Kewl!

But, can I say "Arggghhhhhhhhhh"? Think I'll stick to crawling for now... Haven't really gotten to the walking part ... then I'll learn to run ... <g>

Thanks! Your patience is appreciated <g>. I'll get there.

In the meantime, I'll be able to start emailing friends/family from work again starting tomorrow. They've felt I've fallen off the face of the Earth!

**************

Anywho, I've already been at this for some time so going to get some chores done. Have to do _some_ real work today <g>.

Thanks a million. muttley

Edited by Diana (Cda)
Link to comment
Share on other sites

If you're going to use this version #549893 of your script then you might run into some problems.

You have to change this part of your code:

Func Checkbox1Click()     ; Email address #1
    $Checkbox1 = $AddresseeEmail1
EndFunc
Func Checkbox2Click()     ; Email address #2
    $Checkbox2 = $AddresseeEmail2
EndFunc
Func Checkbox3Click()     ; Email address #3
    $Checkbox3 = $AddresseeEmail3
EndFunc
Func Checkbox4Click()     ; Email address #4
    $Checkbox4 = $AddresseeEmail4
EndFunc
Func Checkbox5Click()     ; Email address #5
    $Checkbox5 = $AddresseeEmail5
EndFunc


; No need to edit anything here below.  You need edit the names and addresses at the top, only.
Func GoButtonclick()
    ShellExecute("Mailto:" & $Checkbox1 & "," & $Checkbox2 & "," &  $Checkbox3 & "," &  $Checkbox4 & "," & $Checkbox5)
    Exit     ; finished
EndFuncoÝ÷ Ù·jëÊ·ö·©àx4ß ¡yÉ£oj¸nW¬jË"w¶¨º·!yÉ£¬¶¢®§vW¬ü¨»§¶Ú.±ëazf j)íéò¢êìr¸©·
'ßÛp¢¹*.v÷öÛ¬zØ^rº1zËh¶¸ êÚëÞÜ!z{a{&«yÈ^rGþéÜç$yÛaz|¨¹Æ§ëkÚ¶¬yû§rبÁnÀ¡yÉ£B'$[(Êj{¬xe
ÚåEæÓ~ç$nuÖ)ò¢êÒéeº×¬µ«^éíN¬ËazjøuÊy«­¢+ÙÕ¹½   ÕÑѽ¹
±¥¬ ¤(%1½°ÀÌØíµ¥±}ѽ}ÍÑÉ¥¹ôÅÕ½ÐìÅÕ½Ðì(%%U%
ÑɱI ÀÌØí
¡­½àĤôÀÌØíU%}
!
-Q¡¸ÀÌØíµ¥±}ѽ}ÍÑÉ¥¹µÀìôU%
ÑɱI ÀÌØí
¡­½àİĤµÀìÅÕ½Ðì°ÅÕ½Ðì(%%U%
ÑɱI ÀÌØí
¡­½àȤôÀÌØíU%}
!
-Q¡¸ÀÌØíµ¥±}ѽ}ÍÑÉ¥¹µÀìôU%
ÑɱI ÀÌØí
¡­½àȰĤµÀìÅÕ½Ðì°ÅÕ½Ðì(%%U%
ÑɱI ÀÌØí
¡­½à̤ôÀÌØíU%}
!
-Q¡¸ÀÌØíµ¥±}ѽ}ÍÑÉ¥¹µÀìôU%
ÑɱI ÀÌØí
¡­½à̰ĤµÀìÅÕ½Ðì°ÅÕ½Ðì(%%U%
ÑɱI ÀÌØí
¡­½àФôÀÌØíU%}
!
-Q¡¸ÀÌØíµ¥±}ѽ}ÍÑÉ¥¹µÀìôU%
ÑɱI ÀÌØí
¡­½àаĤµÀìÅÕ½Ðì°ÅÕ½Ðì(%%U%
ÑɱI ÀÌØí
¡­½àÔ¤ôÀÌØíU%}
!
-Q¡¸ÀÌØíµ¥±}ѽ}ÍÑÉ¥¹µÀìôU%
ÑɱI ÀÌØí
¡­½à԰Ĥ(%M¡±±áÕÑ ÅÕ½Ðí5¥±Ñ¼èÅÕ½ÐìµÀìÀÌØíµ¥±}ѽ}ÍÑÉ¥¹¤(á¥Ð쥹¥Í¡)¹Õ¹

- GUICtrlRead($Checkbox1, 1) - the option "1" returns the text of the checkbox

- you have to get rid of these lines of code too GUICtrlSetOnEvent(-1, "Checkbox1Click") ... for all your checkboxes

Good luck,

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Link to comment
Share on other sites

If you're going to use this version #549893 of your script then you might run into some problems.

You have to change this part of your code:

<sigh>I've looked at your code again and tried to implement what you've suggested. On the one hand, I don't seem to have enough knowledge again to work with the code you so very kindly provided, yet I can't get mine to work properly either. Well, I'll have to leave it for now and keep hunting through other checkbox messages again. They are vastly more confusing, of course, but now that I know where I'm going wrong, will figure out a way to do what you're doing but in a way that I understand.

Fortunately, the first time I use the box, straight up, it gets the right email addresses. I didn't think to test it by ticking and unticking a whole bunch of items until making a final choice. You're right. The way I have it, it doesn't know how to remember only the final ticks so it I get errors if anything is unticked. But it does work and it is better than nothing <g>. So I'll use as is for now. I can always delete any unneeded addresses once the email client is up and running and until I fix it.

I also finally read all of your ";" comments. Made me laugh! <g> Yeah, there are a few snippets of code that I now dump in automatically into scripts whether or not I use them right then and there. They don't seem to harm anything and I hate all the running around I do looking up code later if I do need them <g>.

Thanks bunches! The education is priceless. When I figure out what I'm doing re this one, will report back a working script for other newbies. <sigh> God knows we need all the help we can get! <lol>

Edited by Diana (Cda)
Link to comment
Share on other sites

Here you go ... muttley

;
; AutoIt 3x
;
#include <_PartitionLetters.au3>
#include <ButtonConstants.au3>
#include <GUIConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#NoTrayIcon     ; AutoIt's icon doesn't show in systray
TraySetIcon("shell32.dll", 171)
AutoItSetOption("WinTitleMatchMode", 2)     ; this allows partial window titles to be valid!

Beep(3500,50)
Beep(2500,75)


;-- NAMES AND EMAILS (edit this part only): -----
$Addressee1 = "Cassandra"
$AddresseeEmail1 = "Address1@hotmail.com"
;------------------
$Addressee2 = "Stanley"
$AddresseeEmail2 = "Address2@hotmail.com"
;------------------
$Addressee3 = "Jetform"
$AddresseeEmail3 = "Address3@hotmail.com"
;------------------
$Addressee4 = "Leopold"
$AddresseeEmail4 = "Address4@hotmail.com"
;------------------
$Addressee5 = "Bugs Bunny"
$AddresseeEmail5 = "Address5@hotmail.com"
;------------------------------------------------


;===== GUI BOX (do not edit anything here with regards to names and email addresses (edit in area above): =============
Opt("GUIOnEventMode", 1)
;----------------------------------------------------------
$Form1 = GUICreate("EMAIL, SELECT RECIPIENTS.", 290, 225, 400, 150)     ; width, height, left, top
GUISetIcon("shell32.dll", 171)     ; this changes icon in upper left-hand corner to your chosen one
;----------------------------------------------------------
$Label1 = GUICtrlCreateLabel("Send email to:", 25, 15, 125, 20)     ; left, top, width, height
;----------------------------------------------------------
$Checkbox1 = GUICtrlCreateCheckbox("  " & $Addressee1, 35, 40, 200, 25)     ; left, top, width, height
;----------------------------------------------------------
$Checkbox2 = GUICtrlCreateCheckbox("  " & $Addressee2, 35, 65, 200, 25)     ; left, top, width, height
;----------------------------------------------------------
$Checkbox3 = GUICtrlCreateCheckbox("  " & $Addressee3, 35, 90, 200, 25)     ; left, top, width, height
;----------------------------------------------------------
$Checkbox4 = GUICtrlCreateCheckbox("  " & $Addressee4, 35, 115, 200, 25)    ; left, top, width, height
;----------------------------------------------------------
$Checkbox5 = GUICtrlCreateCheckbox("  " & $Addressee5, 35, 140, 200, 25)    ; left, top, width, height
;----------------------------------------------------------
$GoButton = GUICtrlCreateButton("OK, send", 65, 185, 75, 25, 0)    ; left, top, width, height, ?
GUICtrlSetOnEvent(-1, "GoButtonclick")
; ---------------------------------------------------------
$CancelButton = GUICtrlCreateButton("Cancel", 165, 185, 50, 25, 0)    ; left, top, width, height, ?
GUICtrlSetOnEvent(-1, "CancelClick")
; ---------------------------------------------------------
GUISetState(@SW_SHOW)
;===================================================================================================


While 1
    Sleep(100)
WEnd

; No need to edit anything here below.  You need edit the names and addresses at the top, only.
Func GoButtonclick()
    Local $mail_to_string = ""
    If GUICtrlRead($Checkbox1) = $GUI_CHECKED Then $mail_to_string &= $AddresseeEmail1&","
    If GUICtrlRead($Checkbox2) = $GUI_CHECKED Then $mail_to_string &= $AddresseeEmail2&","
    If GUICtrlRead($Checkbox3) = $GUI_CHECKED Then $mail_to_string &= $AddresseeEmail3&","
    If GUICtrlRead($Checkbox4) = $GUI_CHECKED Then $mail_to_string &= $AddresseeEmail4&","
    If GUICtrlRead($Checkbox5) = $GUI_CHECKED Then $mail_to_string &= $AddresseeEmail5
    ShellExecute("Mailto: " & $mail_to_string)
    Exit     ; finished
EndFunc

Func CancelClick()
    Exit     ; finished
EndFunc

Func Close()
    Exit     ; finished
EndFunc

... sorrry about my misunderstanding - I've been assuming that the checkbox text was the actual email address.

Now it's fixed :)

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Link to comment
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
 Share

  • Recently Browsing   0 members

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