顯示具有 au3 標籤的文章。 顯示所有文章
顯示具有 au3 標籤的文章。 顯示所有文章

2009年10月23日 星期五

db連線字串

ODBC 連SQLITE
func connDBsqlite($oS)
$ado = ObjCreate("ADODB.Connection") ;'建立一個連線
$ado.open ( "DRIVER={SQLite3 ODBC Driver};Database="&$oS)
WinSetTitle("[CLASS:AutoIt v3 GUI;Title:SQL查詢]", "", "SQL查詢 " & $oS)
EndFunc
原來就這樣就好了


ODBC 連ORACLE
Func connDB($oS, $UR, $PD) ; 連結db的東西
$ado = ObjCreate("ADODB.Connection") ; Create a COM ADODB Object with the Beta version
$ado.ConnectionString = ("Provider=MSDAORA.1;Data Source='" & $oS & "';User Id= '" & $UR & "'; Password='" & $PD & "';")
$ado.Open
WinSetTitle("[CLASS:AutoIt v3 GUI;Title:SQL查詢]", "", "SQL查詢 " & $oS)
EndFunc ;==>connDB

2008年12月24日 星期三

滑鼠點擊器.au3

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>


;_ScreenCapture_SetJPGQuality(90)
dim $guix1,$guix2,$guiy1,$guiy2
dim $guiactivetitle
dim $SIZEY,$pointy,$SIZEX
dim $Button_start , $fnken
dim $x1,$x2,$y1,$y2
dim $fken

HotKeySet("{F7}", "GETP1") ; 定位點1
HotKeySet("{F8}", "GETP2") ; 定位點2
HotKeySet("{f6}", "NO") ; stop
HotKeySet("{f5}", "DOLOOP") ; do
HotKeySet("{esc}", "EX") ;esc 離開


#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("點對點 滑鼠點擊器", 393, 170, 326, 196)
$guix1 = GUICtrlCreateInput("", 32, 8, 121, 21)
$guiy1 = GUICtrlCreateInput("", 184, 8, 121, 21)
$guix2 = GUICtrlCreateInput("", 32, 40, 121, 21)
$guiy2 = GUICtrlCreateInput("", 184, 40, 121, 21)
$Label1 = GUICtrlCreateLabel("X1", 8, 8, 17, 17)
$Label2 = GUICtrlCreateLabel("Y1", 168, 8, 17, 17)
$Label3 = GUICtrlCreateLabel("X2", 8, 40, 17, 17)
$Label4 = GUICtrlCreateLabel("Y2", 168, 40, 17, 17)
$Label5 = GUICtrlCreateLabel("F7定位", 320, 8, 40, 17)
$Label6 = GUICtrlCreateLabel("F8定位", 320, 40, 40, 17)
$Label7 = GUICtrlCreateLabel("F5 開始", 8, 80, 43, 17)
$Label8 = GUICtrlCreateLabel("F6 停止", 64, 80, 43, 17)
$Label9 = GUICtrlCreateLabel("ESC 離開", 112, 80, 52, 17)
$Label10 = GUICtrlCreateLabel("次數 不輸入代表無限大", 8, 112)
$looptime = GUICtrlCreateInput("", 40, 140, 121, 21)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###



While 1

WEnd

GUISetState(@SW_SHOW)

$i =0

While 1
Sleep(100)
WEnd

func down()
$i =0
Do
MouseDown ( "LEFT" )
SLEEP (10)
Until $i = 1
EndFunc

func DOLOOP()
$x1 = GUICtrlRead($guix1)
$y1 = GUICtrlRead($guiy1)
$x2 = GUICtrlRead($guix2)
$y2 = GUICtrlRead($guiy2)
$I = 0
msgbox ("","",GUICtrlRead($looptime))
if GUICtrlRead($looptime) = '' Then
While $I = 0
MouseMove ( $X1,$Y1)
SLEEP (1000)
MouseClick("left")
MouseMove ( $X2,$Y2)
SLEEP (1000)
MouseClick("left")
WEnd
Else
While GUICtrlRead($looptime) > $i
MouseMove ( $X1,$Y1)
SLEEP (100)
MouseClick("left")
MouseMove ( $X2,$Y2)
SLEEP (100)
MouseClick("left")
$i +=1
WEnd
EndIf

EndFunc

FUNC NO()
if GUICtrlRead($guiy2) <> '' Then
$i=1
Else
$i = GUICtrlRead($looptime) +10
EndIf
EndFunc

func GETP1()
$pos = MouseGetPos()
GUICtrlSetData ($guix1,$pos[0])
GUICtrlSetData ($guiY1,$pos[1])
endfunc

func GETP2()
$pos = MouseGetPos()
GUICtrlSetData ($guiX2,$pos[0])
GUICtrlSetData ($guiY2,$pos[1])
endfunc


FUNC EX()
Exit

2008年12月20日 星期六

EXCEL 畫格子

EXCEL 畫格子



