如何在AutoIT(SciTE脚本编辑器)中获取当前选项卡的名称

时间:2016-07-05 05:52:42

标签: autoit scite

我想获取当前打开的标签的名称。

我试过了:

$currentTabName1 = ControlCommand("Publish This! - Bulk Tools", "", "[CLASS:WindowsForms10.BUTTON.app.0.141b42a_r11_ad1;INSTANCE:16]", "CurrentTab", "")

但它只是让我回头。打开的标签页。

提前致谢

2 个答案:

答案 0 :(得分:0)

您需要使用GuiTab.au3 UDF。

我是这样做的。

#RequireAdmin
Opt("WinTitleMatchMode", 4) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase

#include <GuiTab.au3>

$WindowTitle = "[CLASS:SciTEWindow]"
$Control = "[CLASS:SciTeTabCtrl; INSTANCE:1]"

$currentTabName1 = ControlCommand($WindowTitle, "", $Control, "CurrentTab", "")
$hWnd = ControlGetHandle($WindowTitle, "", $Control)

$array = _GUICtrlTab_GetItem ( $hWnd, $currentTabName1-1 ); -1 because we need 0 based

$CurrentTabText = StringTrimLeft($array[1], 1); trimming &

ConsoleWrite($CurrentTabText & @CRLF)

答案 1 :(得分:0)

@echo on

:GETDAY
set /p dayCnt=Enter The Days you would like to go back [0-20]:%=%
@echo %dayCnt%
@echo off

if %dayCnt% LSS 0 goto GETDAY
if %dayCnt% GTR 20  goto GETDAY

Set ServerList= CANT SHOW

set $tok=1-3
for /f "tokens=1 delims=.:/-, " %%u in ('date /t') do set $d1=%%u
if "%$d1:~0,1%" GTR "9" set $tok=2-4
for /f "tokens=%$tok% delims=.:/-, " %%u in ('date /t') do (
 for /f "skip=1 tokens=2-4 delims=/-,()." %%x in ('echo.^|date') do (
    set %%x=%%u
    set %%y=%%v
    set %%z=%%w
    set $d1=
    set $tok=))

if "%yyyy%"=="" set yyyy=%yy%
if /I %yyyy% LSS 100 set /A yyyy=2000 + 1%yyyy% - 100

set CurDate=%mm%/%dd%/%yyyy%

::set dayCnt=%1

REM Substract your days here
set /A dd=1%dd% - 100 - %dayCnt%
set /A mm=1%mm% - 100

:CHKDAY

if /I %dd% GTR 0 goto DONE

set /A mm=%mm% - 1

if /I %mm% GTR 0 goto ADJUSTDAY

set /A mm=12
set /A yyyy=%yyyy% - 1

@echo %dayCnt%
pause

:ADJUSTDAY

if %mm%==1 goto SET31
if %mm%==2 goto LEAPCHK
if %mm%==3 goto SET31
if %mm%==4 goto SET30
if %mm%==5 goto SET31
if %mm%==6 goto SET30
if %mm%==7 goto SET31
if %mm%==8 goto SET31
if %mm%==9 goto SET30
if %mm%==10 goto SET31
if %mm%==11 goto SET30
REM ** Month 12 falls through

:SET31

set /A dd=31 + %dd%

goto CHKDAY

:SET30

set /A dd=30 + %dd%

goto CHKDAY

:LEAPCHK

set /A tt=%yyyy% %% 4

if not %tt%==0 goto SET28

set /A tt=%yyyy% %% 100

if not %tt%==0 goto SET29

set /A tt=%yyyy% %% 400

if %tt%==0 goto SET29

:SET28

set /A dd=28 + %dd%

goto CHKDAY

:SET29

set /A dd=29 + %dd%

goto CHKDAY

:DONE

if /I %mm% LSS 10 set mm=0%mm%
if /I %dd% LSS 10 set dd=0%dd%

Set CurrentDir=%~dp0

set yyyy=%Date:~-4%
set yy=%Date:~-2%

set date1=%yyyy%-%mm%-%dd%
Set date2=%dd%%mm%%yy%
Set date3=%yy%%mm%%dd%


@echo Date: %date1%
SET /P ANSWER=Do you want to continue(Y/N)?
echo you seletced %ANSWER%

if /i {%ANSWER%}=={n} (exit) 
if /i {%ANSWER%}=={no} (exit) 
if /i {%ANSWER%}=={N} (exit)

mkdir %CurrentDir%\Incoming
mkdir %CurrentDir%\IIS
mkdir %CurrentDir%\Performance
mkdir %CurrentDir%\SystemLogs
mkdir %CurrentDir%\EventLogs
mkdir %CurrentDir%\Integration
mkdir %CurrentDir%\W6OptimizerLog



set Incoming=%CurrentDir%\incoming


REM ## Gather Integration Log files ##
set Source1=d$\clicklogs\integrationlog
set Destination=%CurrentDir%\Integration

