Jump to content

Recommended Posts

Posted

Hello. 

 

New to AutoIT and pretty new to programming in general which is why I am starting here. 

This is what its supposed to do up to this point. It opens a specific program if its not open then after that It asks for a computer name and some other input. 

Then at this point it opens another windows from this program and then puts in my name and a title to the ticket. In the title it should pull the $BCAName which should be a variable number. Once I do the GUICtrlRead it should pull the actual variable name I input into the form right after Enter BCA Name:.

The line "Request to check on BCA " & $SendBCAname & $BCAName & " to check Honor Roll Survey concerns." Ouput is showing Request to check on BCA 9 to check on honor roll survey concerns.

That is confusing me because its showing the variable slot 9 which should have the computer name I enter but when I try to pull the name out to output it with send it does not output anything. 

Does anyone see anything wrong with this? I am really confused since I have gone over all the code and other code similar and can't find out why its not outputting my initial input. 

 

Thank you.

 

 

 

This is a snippet of the code I have.

; This script is for the BCA survey tickets.
;
; AutoIt Version: 3.0
; Language:       English
; Platform:       Win 10
; Author:         Brian Olson
;
; Script Function: Will take a BCA name entered then create the cherwell ticket very quickly for BCA surveys.
#include <GUIConstantsEx.au3>
#include <Constants.au3>
#include <MsgBoxConstants.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GUIConstants.au3>

Opt("TrayAutoPause", 0)

Local $iAnswer = MsgBox(BitOR($MB_YESNO, $MB_SYSTEMMODAL), "BCA Survey Auto ticket generator", "This is the BCA Survey Ticket Creation script Hit Yes to Continue. Hit No if you do not wish to run this script.")

; Check the user's answer to the prompt (see the help file for MsgBox return values)

If $iAnswer = 7 Then
    MsgBox($MB_SYSTEMMODAL, "AutoIt", "Exiting script.")
    Exit
EndIf


If Not ProcessExists("Trebuchet.App.exe") Then Run("C:\ProgramData\Microsoft\AppV\Client\Integration\7CABB881-D789-4747-98F0-55DB0B1DAA3B\Root\VFS\ProgramFilesX86\Cherwell Software\Cherwell Service Management\Trebuchet.App.exe") ; if the process of notepad.exe doesn't exist, it starts it

; Now to create a checklist of items to show which survey questions were marked no and update the ticket with that information.



;------------------Variables------------------------------------------------------------------------------------
$Window = GUICreate("BCA Survey", 250, 350, 378, 159)
$Labels = GUICtrlCreateCheckbox("Labels", 8, 60, 89, 17)
$PowerConnection = GUICtrlCreateCheckbox("Power Connection", 8, 80, 89, 17)
$Login = GUICtrlCreateCheckbox("Login", 8, 100, 41, 17)
$ViewReports = GUICtrlCreateCheckbox("View Reports", 8, 120, 41, 17)
$Printing = GUICtrlCreateCheckbox("Printing", 8, 140, 50, 25)
$BCANamelabel = GUICtrlCreateLabel("Enter BCA Name: ", 8, 8, 107, 17)
$BCAName = GUICtrlCreateInput("", 120, 8, 121, 21)
$Button1 = GUICtrlCreateButton("Create Ticket", 8, 180, 75, 25, $WS_GROUP)
GUISetState(@SW_SHOW)

$SendBCAname = GUICtrlRead($BCAName)



;-------------------------------------------------------------------------------------------------------------
;------------------------Main Program------------------------------------------------------------------------
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            
            MainLoop()
            
    EndSwitch
WEnd
;----------------------------------------------------------------------------------------------------------
;------------------------Main Function linked to by Main Program--------------------------------------------



FUNC MainLoop()




WinActivate ( "Cherwell Service Management (licensed to St. Luke's Health System)" )
Send ( "^+i" )
sleep(5000)
Send ("Brian Olson")
Send ( "{TAB 4}" )


Send ("Request to check on BCA " & $SendBCAname & $BCAName & " to check Honor Roll Survey concerns.")


;Send ( "{TAB 1}" )






EndFunc

 

  • Moderators
Posted

Moved to the appropriate forum.

Moderation Team

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Posted

You're reading from the control before you have a chance to put anything in it You should read the control AFTER you've input something, not right after you've created it.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Posted

OMG So simple but I did not catch it. Like I said I am pretty new even to programming in general so your input is appreciated. This part is working now as intended!

🤯

Thank you.

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