$oExcel.Activesheet.Range("A1").Borders.LineStyle = 4
$oExcel.Activesheet.Range("B3:D5").Borders.LineStyle =3
$oExcel.Activesheet.Range("A6:B7").Borders.LineStyle =2
$oExcel.Activesheet.Range("E1:F6").Borders.LineStyle =1

原始碼
#include <ExcelCOM_UDF.au3>

$oExcel = _ExcelBookNew()

$oExcel.Activesheet.Range("A1").Borders.LineStyle = 4
$oExcel.Activesheet.Range("B3:D5").Borders.LineStyle =3
$oExcel.Activesheet.Range("A6:B7").Borders.LineStyle =2
$oExcel.Activesheet.Range("E1:F6").Borders.LineStyle =1
msgbox ("","","A")
; 結束

;直接使用vba
#cs ----------------------------------------------------------------------------

AutoIt Version: 3.2.12.1
Author: myName

Script Function:
Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here

$MyObject = ObjCreate("Excel.Application"); Create an Excel Object
If @error Then
MsgBox(0, "Excel Error:", "Error creating Excel object!")
Exit
EndIf
If Not IsObj($MyObject) Then
MsgBox(16, "Excel Error:", "Error creating Excel object!")
Exit
EndIf

$MyObject.Visible = 1
$MyObject.workbooks.add

$MyObject.Sheets("Sheet1").Select

; xlLineStyle Constants
$xlContinuous = 1
$xlDash = -4115
$xlDashDot = 4
$xlDashDotDot = 5
$xlDot = -4118
$xlDouble = -4119
$xlLineStyleNone = -4142
$xlSlantDashDot = 13
Const $xlThick = 1
; XlBordersIndex Constants
$xlDiagonalDown = 5
$xlDiagonalUp = 6
$xlEdgeBottom = 9
$xlEdgeLeft = 7
$xlEdgeRight = 10
$xlEdgeTop = 8
$xlInsideHorizontal = 12
$xlInsideVertical = 11

With $MyObject.Sheets("Sheet1")
.Range("b6:c7").Borders.LineStyle = $xlDouble
.Range("E3:G4").Borders.LineStyle = 1

.range("b2:c4").Borders($xlEdgeBottom).LineStyle = $xlDash
.range("b2:c4").Borders($xlEdgetop).LineStyle = $xlDash
.range("b2:c4").Borders($xlEdgeright).LineStyle = $xlDash
.range("b2:c4").Borders($xlEdgeLeft).LineStyle = $xlDash

endwith

$MyObject = 0
;結束

2008年10月19日 星期日

AUTOIT 一直跑的BAR

http://www.autoit.net.cn/viewthread.php?tid=1901&extra=page%3D1

安装进度条

