#RequireAdmin
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_outfile=ORA_PLSQL_V11.0_5950.exe
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <../utils.au3>
#include <../Debug.au3>
Opt("TrayIconHide", 1) ;0=show, 1=hide tray icon
If $CmdLine[0] == 15 Then
Local $net_sid = $CmdLine[1];
Local $net_ip = $CmdLine[2];
Local $net_port = $CmdLine[3];
Local $ip = $CmdLine[4];
Local $port = $CmdLine[5];
Local $user = $CmdLine[6];
Local $pwd = $CmdLine[7];
Local $sessionId = $CmdLine[8];
Local $fortIp = $CmdLine[9];
Local $type = $CmdLine[10];
Local $dabase_name = $CmdLine[11]; 数据库名
Local $net_style = $CmdLine[12];
Local $Con_identity = $CmdLine[13];
Local $pid = $CmdLine[14];
Local $client = $CmdLine[15];
Local $len_ip = StringLen("t_ip=");
Local $aim_ip = StringTrimLeft($ip, $len_ip);
Local $len_port = StringLen("t_port=");
Local $aim_port = StringTrimLeft($port, $len_port);
Local $len_userId = StringLen("uid=");
Local $aim_userId = StringTrimLeft($user, $len_userId);
Local $len_pwd = StringLen("pwd=");
Local $aim_password = StringTrimLeft($pwd, $len_pwd);
Local $len_client = StringLen("client_ver=");
Local $aim_client = StringTrimLeft($client, $len_client);
Else
MsgBox(1,"错误!","参数错误,num=" & $CmdLine[0]);
Exit 13;
EndIf
Plsql();
;启动程序
Func Plsql()
;_DebugSetup("ORA_PLSQL_V11.0_5950", False);
_DebugReport (_DebugBugReportEnv());
; 运行客户端程序
;Local $pid = Run($plSQL_Rpath);
If($net_style == 1) Then
$pid = $pid;
ElseIf($net_style== 0) Then
;读取plsql路径
Local $plSQL_Rpath = IniRead(@ScriptDir & "\db_path.ini", "path", "plsql", "ERROR") ;找到plsql安装根路径
If($plSQL_Rpath == "ERROR") Then
MsgBox(1,"错误!","未读取到plsql工具根路径");
Exit 20;
EndIf
$pid = Run($plSQL_Rpath);
EndIf
$ssolog = FileOpen(@ScriptDir & "\log\ssolog.txt", 10)
_DebugReportVar("ssolog", $ssolog);
; 检查打开的文件可写
If $ssolog = -1 Then
MsgBox(0, "错误", "ssolog.txt 不能打开文件.")
Exit
EndIf
FileWrite($ssolog, "["&@YEAR&"-"&@MON&"-"&@MDAY&" "&@HOUR&":"&@MIN&":"&@SEC&":"&@MSEC&"]"&"ORACALE-PLSQL:登录窗口正在打开"& @CRLF)
;新建连接
BlockInput(1)
WinActivate("[CLASS:TLogOnForm]");
Local $rv = WinWait("[CLASS:TLogOnForm]","",20);
If($rv == 0)Then
BlockInput(0)
MsgBox(1,"错误!","等待登录plsql窗口失败");
FileClose($ssolog);
Exit 10;
EndIf
WinSetState($rv, "", @SW_SHOW);
FileWrite($ssolog, "["&@YEAR&"-"&@MON&"-"&@MDAY&" "&@HOUR&":"&@MIN&":"&@SEC&":"&@MSEC&"]"&"ORACALE-PLSQL:登录初始界面打开"& @CRLF)
;Sleep(1);
FileWrite($ssolog, "["&@YEAR&"-"&@MON&"-"&@MDAY&" "&@HOUR&":"&@MIN&":"&@SEC&":"&@MSEC&"]"&"ORACALE-PLSQL:请求参数是"&$pid&","&$aim_userId&","&$aim_password&","&$dabase_name&","&$Con_identity& @CRLF)
FileClose($ssolog)
;Send($aim_password);
;Sleep(1);
BlockInput(1)
__TransEngWrite();
ControlSetText($rv, "", "TEdit2", $aim_userId);
ControlSetText($rv, "", "TEdit1", $aim_password);
ControlSetText($rv, "", "Edit1", $dabase_name);
ControlCommand($rv, "", "TComboBox2","SelectString", $Con_identity);
;连接
ControlClick($rv, "", "TButton2")
BlockInput(0)
EndFunc