Sign in to follow this  
Followers 0
jsisson01

Tab click but can't find controlID

4 posts in this topic

Hi,

I'm just about done with this script, but I'm hung up on something, it requires a tab click on the Microsoft OBDC to System DSN.

I'm not sure how to go about that with a control function, and I'd like to avoid the mouse click options. Thanks for the help.

#include <GUIConstants.au3>
Opt("WinTitleMatchMode" ,4)

Opt("GUIOnEventMode", 1) ; Change to OnEvent mode 
$mainwindow = GUICreate("Sabre Install", 400, 300)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")

GUICtrlCreateLabel("1. Install MSDE + Service Pack 4 (Must Be Installed First)", 90, 10)
GUICtrlCreateLabel("Leave all settings at default values to ensure proper installation.", 90, 22)
$MSDEbutton = GUICtrlCreateButton("MSDE", 10, 10, 70)
GUICtrlSetOnEvent($MSDEbutton, "MSDEButton")

GUICtrlCreateLabel("2. Install Sabre (Q-Star Interface and Help Files)", 90, 50)
$Sabrebutton = GUICtrlCreateButton("Sabre", 10, 45, 70)
GUICtrlSetOnEvent($Sabrebutton, "SabreButton")

GUICtrlCreateLabel("3. Update the Q-Star Database", 90,85)
$DBInstallbutton = GUICtrlCreateButton("Update DB", 10, 80, 70)
GUICtrlSetOnEvent($DBInstallbutton, "DBInstallbutton")

GUICtrlCreateLabel("4. Latch the Databases into the System", 90, 120)
$DBLatchbutton = GUICtrlCreateButton("Latch DB", 10, 115, 70)
GUICtrlSetOnEvent($DBLatchbutton, "DBLatchbutton")

GUICtrlCreateLabel("5. Initial Q-Star Setup", 90, 155)
$QSSetupbutton = GUICtrlCreateButton("QS Config", 10, 150, 70)
GUICtrlSetOnEvent($QSSetupbutton, "QSSetupbutton")

GUISetState(@SW_SHOW)

While 1
  Sleep(1000) ; Idle around
WEnd