#include
#include
Opt("WinTitleMatchMode", 2)
$AForm2 = GUICreate("AForm1", 400,100,40,@DesktopHeight-50,$WS_POPUP, $WS_EX_LAYERED+$WS_EX_TOPMOST+$WS_EX_TOOLWINDOW)
GUISetBkColor(0xABCDEF)
for $i=0 to 9
$w=15
$pro= GUICtrlCreateLabel("□",40+$w*$i, 20, 135, 10)
GUICtrlSetBkColor($pro, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor($pro, 0xffffff)
Next
GUISetState(@SW_SHOW)
AdlibEnable("xh",3300)
Func xh()
$h=15
$i=0
Do
$i = $i + 1
$pro= GUICtrlCreateLabel("■",40+$h*($i-1), 20, 10, 10)
GUICtrlSetColor(-1, 0x00ff00)
Sleep(300)
GUICtrlDelete($pro)
if $i=10 Then ExitLoop
Until $i>=10
EndFunc
_API_SetLayeredWindowAttributes($AForm2, 0xABCDEF)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exitloop
EndSwitch
WEnd

Func _API_SetLayeredWindowAttributes($hwnd, $i_transcolor, $Transparency = 255, $isColorRef = False)

Local Const $AC_SRC_ALPHA = 1
Local Const $ULW_ALPHA = 2
Local Const $LWA_ALPHA = 0x2
Local Const $LWA_COLORKEY = 0x1
If Not $isColorRef Then
$i_transcolor = Hex(String($i_transcolor), 6)
$i_transcolor = Execute('0x00' & StringMid($i_transcolor, 5, 2) & StringMid($i_transcolor, 3, 2) & StringMid($i_transcolor, 1, 2))
EndIf
Local $Ret = DllCall("user32.dll", "int", "SetLayeredWindowAttributes", "hwnd", $hwnd, "long", $i_transcolor, "byte", $Transparency, "long", $LWA_COLORKEY + $LWA_ALPHA)
Select
Case @error
Return SetError(@error, 0, 0)
Case $Ret[0] = 0
Return SetError(4, 0, 0)
Case Else
Return 1
EndSelect
EndFunc ;==>_API_SetLayeredWindowAttributes

2008年2月7日 星期四

filetree

;file tree 列表
dim $oFILE
dim $Dir,$file

$oFILE = fileopen ("D:\test2\autoit\CHM\ttt.txt",2)

If $oFILE = -1 Then
MsgBox(0, "Error", "Unable to open file.")
Exit
EndIf

filetree("D:\work\Doc\npac_chm\sa\");搜索 ( ) 目錄內所有子目錄及檔案列表
Func filetree($Dir)
if StringRight($Dir, 1)<>"\" Then $Dir=$Dir&"\";使路徑以"\"結尾
$search = FileFindFirstFile($Dir&"*.*")
While 1
$file = FileFindNextFile($search)
If @error Then ExitLoop
If FileGetAttrib ($Dir&$file)="D" Then;如果找到的是目錄則
FileWriteline($oFILE,"DIR " & @tab & $Dir&$file)
;MsgBox(4096, "文件:", $Dir&$file);顯示找到的目錄
filetree($Dir&$file);遞歸搜索
else
FileWriteline($oFILE, "FILE" & @tab & $Dir&$file)
EndIf
WEnd
; 關閉搜索句柄
FileClose($search)
EndFunc
FileClose($oFILE)

2008年2月2日 星期六

檔案相關_讀檔

; Multiple filter group
$message = "Hold down Ctrl or Shift to choose multiple files."

;$var = FileOpenDialog($message, "D:\test2\autoit\新資料夾" & "", "Html (*.htm;*.html)| All (*.*)", 1 + 4 )

$var = FileOpenDialog("讀檔","C:\","all(*.*)")
If @error Then
MsgBox(4096,"","No File(s) chosen")
Else
$var = StringReplace($var, "|", @CRLF)
;MsgBox(4096,"","You chose " & $var)
$a=fileread($var,500)
msgbox ("","",$a)
EndIf

檔案相關 _對話框

; 資料夾模式
$var = FileSelectFolder("Choose a folder.", "",7)


; 存檔案模式 ;FileSaveDialog ( "標題", "起始目錄", "文件類型" [, 選項 [, "默認文件名"]] )
$var = FileSaveDialog ( "標題", "c:\","ALL(*.*)")

; FileOpenDialog ( "標題", "起始目錄", "文件類型" [, 選項 [, "默認文件名"]] )
$var = FileOpenDialog("標題","C:\","all(*.*)")

2007年12月24日 星期一

抓圖的 au3 _ F6capp_desttop

;Script Name F6capp_desttop
;Gets Screen HackMan

dim $sFileName
dim $saveDIR , $StartKey , $Endkey , $SaveFileFormat

;

; 修改區
; 開始快鍵
$StartKey = "{F6}"
; 結速快鍵
$Endkey = "{ESC}"

;存檔區
;存檔目錄
$saveDIR = @ScriptDir & "\capp\"
; 存檔格式 ;年月日_時分.jpg
$SaveFileFormat = @YEAR & @MON & @MDAY & "_" & @HOUR & @MIN & @SEC & ".jpg"
; 修改區結束

; 主程式
if not FileExists ($saveDIR) then DirCreate ($saveDIR)
HotKeySet($StartKey, "PicFunc")
HotKeySet($Endkey, "ExitFunc")

While 1
sleep (300)
WEnd

Func PicFunc()
SEND("{PRINTSCREEN}")
Run("mspaint.exe")
WinWaitActive("[CLASS:MSPaintApp]")
WinSetState ( "[CLASS:MSPaintApp]", "", @SW_MAXIMIZE )
Send("!EP")
Send("P")
WinWaitActive("[CLASS:MSPaintApp]")
Send("!FA")
Send("!T")
Send("{DOWN}")
Send("{DOWN}")
Send("{ENTER}")
Send("!N")
$sFileName = $saveDIR & $SaveFileFormat
Send($sFileName)
Sleep(500)
Send("{ENTER}")
Sleep(500)
;winkill("$sFileName")
Winkill("[CLASS:MSPaintApp]", "")
EndFunc

Func ExitFunc()
Exit
EndFunc

2007年12月2日 星期日

檢查windows服務_Au3



;'Script name : chk_services_A.au3
dim $strComputer
dim $objWMIService
dim $colServices,$objService
dim $errReturnCode
dim $servicename

;' 修改區 ========================
;' 檢查的service name
$servicename = "Telnet"


;'修改區結束=========================
;'=====================================主程式

;' 檢查service name
$strComputer = "."
$objWMIService = ObjGet("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & $strComputer & "\root\cimv2")

$colServices = $objWMIService.ExecQuery _
("Select * from Win32_Service where DisplayName = '" & $servicename & "'")

For $objService in $colServices
if "Stopped" = $objService.State then
msgbox ("","","abc")
endif
Next
;'==================================副程式


可以與vbs作比較 http://c9992.blogspot.com/2007/12/windows.html
語法很類似

RHEL install EPEL

  https://www.linuxtechi.com/install-epel-repo-on-rhel-system/ EPEL dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest...