Jump to content

Recommended Posts

Posted

So I have been looking things up online and reading various Forum topics regarding (as well as the Help information provided by Autoit, but am still having some issues. Keep in mind I am used to scripting with Powershell, so Autoit is new to me, so I am learning on the fly.

I am trying to pull the values from keys in an .ini and send them to a web browser to auto launch a Citrix session, log in etc. I am still not 100% clear on how to Send those values, and everything I've read gives basic information, but nothing on what I specifically am trying to do.

My ini file

[CAPMAN]
IEText=CareviewDashboard H6PRD{SLEEP 200}{TAB 2}{SLEEP 100}{ENTER}
FocusAppTitle=iCommand Login
CitrixText={LoginUser}{TAB 1}{LoginPass}{SLEEP 100}{ENTER}
CitrixTextTarget=iCommand Login

My Code

#include <MsgBoxConstants.au3>
#include <WinAPIFiles.au3>
#include <array.au3>
#include <File.au3>

If IsAdmin() Then
    If MsgBox(1, 'Paused', 'Admin rights detected, pausing script! Press "OK" to resume, or "Cancel" to exit') = 2 Then Exit
EndIf

Global $LoginUser = 'TEST.CAPMANBOH02' ;RegRead( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "DefaultUserName" )
Global $LoginPass = 'TESTPSWD' ;RegRead( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "DefaultPassword" )
Global $TrkBoardTypeList[6] = ["FIRSTNET", "SURGINET", "RADNET", "PATHNET", "CAPMAN", "ETEMPO"]
Global $CernerURL = '"https://someURL"'
; -----------Edit .ini path here
Global $IniFile = "C:\Settings.ini"
If Not FileExists($IniFile) Then
    MsgBox(48, "Error", "ALERT: Settings.ini not found in location: " & $IniFile & ". Place Settings.ini in correct location as Admin. EXITING", 15)
    Exit
EndIf

Global $TrkBoardType = ""
For $i = 0 To UBound($TrkBoardTypeList) - 1
    If StringInStr($LoginUser, $TrkBoardTypeList[$i]) Then
        $TrkBoardType = $TrkBoardTypeList[$i]
    EndIf
Next
MsgBox(4096, "", "Tracking Board type: " & $TrkBoardType, 5)

If $TrkBoardType = "CAPMAN" Then
    Local $IniSettings = IniReadSection($IniFile, $TrkBoardType)
    If Not @error Then
        ; Enumerate through the array displaying the keys and their respective values.
;~      For $i = 1 To $IniSettings[0][0]
;~          MsgBox($MB_SYSTEMMODAL, "", "Key: " & $IniSettings[$i][0] & @CRLF & "Value: " & $IniSettings[$i][1])
;~      Next
        ;login to Cerner
        WinActivate("Welcome to CernerWorks!")
        WinWaitActive("Welcome to CernerWorks!")
        Send($IniSettings[3][1])
        Sleep(5000)
        ;Search for CapMgmt and launch greaseboard
        WinWaitActive("Welcome to CernerWorks!")
        Send($IniSettings[1][1])
        Sleep(300)
        ;Logs into iCommand
        WinMinimizeAll()
        Sleep(1000)
        WinActivate($IniSettings[2][1])
        WinWaitActive($IniSettings[2][1])
        Sleep(3000)
        Send($IniSettings[3][1])
        Sleep(3000)

        ;Set Tracking Board to Full Screen
        Sleep(3000)
        WinWaitActive("CapMgmt - \\Remote")
        Send("{ALT}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{ENTER}")
        Sleep(3000)
    EndIf
EndIf

At first I tested that I was reading the .ini file by displaying the key values in the section, that worked fine. I can send the IEText value to the browser, although I am still not clear on what the "[1][1]" after sending my $IniSettings to the browser.

The main issue is when I attempt to send the "CitrixText" key and it's values to the browser to log in. Preferably I would like to use the $LoginUser and $LoginPass I've already declared at the top of the script. But use the .ini key value to pass them. Right now when I run the script, in the username and password fields on the web page it just sends "L" for the username and password.

Hopefully I am explaining myself correctly, any help is greatly appreciated.

Posted

Propably I miss, what your issue is.

 

To see how the 2D array looks like and how to address its elements I prefer to use enumerated column index variables:

#include <Debug.au3>

$Ini = "C:\Settings.ini"
$Sect="capman"


Enum $iKey,$iVal
$aSection=IniReadSection($ini,$Sect)
_DebugArrayDisplay($aSection)

for $Row = 1 to $aSection[0][0]
    MsgBox(0,"row " & $Row, "Key = " & $aSection[$Row][$iKey] & @CRLF & _
    "Value = " & $aSection[$Row][$iVal])
Next

MsgBox(0, '', "done")

To address web forms pls. have a look at @water 's 

 

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

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