For %%S IN (%ServerList%) DO (
move /Y \\%%S\%Source1%\%%S_W6IntLogIncoming_*%date1%-00* %Incoming%\
move /Y \\%%S\%Source1%\%%S_W6IntLogoutgoing_*%date1%-00* %Incoming%\
move /Y \\%%S\%Source1%\W6IntLogIncoming_*%date1%* %Incoming%\%%S_W6IntIncoming_%date1%.txt
move /Y \\%%S\%Source1%\W6IntLogoutgoing_*%date1%* %Incoming%\%%S_W6IntLogoutgoing_%date1%.txt
if exist %Incoming%\*.txt (
d:\backups\7za.exe a %Destination%\IntegrationLogs_%date1% %Incoming%\*.txt
del /Q %Incoming%\*.txt
)

)



REM ## Gather Application Event Log files ##
set Source1=d$\ClickLogs\EventLogs\Application
set Source2=d$\ClickLogs\AppEvntLogs
set Destination=%CurrentDir%\EventLogs

For %%S IN (%ServerList%) DO (
mkdir %CurrentDir%\Incoming\%%S
move /Y \\%%S\%Source1%\*%date1%* %Incoming%\%%S\
move /Y \\%%S\%Source2%\*%date1%* %Incoming%\%%S\

Rem move /Y \\%%S\%Source1%\*.* %Incoming%\%%S\

rem move /Y \\%%S\%Source2%\*%.evtx%* %Incoming%\%%S\

copy /Y \\%%S\%Source1%\*%.evtx%* %Incoming%\%%S\
copy /Y \\%%S\%Source2%\*%.evtx%* %Incoming%\%%S\
d:\backups\7za.exe a %Destination%\ApplicationEventLogs_%date1% %Incoming%\*
For %%S IN (%ServerList%) DO rd /S /Q %Incoming%\%%S
)


REM ## Gather System Event Log files ##
set Source1=d$\ClickLogs\SystemEventLogs
set Source2=d$\ClickLogs\EventLogs\System
set Destination=%CurrentDir%\SystemLogs

For %%S IN (%ServerList%) DO (
move /Y \\%%S\%Source1%\*.evtx %Incoming%\
move /Y \\%%S\%Source2%\*.evtx %Incoming%\

rem move /Y \\%%S\%Source2%\*.* %Incoming%\


copy /Y \\%%S\%Source1%\*.evtx %Incoming%\

copy /Y \\%%S\%Source2%\*.evtx %Incoming%\
d:\backups\7za.exe a %Destination%\SystemEventLogs_%date1% %Incoming%\*.evtx
del /Q %Incoming%\*.evtx
)



REM ## Gather IIS Log files ##
set Source1=d$\ClickLogs\InetLogs\W3SVC1
set Source2=d$\inetpub\logs\logfiles\W3SVC1
set Source3=d$\ClickLogs\InetLogs\W3SVC1\W3SVC1
set Destination=%CurrentDir%\IIS

For %%S IN (%ServerList%) DO (
mkdir %CurrentDir%\Incoming\%%S

move /Y \\%%S\%Source1%\*%date3%*.log %Incoming%\%%S\%%S_IIS_%date1%.log
move /Y \\%%S\%Source2%\*%date3%*.log %Incoming%\%%S\%%S_IIS_%date1%.log
move /Y \\%%S\%Source3%\*%date3%*.log %Incoming%\%%S\%%S_IIS_%date1%.log

rem move /Y \\%%S\%Source1%\*.* %Incoming%\%%S\%%S_IIS_%date1%.log
rem move /Y \\%%S\%Source2%\*.* %Incoming%\%%S\%%S_IIS_%date1%.log
rem move /Y \\%%S\%Source3%\*.* %Incoming%\%%S\%%S_IIS_%date1%.log


)
d:\backups\7za.exe a %Destination%\IISLogs_%date1% %Incoming%\*
For %%S IN (%ServerList%) DO rd /S /Q %Incoming%\%%S

REM ## Gather W6OptimizerLog Log files ##
set Source1=d$\clicklogs
set Destination=%CurrentDir%\W6OptimizerLog

For %%S IN (%ServerList%) DO (
mkdir %CurrentDir%\Incoming\%%S
move /Y \\%%S\%Source1%\W6OptimizerLog_%date1%*.txt %Incoming%\%%S\
)
d:\backups\7za.exe a %Destination%\W6OptimizerLog_%date1% %Incoming%\*
For %%S IN (%ServerList%) DO rd /S /Q %Incoming%\%%S

REM ## Gather Performance Log files ##
set Source1=d$\clicklogs\"Performance Monitor Logs"
set Destination=%CurrentDir%\Performance

For %%S IN (%ServerList%) DO (
mkdir %CurrentDir%\Incoming\%%S
move /Y \\%%S\%Source1%\*%date3%*.csv %Incoming%\%%S\
move /Y \\%%S\%Source1%\*%date3%*.blg %Incoming%\%%S\
move /Y \\%%S\%Source1%\*.blg %Incoming%\%%S\
move /Y \\%%S\%Source1%\*.csv %Incoming%\%%S\
)
d:\backups\7za.exe a %Destination%\PerformanceLogs_%date1% %Incoming%\*
For %%S IN (%ServerList%) DO rd /S /Q %Incoming%\%%S

_GUICtrlTab_GetCurSel

_GUICtrlTab_GetItemText