Func MSDEButton()
  Run("sql70ins.bat")
    WinWaitActive("C:\WINDOWS\system32\cmd.exe")
    WinWaitClose("C:\WINDOWS\system32\cmd.exe")
  Run("sql70sp4.exe")
    WinWaitActive("Installation Folder")
    ControlClick("Installation Folder", "Finish", 12325)
    WinWaitActive("PackageForTheWeb")
    ControlClick("PackageForTheWeb", "&Yes", 6)
    WinWaitActive("PackageForTheWeb")
    ControlClick("PackageForTheWeb", "OK", 2)
    WinWaitClose("PackageForTheWeb")
  Run("C:\70SP4\setup.bat", "C:\70SP4\")
    WinWaitActive("Welcome")
EndFunc

Func SabreButton()
    ShellExecuteWait("Sabre.msi")
        Sleep(1000)
    ShellExecuteWait("SabreHelp.msi")
EndFunc

Func DBInstallButton()
    Run("database.bat")
        WinWaitActive("C:\WINDOWS\system32\cmd.exe")
        WinWaitClose("C:\WINDOWS\system32\cmd.exe")
EndFunc

Func DBLatchButton()
    Run("%SystemRoot%\system32\odbcad32.exe")
        WinWaitActive("ODBC Data Source Administrator")
        
EndFunc

Func QSSetupbutton()
    Run("C:\Program Files\Sabre\Config\QStar Configuration.exe")
EndFunc

Func CLOSEClicked()
 ;Note: at this point @GUI_CTRLID would equal $GUI_EVENT_CLOSE, 
 ;and @GUI_WINHANDLE would equal $mainwindow 
  MsgBox(0, "Confirmation", "Are You Sure You Want to Exit?")
  Exit
EndFunc

Share this post


Link to post
Share on other sites



Look at the UDF _ControlTab().


 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

i think you want to create a new DSN ...

i wrote this with kix few years ago:

$Ini_Source="%systemroot%\ODBC.ini"



odbcsql(qualite,sofpo04\Sofpo,qualite)
Informix(Atlas,sofpo_tcp,atlas,atlas)

Function ODBCSQL($NAME_SQL,$SERVER_SQL,optional $user)
Dim $reg,$Title_SQL,$Driver_SQL,$RegEd,$RegEdPath,$RC
$reg='HKLM' ; System DSN
$RegEd=$reg+'\SOFTWARE\ODBC\ODBC.INI'
$RegEdPath2=$RegEd+'\ODBC Data Sources'
$Title_SQL='SQL Server'
$Driver_SQL=ReadValue('HKLM\SOFTWARE\ODBC\ODBCINST.INI\'+$Title_SQL,'Driver')
$RegEdPath=$RegEd+'\'+$NAME_SQL
?$RegEdPath
;If Not KeyExist($RegEdPath)
;Base de registre
$RC=AddKey($RegEdPath)
$RC=WriteValue($RegEdPath,'Driver',$Driver_SQL,'REG_SZ')
$RC=WriteValue($RegEdPath,'LastUser',@USERID,'REG_SZ')
$RC=WriteValue($RegEdPath,'Server',$SERVER_SQL,'REG_SZ')
$RC=WriteValue($RegEdPath,'Trusted_Connection','Yes','REG_SZ')
$RC=WriteValue($RegEdPath,'Description',$NAME_SQL,'REG_SZ')
$RC=WriteValue($RegEdPath2,$NAME_SQL,$Title_SQL,'REG_SZ')
;%SYSTEMROOT\ODBC.INI
$RC=WriteProfileString ($Ini_Source,'ODBC 32 bit Data Sources',$NAME_SQL,$Title_SQL+' (32 bits)')
$RC=WriteProfileString ($Ini_Source,$NAME_SQL,'Driver32',$Driver_SQL)

;EndIf
EndFunction

Function Informix($NAME_INFX,$SERVER_INFX,$DB,optional $user_infx)
 Dim $reg,$Title_INFX,$Driver_INFX,$RegEd,$RegEdPath,$RC
$reg='HKLM' ; System DSN
$RegEd=$reg+'\SOFTWARE\ODBC\ODBC.INI'
$RegEdPath2=$RegEd+'\ODBC Data Sources'
$Title_INFX='INFORMIX 3.31 32 BIT'
$Driver_INFX=ReadValue('HKLM\SOFTWARE\ODBC\ODBCINST.INI\'+$Title_INFX,'Driver')
$RegEdPath=$RegEd+'\'+$NAME_INFX

;If Not KeyExist($RegEdPath)
;Base de registre
$RC=AddKey($RegEdPath)
$RC=WriteValue($RegEdPath,'Driver',$Driver_INFX,'REG_SZ')
$RC=WriteValue($RegEdPath,'LastUser',@USERID,'REG_SZ')
$RC=WriteValue($RegEdPath,'Server',$SERVER_INFX,'REG_SZ')
$RC=WriteValue($RegEdPath,'Trusted_Connection','Yes','REG_SZ')
$RC=WriteValue($RegEdPath,'Description',$NAME_INFX,'REG_SZ')
$RC=WriteValue($RegEdPath,"CLIENT_LOCALE","en_US.CP1252",'REG_SZ')
$RC=WriteValue($RegEdPath,"CURSORBEHAVIOR","0",'REG_SZ')
$RC=WriteValue($RegEdPath,"DATABASE",$DB,'REG_SZ')
$RC=WriteValue($RegEdPath,"DB_LOCALE","en_US.CP1252",'REG_SZ')
$RC=WriteValue($RegEdPath,"ENABLEINSERTCURSORS","0",'REG_SZ')
$RC=WriteValue($RegEdPath,"ENABLESCROLLABLECURSORS","0",'REG_SZ')
$RC=WriteValue($RegEdPath,"FETCHBUFFERSIZE","4096",'REG_SZ')
$RC=WriteValue($RegEdPath,"NEEDODBCTYPESONLY","0",'REG_SZ')
$RC=WriteValue($RegEdPath,"OPTIMIZEAUTOCOMMIT","1",'REG_SZ')
$RC=WriteValue($RegEdPath,"OPTOFC","0",'REG_SZ')
$RC=WriteValue($RegEdPath,"PWD","EP  0  0  0  0  0 49  0  0  0  0  0  0  0  0  0  0  0  0",'REG_SZ')
$RC=WriteValue($RegEdPath,"REPORTKEYSETCURSORS","0",'REG_SZ')
$RC=WriteValue($RegEdPath,"SERVER",$SERVER_INFX,'REG_SZ')
$RC=WriteValue($RegEdPath,"UID",$USER_infx,'REG_SZ')
$RC=WriteValue($RegEdPath,"VMBCHARLENEXACT","0",'REG_SZ')
;
$RC=WriteValue($RegEdPath2,$NAME_INFX,$Title_INFX,'REG_SZ')
;%SYSTEMROOT\ODBC.INI
$RC=WriteProfileString ($Ini_Source,'ODBC 32 bit Data Sources',$NAME_INFX,$Title_INFX+' (32 bits)')
$RC=WriteProfileString ($Ini_Source,$NAME_INFX,'Driver32',$Driver_INFX)
 ;EndIf
EndFunction

writevalue=regwrite

writeprofilestring=iniwrite

function=func

endfunction=endfunc

+=&

as you can see, both language are really similar

Edited by Kilhian

Share this post


Link to post
Share on other sites

i think you want to create a new DSN ...

i wrote this with kix few years ago:

$Ini_Source="%systemroot%\ODBC.ini"



odbcsql(qualite,sofpo04\Sofpo,qualite)
Informix(Atlas,sofpo_tcp,atlas,atlas)

Function ODBCSQL($NAME_SQL,$SERVER_SQL,optional $user)
Dim $reg,$Title_SQL,$Driver_SQL,$RegEd,$RegEdPath,$RC
$reg='HKLM' ; System DSN
$RegEd=$reg+'\SOFTWARE\ODBC\ODBC.INI'
$RegEdPath2=$RegEd+'\ODBC Data Sources'
$Title_SQL='SQL Server'
$Driver_SQL=ReadValue('HKLM\SOFTWARE\ODBC\ODBCINST.INI\'+$Title_SQL,'Driver')
$RegEdPath=$RegEd+'\'+$NAME_SQL
?$RegEdPath
;If Not KeyExist($RegEdPath)
;Base de registre
$RC=AddKey($RegEdPath)
$RC=WriteValue($RegEdPath,'Driver',$Driver_SQL,'REG_SZ')
$RC=WriteValue($RegEdPath,'LastUser',@USERID,'REG_SZ')
$RC=WriteValue($RegEdPath,'Server',$SERVER_SQL,'REG_SZ')
$RC=WriteValue($RegEdPath,'Trusted_Connection','Yes','REG_SZ')
$RC=WriteValue($RegEdPath,'Description',$NAME_SQL,'REG_SZ')
$RC=WriteValue($RegEdPath2,$NAME_SQL,$Title_SQL,'REG_SZ')
;%SYSTEMROOT\ODBC.INI
$RC=WriteProfileString ($Ini_Source,'ODBC 32 bit Data Sources',$NAME_SQL,$Title_SQL+' (32 bits)')
$RC=WriteProfileString ($Ini_Source,$NAME_SQL,'Driver32',$Driver_SQL)

;EndIf
EndFunction

Function Informix($NAME_INFX,$SERVER_INFX,$DB,optional $user_infx)
 Dim $reg,$Title_INFX,$Driver_INFX,$RegEd,$RegEdPath,$RC
$reg='HKLM' ; System DSN
$RegEd=$reg+'\SOFTWARE\ODBC\ODBC.INI'
$RegEdPath2=$RegEd+'\ODBC Data Sources'
$Title_INFX='INFORMIX 3.31 32 BIT'
$Driver_INFX=ReadValue('HKLM\SOFTWARE\ODBC\ODBCINST.INI\'+$Title_INFX,'Driver')
$RegEdPath=$RegEd+'\'+$NAME_INFX

;If Not KeyExist($RegEdPath)
;Base de registre
$RC=AddKey($RegEdPath)
$RC=WriteValue($RegEdPath,'Driver',$Driver_INFX,'REG_SZ')
$RC=WriteValue($RegEdPath,'LastUser',@USERID,'REG_SZ')
$RC=WriteValue($RegEdPath,'Server',$SERVER_INFX,'REG_SZ')
$RC=WriteValue($RegEdPath,'Trusted_Connection','Yes','REG_SZ')
$RC=WriteValue($RegEdPath,'Description',$NAME_INFX,'REG_SZ')
$RC=WriteValue($RegEdPath,"CLIENT_LOCALE","en_US.CP1252",'REG_SZ')
$RC=WriteValue($RegEdPath,"CURSORBEHAVIOR","0",'REG_SZ')
$RC=WriteValue($RegEdPath,"DATABASE",$DB,'REG_SZ')
$RC=WriteValue($RegEdPath,"DB_LOCALE","en_US.CP1252",'REG_SZ')
$RC=WriteValue($RegEdPath,"ENABLEINSERTCURSORS","0",'REG_SZ')
$RC=WriteValue($RegEdPath,"ENABLESCROLLABLECURSORS","0",'REG_SZ')
$RC=WriteValue($RegEdPath,"FETCHBUFFERSIZE","4096",'REG_SZ')
$RC=WriteValue($RegEdPath,"NEEDODBCTYPESONLY","0",'REG_SZ')
$RC=WriteValue($RegEdPath,"OPTIMIZEAUTOCOMMIT","1",'REG_SZ')
$RC=WriteValue($RegEdPath,"OPTOFC","0",'REG_SZ')
$RC=WriteValue($RegEdPath,"PWD","EP  0  0  0  0  0 49  0  0  0  0  0  0  0  0  0  0  0  0",'REG_SZ')
$RC=WriteValue($RegEdPath,"REPORTKEYSETCURSORS","0",'REG_SZ')
$RC=WriteValue($RegEdPath,"SERVER",$SERVER_INFX,'REG_SZ')
$RC=WriteValue($RegEdPath,"UID",$USER_infx,'REG_SZ')
$RC=WriteValue($RegEdPath,"VMBCHARLENEXACT","0",'REG_SZ')
;
$RC=WriteValue($RegEdPath2,$NAME_INFX,$Title_INFX,'REG_SZ')
;%SYSTEMROOT\ODBC.INI
$RC=WriteProfileString ($Ini_Source,'ODBC 32 bit Data Sources',$NAME_INFX,$Title_INFX+' (32 bits)')
$RC=WriteProfileString ($Ini_Source,$NAME_INFX,'Driver32',$Driver_INFX)
 ;EndIf
EndFunction

writevalue=regwrite

writeprofilestring=iniwrite

function=func

endfunction=endfunc

+=&

as you can see, both language are really similar

Yep, that's what I was doing. I found a simpler way, just writing to the registry with the keys I need. Thanks for the tip, if I expand upon the basic GUI I might incorporate that into it. Thanks.

Share this post


Link to post
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
Sign in to follow this  
Followers 0