Jump to content

Issues, Scripting, and Great Stuff


 Share

Recommended Posts

1. Issues:

So Im working with my Boss - introducing him to Autoit. I had him download the latest version and wanted to show him how easy it was to create an install package for packages with no Msi options. Downloaded fine but when attempting to Autorecord - error's and missing Dlls. Did the same on my end and got the same thing. Both Win7 - one 64bit other 32bit. I ended up loading an older version of the recorder and got it going... I was working over the phone remoted on his desktop - I senced he was kind of frustrated due to the situation.....

2. Scripting.

I have a program with 60 buttons and check boxes each representing a computer - 01 thru 60. So I'm looking at arrays to find ways to check and uncheck the checkboxes - No issues there. Then I thought since I have rooms with say only 3 computers and others up to 52. Could I create an input box and run button - Type in a number, say 10, hit that run button and only checkboxes 1 thru 10 become checked. and so on - 30 would check 1 thru 30....

3. Scripting.

I have a combo box that is fead via text file.

$eFile = "Process.txt"

For $x = 1 To $eRecords[0]

$eComboList = $eComboList & $eRecords[$x] & "|"

Next

$eComboList = StringTrimRight($eComboList, 1)

GUICtrlSetData($tproces, $eComboList)

- I have an edit box that opens the text file in it so I can edit it then save the file.

- I found a way to refresh the combobox to represent my changes to the file without having to reopen the program - Cool stuff...

- I've done it by the follwoing after saving the file - running a fucntion -

Func SingleListRefresh()

$sComboList = ""

GUICtrlSetData ($SingleStart, "")

$sFile = "SList.txt"

If Not _FileReadToArray($sFile, $sRecords) Then

MsgBox(4096, "Error", " Error reading log to Array error:" & @error)

Exit

EndIf

For $x = 1 To $sRecords[0]

$sComboList = $sComboList & $sRecords[$x] & "|"

Next

$sComboList = StringTrimRight($sComboList, 1)

-Question is this proper to clear the Array or will I have issues down the road....?

$sComboList = ""

GUICtrlSetData ($SingleStart, "")

3. Great Stuff

- Just wanted to add that this has been a great tool for me and work - Install packages, AutoTasking, Tech Utilites, Checking and email processing, WMI, VBS support and so on.. If I can script it... thats my motto... It has really reduced time on many of my daily tasks and site support...

I'm trying to get the others I work with, that support other sites, to get on board but I guess each has their own ways....

Thanks for reading and also for advise to my scripting questions.....

I Break and Fix things... If the surf is up I'm outta here.....

Link to comment
Share on other sites

1) You shouldn't show your boss things you didn't try yourself in your cubicle before :)

2) I wouldn't use AutoRecord. If you want reliable scripts use all kind of Control* functions instead.

3) Resetting an array or variable by assigning a new value is fine. Remember that an array is no longer an array when you just set $array = "".

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

 

Link to comment
Share on other sites

Water,

Thanks for your reply.

1) I have a working version of the software on my work computer and did not anticipate the newer version to have this issue.

- Just wanted to show some of Auto It's usage.

2) Auto Recorder is the base to my package creations. I've always found need to enhance the base to suite our needs.

3) Thanks for adding input on the array. My thought process was correct but when I implemented it and it worked I thought that it was too easy. Had to be a catch down the road....

What would be the logic in creating behind the check boxes? Type # = boxes 1 thru # checked.

Array - step through....?

;--------------------

Good stuff - Much Thanks

I Break and Fix things... If the surf is up I'm outta here.....

Link to comment
Share on other sites

Something like this?

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Global $iCheckBoxCount = 10    ; Number of checkboxes
Global $aCheckBoxes[$iCheckBoxCount]   ; Array to hold the ControlIDs of the checkboxes
#region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 438, 192, 124)
For $i = 0 To $iCheckBoxCount - 1    ; Create the checkboxes and writ the ControlIDs to the array
    $aCheckBoxes[$i] = GUICtrlCreateCheckbox("", 8, ($i + 1) * 32, 17, 17)
Next
$CheckAll = GUICtrlCreateButton("Check All", 8, 408, 113, 17)
$UncheckAll = GUICtrlCreateButton("Uncheck All", 136, 408, 113, 17)
$Numbers = GUICtrlCreateInput("", 368, 406, 49, 21)
$Check = GUICtrlCreateButton("Check", 304, 408, 57, 17)
$Exit = GUICtrlCreateButton("Exit", 536, 408, 65, 17)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE, $Exit
            Exit
        Case $CheckAll
            CheckBoxes($GUI_CHECKED, $iCheckBoxCount)   ; Set all checkboxes to "checked"
        Case $UnCheckAll
            CheckBoxes($GUI_UNCHECKED, $iCheckBoxCount)  ; Set all checkboxes to "unchecked"
        Case $Check
            $iNumber = Int(Guictrlread($Numbers))   ; Get the users input and convert it to an integer. No input returns 0
            If $iNumber < 1 Or $iNumber > 10 Then  ; Valid values are between 1 and 10
                MsgBox(16, "CheckBoxes", "Input it not a number or < 1 or > 10")
                ContinueCase
            Endif
            CheckBoxes($GUI_CHECKED, $iNumber) ; Set the number of checkboxes specified by the user to "checked"
    EndSwitch
WEnd

; Parameters: Status to set the checkboxes to, number of checkboxes to change starting with the first one
Func CheckBoxes($iStatus, $iCount)

    For $i = 0 To $iCount - 1 ; Loop throuth the array with the ControlIDs and set the specified number of checkboxes to the specified status
        GUICtrlSetState($aCheckBoxes[$i], $iStatus)
    Next

EndFunc   ;==>CheckBoxes

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

 

Link to comment
Share on other sites

Water -

Just got back from the mall with my daughter - Got her a few Angry bird stuffed animals - logged in to see your reply.

This looks like it. I ran your example and Cool Stuff. When I have time I'll sit and examin your script closer.

Next task is dinner..

Much Thanks

I Break and Fix things... If the surf is up I'm outta here.....

Link to comment
Share on other sites

I've added some comments so understanding what goes on should be a bit easier.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

 

Link to comment
Share on other sites

2) ... just a little possible behavioral feature brain storm.

[text input] : [result]

"2, 10, 23" : select checkbox's 2, 10 and 23.

"..10,30.." : select checkbox's <first> trough 10, and 30..<last>.

"..10, -8" : select checkbox's <first> trough 10, and deselect 8.

"-.., 10.." : deselect all, select 10..<last>

(or '*' instead of '..' of course.)

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Link to comment
Share on other sites

Water

- Solved

I've kept my combo which list 10,20,30 and so on and am using it with a button to check not only the combo info but also user input.

if $msg = $bCount then

if GUICtrlRead($bCombo) = "..." Then

ClearOne()

else

$sSelection = GUICtrlRead($bCombo)

For $i = 0 To $sSelection - 1

GUICtrlSetState($CHKBOX[$i], $GUI_CHECKED)

Next

EndIf

EndIf

Thank you for your advise and concise input on your example script...

I Break and Fix things... If the surf is up I'm outta here.....

Link to comment
Share on other sites

Glad to be of service :)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

 

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...