Hi
I have tried to add 3 AutoItX to PB.
None of them works.(I use PB 5.31)
1 and 2 from http://www.purearea.net/pb/english/index.htm
3. from http://code.google.com/p/au3wrap/
May be they run on older PB versions.
Is there a version that will run under PB 5.31 ?
Thanks
ly
AutoIt and PureBasic
Re: AutoIt and PureBasic
Please try this
Code: Select all
CompilerIf #PB_Compiler_Unicode
CompilerElse
MessageRequester("Error", "Au3Wrap Requires Unicode Support", #MB_ICONERROR)
End
CompilerEndIf
; ----------------------------------------------------------------
;
; File: Au3Wrap.pbi
; Description: PureBasic AutoIt Wrapper
; Version: R7
; AutoIt Version: 3.3.8.1
; Author: Warmonger
; URL: http://code.google.com/p/au3wrap/
;
; ----------------------------------------------------------------
#Au3Lib = 0
#AU3_INTDEFAULT = (-2147483647)
;Macro InitAu3()
If OpenLibrary(#Au3Lib, "AutoItX3.dll")
If IsLibrary(#Au3Lib)
;AU3_error
Prototype.l PB_error() : Global AU3_error.PB_error = GetFunction(#Au3Lib, "AU3_error")
;AutoItSetOption()
Prototype.l PB_AutoItSetOption(szOption.s, szParam.l) : Global AU3_AutoItSetOption.PB_AutoItSetOption = GetFunction(#Au3Lib, "AU3_AutoItSetOption")
;BlockInput()
Prototype.l PB_BlockInput(nFlag.l) : Global AU3_BlockInput.PB_BlockInput = GetFunction(#Au3Lib, "AU3_BlockInput")
;CDTray()
Prototype.l PB_CDTray(szDrive.s, szAction.s) : Global AU3_CDTray.PB_CDTray = GetFunction(#Au3Lib, "AU3_CDTray")
;ClipGet()
Prototype.l PB_ClipGet(*szClip, nBufSize.i) : Global AU3_ClipGet.PB_ClipGet = GetFunction(#Au3Lib, "AU3_ClipGet")
;ClipPut()
Prototype.l PB_ClipPut(szClip.s) : Global AU3_ClipPut.PB_ClipPut = GetFunction(#Au3Lib, "AU3_ClipPut")
;ControlClick()
Prototype.l PB_ControlClick(szTitle.s, szText.s, szControl.s, szButton.s = "left", nNumClicks.l = 1, nX.l = #AU3_INTDEFAULT, nY.l = #AU3_INTDEFAULT) : Global AU3_ControlClick.PB_ControlClick = GetFunction(#Au3Lib, "AU3_ControlClick")
;ControlCommand()
Prototype.l PB_ControlCommand(szTitle.s, szText.s, szControl.s, szCommand.s, szExtra.s, *szResult, nBufSize.i) : Global AU3_ControlCommand.PB_ControlCommand = GetFunction(#Au3Lib, "AU3_ControlCommand")
;ControlDisable()
Prototype.l PB_ControlDisable(szTitle.s, szText.s, szControl.s) : Global AU3_ControlDisable.PB_ControlDisable = GetFunction(#Au3Lib, "AU3_ControlDisable")
;ControlEnable()
Prototype.l PB_ControlEnable(szTitle.s, szText.s, szControl.s) : Global AU3_ControlEnable.PB_ControlEnable = GetFunction(#Au3Lib, "AU3_ControlEnable")
;ControlFocus()
Prototype.l PB_ControlFocus(szTitle.s, szText.s, szControl.s) : Global AU3_ControlFocus.PB_ControlFocus = GetFunction(#Au3Lib, "AU3_ControlFocus")
;ControlGetFocus()
Prototype.l PB_ControlGetFocus(szTitle.s, szText.s, *szControlWithFocus, nBufSize.i) : Global AU3_ControlGetFocus.PB_ControlGetFocus = GetFunction(#Au3Lib, "AU3_ControlGetFocus")
;ControlGetHandle()
Prototype.l PB_ControlGetHandle(szTitle.s, szText.s, szControl.s, *szRetText, nBufSize.i) : Global AU3_ControlGetHandle.PB_ControlGetHandle = GetFunction(#Au3Lib, "AU3_ControlGetHandle")
;ControlGetPosHeight()
Prototype.l PB_ControlGetPosHeight(szTitle.s, szText.s, szControl.s) : Global AU3_ControlGetPosHeight.PB_ControlGetPosHeight = GetFunction(#Au3Lib, "AU3_ControlGetPosHeight")
;ControlGetPosWidth()
Prototype.l PB_ControlGetPosWidth(szTitle.s, szText.s, szControl.s) : Global AU3_ControlGetPosWidth.PB_ControlGetPosWidth = GetFunction(#Au3Lib, "AU3_ControlGetPosWidth")
;ControlGetPosX()
Prototype.l PB_ControlGetPosX(szTitle.s, szText.s, szControl.s) : Global AU3_ControlGetPosX.PB_ControlGetPosX = GetFunction(#Au3Lib, "AU3_ControlGetPosX")
;ControlGetPosY()
Prototype.l PB_ControlGetPosY(szTitle.s, szText.s, szControl.s) : Global AU3_ControlGetPosY.PB_ControlGetPosY = GetFunction(#Au3Lib, "AU3_ControlGetPosY")
;ControlGetText()
Prototype.l PB_ControlGetText(szTitle.s, szText.s, szControl.s, *szControlText, nBufSize.i) : Global AU3_ControlGetText.PB_ControlGetText = GetFunction(#Au3Lib, "AU3_ControlGetText")
;ControlHide()
Prototype.l PB_ControlHide(szTitle.s, szText.s, szControl.s) : Global AU3_ControlHide.PB_ControlHide = GetFunction(#Au3Lib, "AU3_ControlHide")
;ControlListView()
Prototype.l PB_ControlListView(szTitle.s, szText.s, szControl.s, szCommand.s, szExtra1.s, szExtra2.s, *szResult, nBufSize.i) : Global AU3_ControlListView.PB_ControlListView = GetFunction(#Au3Lib, "AU3_ControlListView")
;ControlMove()
Prototype.l PB_ControlMove(szTitle.s, szText.s, szControl.s, nX.l, nY.l, nWidth.l = -1, nHeight.l = -1) : Global AU3_ControlMove.PB_ControlMove = GetFunction(#Au3Lib, "AU3_ControlMove")
;ControlSend()
Prototype.l PB_ControlSend(szTitle.s, szText.s, szControl.s, szSendText.s, nMode.l = 0) : Global AU3_ControlSend.PB_ControlSend = GetFunction(#Au3Lib, "AU3_ControlSend")
;ControlSetText()
Prototype.l PB_ControlSetText(szTitle.s, szText.s, szControl.s, szControlText.s) : Global AU3_ControlSetText.PB_ControlSetText = GetFunction(#Au3Lib, "AU3_ControlSetText")
;ControlShow()
Prototype.l PB_ControlShow(szTitle.s, szText.s, szControl.s) : Global AU3_ControlShow.PB_ControlShow = GetFunction(#Au3Lib, "AU3_ControlShow")
;ControlTreeView()
Prototype.l PB_ControlTreeView(szTitle.s, szText.s, szControl.s, szCommand.s, szExtra1,s, szExtra2.s, *szResult, nBufSize.i) : Global AU3_ControlTreeView.PB_ControlTreeView = GetFunction(#Au3Lib, "AU3_ControlTreeView")
;DriveMapAdd()
Prototype.l PB_DriveMapAdd(szDevice.s, szShare.s, nFlags.l, szUser.s , szPwd.s , *szResult, nBufSize.i) : Global AU3_DriveMapAdd.PB_DriveMapAdd = GetFunction(#Au3Lib, "AU3_DriveMapAdd")
;DriveMapDel()
Prototype.l PB_DriveMapDel(szDevice.s) : Global AU3_DriveMapDel.PB_DriveMapDel = GetFunction(#Au3Lib, "AU3_DriveMapDel")
;DriveMapGet()
Prototype.l PB_DriveMapGet(szDevice.s, *szMapping, nBufSize.i) : Global AU3_DriveMapGet.PB_DriveMapGet = GetFunction(#Au3Lib, "AU3_DriveMapGet")
;IniDelete()
Prototype.l PB_IniDelete(szFilename.s, szSection.s, szKey.s) : Global AU3_IniDelete.PB_IniDelete = GetFunction(#Au3Lib, "AU3_IniDelete")
;IniRead()
Prototype.l PB_IniRead(szFilename.s, szSection.s, szKey.s, szDefault.s, *szValue, nBufSize.i) : Global AU3_IniRead.PB_IniRead = GetFunction(#Au3Lib, "AU3_IniRead")
;IniWrite()
Prototype.l PB_IniWrite(szFilename.s, szSection.s, szKey.s, szValue.s) : Global AU3_IniWrite.PB_IniWrite = GetFunction(#Au3Lib, "AU3_IniWrite")
;IsAdmin()
Prototype.l PB_IsAdmin() : Global AU3_IsAdmin.PB_IsAdmin = GetFunction(#Au3Lib, "AU3_IsAdmin")
;MouseClick()
Prototype.l PB_MouseClick(szButton.s = "LEFT", nX.l = #AU3_INTDEFAULT, nY.l = #AU3_INTDEFAULT, nClicks.l = 1, nSpeed.l = -1) : Global AU3_MouseClick.PB_MouseClick = GetFunction(#Au3Lib, "AU3_MouseClick")
;MouseClickDrag()
Prototype.l PB_MouseClickDrag(szButton.s, nX1.l, nY1.l, nX2.l, nY2.l, nSpeed.l = -1) : Global MouseClickDrag.PB_MouseClickDrag = GetFunction(#Au3Lib, "AU3_MouseClickDrag")
;MouseDown()
Prototype.l PB_MouseDown(szButton.s = "LEFT") : Global AU3_MouseDown.PB_MouseDown = GetFunction(#Au3Lib, "AU3_MouseDown")
;MouseGetCursor()
Prototype.l PB_MouseGetCursor() : Global AU3_MouseGetCursor.PB_MouseGetCursor = GetFunction(#Au3Lib, "AU3_MouseGetCursor")
;MouseGetPosX()
Prototype.l PB_MouseGetPosX() : Global AU3_MouseGetPosX.PB_MouseGetPosX = GetFunction(#Au3Lib, "AU3_MouseGetPosX")
;MouseGetPosY()
Prototype.l PB_MouseGetPosY() : Global AU3_MouseGetPosY.PB_MouseGetPosY = GetFunction(#Au3Lib, "AU3_MouseGetPosY")
;MouseMove()
Prototype.l PB_MouseMove(nX.l, nY.l, nSpeed.l = -1) : Global AU3_MouseMove.PB_MouseMove = GetFunction(#Au3Lib, "AU3_MouseMove")
;MouseUp()
Prototype.l PB_MouseUp(szButton.s = "LEFT") : Global AU3_MouseUp.PB_MouseUp = GetFunction(#Au3Lib, "AU3_MouseUp")
;MouseWheel()
Prototype.l PB_MouseWheel(szDirection.s, nClicks.l) : Global AU3_MouseWheel.PB_MouseWheel = GetFunction(#Au3Lib, "AU3_MouseWheel")
;Opt()
Prototype.l PB_Opt(szOption.s, nValue.l) : Global AU3_Opt.PB_Opt = GetFunction(#Au3Lib, "AU3_Opt")
;PixelChecksum()
Prototype.l PB_PixelChecksum(nLeft.l, nTop.l, nRight.l, nBottom.l, nStep.l = 1) : Global AU3_PixelChecksum.PB_PixelChecksum = GetFunction(#Au3Lib, "AU3_PixelChecksum")
;PixelGetColor()
Prototype.l PB_PixelGetColor(nX.l, nY.l) : Global AU3_PixelGetColor.PB_PixelGetColor = GetFunction(#Au3Lib, "AU3_PixelGetColor")
;PixelSearch()
Prototype.l PB_PixelSearch(nLeft.l, nTop.l, nRight.l, nBottom.l, nCol.l, nVar.l = 0, nStep.l = 1) : Global AU3_PixelSearch.PB_PixelSearch = GetFunction(#Au3Lib, "AU3_PixelSearch")
;ProcessClose()
Prototype.l PB_ProcessClose(szProcess.s) : Global AU3_ProcessClose.PB_ProcessClose = GetFunction(#Au3Lib, "AU3_ProcessClose")
;ProcessExists()
Prototype.l PB_ProcessExists(szProcess.s) : Global AU3_ProcessExists.PB_ProcessExists = GetFunction(#Au3Lib, "AU3_ProcessExists")
;ProcessSetPriority()
Prototype.l PB_ProcessSetPriority(szProcess.s, nPriority.l) : Global AU3_ProcessSetPriority.PB_ProcessSetPriority = GetFunction(#Au3Lib, "AU3_ProcessSetPriority")
;ProcessWait()
Prototype.l PB_ProcessWait(szProcess.s, nTimeout.l = 0) : Global AU3_ProcessWait.PB_ProcessWait = GetFunction(#Au3Lib, "AU3_ProcessWait")
;ProcessWaitClose()
Prototype.l PB_ProcessWaitClose(szProcess.s, nTimeout.l = 0) : Global AU3_ProcessWaitClose.PB_ProcessWaitClose = GetFunction(#Au3Lib, "AU3_ProcessWaitClose")
;RegDeleteKey()
Prototype.l PB_RegDeleteKey(szKeyname.s) : Global AU3_RegDeleteKey.PB_RegDeleteKey = GetFunction(#Au3Lib, "AU3_RegDeleteKey")
;RegDeleteVal()
Prototype.l PB_RegDeleteVal(szKeyname.s, szValuename.s) : Global AU3_RegDeleteVal.PB_RegDeleteVal = GetFunction(#Au3Lib, "AU3_RegDeleteVal")
;RegEnumKey()
Prototype.l PB_RegEnumKey(szKeyname.s, nInstance.l, *szResult, nBufSize.i) : Global AU3_RegEnumKey.PB_RegEnumKey = GetFunction(#Au3Lib, "AU3_RegEnumKey")
;RegEnumVal()
Prototype.l PB_RegEnumVal(szKeyname.s, nInstance.l, *szResult, nBufSize.i) : Global AU3_RegEnumVal.PB_RegEnumVal = GetFunction(#Au3Lib, "AU3_RegEnumVal")
;RegRead()
Prototype.l PB_RegRead(szKeyname.s, szValuename.s, *szRetText, nBufSize.i) : Global AU3_RegRead.PB_RegRead = GetFunction(#Au3Lib, "AU3_RegRead")
;RegWrite()
Prototype.l PB_RegWrite(szKeyname.s, szValuename.s, szType.s, szValue.s) : Global AU3_RegWrite.PB_RegWrite = GetFunction(#Au3Lib, "AU3_RegWrite")
;Run()
Prototype.l PB_Run(szRun.s, szDir.s , nShowFlags.l = 1) : Global AU3_Run.PB_Run = GetFunction(#Au3Lib, "AU3_Run")
;RunAsSet()
Prototype.l PB_RunAsSet(szUser.s, szDomain.s, szPassword.s, nOptions.i) : Global AU3_RunAsSet.PB_RunAsSet = GetFunction(#Au3Lib, "AU3_RunAsSet")
;RunWait()
Prototype.l PB_RunWait(szRun.s, szDir.s , nShowFlags.l = 1) : Global AU3_RunWait.PB_RunWait = GetFunction(#Au3Lib, "AU3_RunWait")
;Send()
Prototype.l PB_Send(szSendText.s, nMode.l = 0) : Global AU3_Send.PB_Send = GetFunction(#Au3Lib, "AU3_Send")
;Shutdown()
Prototype.l PB_Shutdown(nFlags.l) : Global AU3_Shutdown.PB_Shutdown = GetFunction(#Au3Lib, "AU3_Shutdown")
;Sleep()
Prototype.l PB_Sleep(nMilliseconds.l) : Global AU3_Sleep.PB_Sleep = GetFunction(#Au3Lib, "AU3_Sleep")
;StatusbarGetText()
Prototype.l PB_StatusbarGetText(szTitle.s, szText.s , nPart.l, *szStatusText, nBufSize.i) : Global AU3_StatusbarGetText.PB_StatusbarGetText = GetFunction(#Au3Lib, "AU3_StatusbarGetText")
;ToolTip()
Prototype.l PB_ToolTip(szTip.s, nX.l = #AU3_INTDEFAULT, nY.l = #AU3_INTDEFAULT) : Global AU3_ToolTip.PB_ToolTip = GetFunction(#Au3Lib, "AU3_ToolTip")
;WinActivate()
Prototype.l PB_WinActivate(szTitle.s, szText.s ) : Global AU3_WinActivate.PB_WinActivate = GetFunction(#Au3Lib, "AU3_WinActivate")
;WinActive()
Prototype.l PB_WinActive(szTitle.s, szText.s ) : Global AU3_WinActive.PB_WinActive = GetFunction(#Au3Lib, "AU3_WinActive")
;WinClose()
Prototype.l PB_WinClose(szTitle.s, szText.s ) : Global AU3_WinClose.PB_WinClose = GetFunction(#Au3Lib, "AU3_WinClose")
;WinExists()
Prototype.l PB_WinExists(szTitle.s, szText.s ) : Global AU3_WinExists.PB_WinExists = GetFunction(#Au3Lib, "AU3_WinExists")
;WinGetCaretPosX()
Prototype.l PB_WinGetCaretPosX() : Global AU3_WinGetCaretPosX.PB_WinGetCaretPosX = GetFunction(#Au3Lib, "AU3_WinGetCaretPosX")
;WinGetCaretPosY()
Prototype.l PB_WinGetCaretPosY() : Global AU3_WinGetCaretPosY.PB_WinGetCaretPosY = GetFunction(#Au3Lib, "AU3_WinGetCaretPosY")
;WinGetClassList()
Prototype.l PB_WinGetClassList(szTitle.s, szText.s , *szRetText, nBufSize.i) : Global AU3_WinGetClassList.PB_WinGetClassList = GetFunction(#Au3Lib, "AU3_WinGetClassList")
;WinGetClientSizeHeight()
Prototype.l PB_WinGetClientSizeHeight(szTitle.s, szText.s ) : Global AU3_WinGetClientSizeHeight.PB_WinGetClientSizeHeight = GetFunction(#Au3Lib, "AU3_WinGetClientSizeHeight")
;WinGetClientSizeWidth()
Prototype.l PB_WinGetClientSizeWidth(szTitle.s, szText.s ) : Global AU3_WinGetClientSizeWidth.PB_WinGetClientSizeWidth = GetFunction(#Au3Lib, "AU3_WinGetClientSizeWidth")
;WinGetHandle()
Prototype.l PB_WinGetHandle(szTitle.s, szText.s , *szRetText, nBufSize.i) : Global AU3_WinGetHandle.PB_WinGetHandle = GetFunction(#Au3Lib, "AU3_WinGetHandle")
;WinGetPosX()
Prototype.l PB_WinGetPosX(szTitle.s, szText.s ) : Global AU3_WinGetPosX.PB_WinGetPosX = GetFunction(#Au3Lib, "AU3_WinGetPosX")
;WinGetPosY()
Prototype.l PB_WinGetPosY(szTitle.s, szText.s ) : Global AU3_WinGetPosY.PB_WinGetPosY = GetFunction(#Au3Lib, "AU3_WinGetPosY")
;WinGetPosHeight()
Prototype.l PB_WinGetPosHeight(szTitle.s, szText.s ) : Global AU3_WinGetPosHeight.PB_WinGetPosHeight = GetFunction(#Au3Lib, "AU3_WinGetPosHeight")
;WinGetPosWidth()
Prototype.l PB_WinGetPosWidth(szTitle.s, szText.s ) : Global AU3_WinGetPosWidth.PB_WinGetPosWidth = GetFunction(#Au3Lib, "AU3_WinGetPosWidth")
;WinGetProcess()
Prototype.l PB_WinGetProcess(szTitle.s, szText.s , *szRetText, nBufSize.i) : Global AU3_WinGetProcess.PB_WinGetProcess = GetFunction(#Au3Lib, "AU3_WinGetProcess")
;WinGetState()
Prototype.l PB_WinGetState(szTitle.s, szText.s ) : Global AU3_WinGetState.PB_WinGetState = GetFunction(#Au3Lib, "AU3_WinGetState")
;WinGetText()
Prototype.l PB_WinGetText(szTitle.s, szText.s , *szRetText, nBufSize.i) : Global AU3_WinGetText.PB_WinGetText = GetFunction(#Au3Lib, "AU3_WinGetText")
;WinGetTitle()
Prototype.l PB_WinGetTitle(szTitle.s, szText.s , *szRetText, nBufSize.i) : Global AU3_WinGetTitle.PB_WinGetTitle = GetFunction(#Au3Lib, "AU3_WinGetTitle")
;WinKill()
Prototype.l PB_WinKill(szTitle.s, szText.s ) : Global AU3_WinKill.PB_WinKill = GetFunction(#Au3Lib, "AU3_WinKill")
;WinList()
Prototype.l PB_WinList(szTitle.s, szText.s ) : Global AU3_WinList.PB_WinList = GetFunction(#Au3Lib, "AU3_WinList")
;WinMenuSelectItem()
Prototype.l PB_WinMenuSelectItem(szTitle.s, szText.s, szItem.s, szItem1.s , szItem2.s , szItem3.s , szItem4.s , szItem5.s , szItem6.s ) : Global WinMenuSelectItem.PB_WinMenuSelectItem = GetFunction(#Au3Lib, "AU3_WinMenuSelectItem")
;WinMinimizeAll()
Prototype.l PB_WinMinimizeAll() : Global AU3_WinMinimizeAll.PB_WinMinimizeAll = GetFunction(#Au3Lib, "AU3_WinMinimizeAll")
;WinMinimizeAllUndo()
Prototype.l PB_WinMinimizeAllUndo() : Global AU3_WinMinimizeAllUndo.PB_WinMinimizeAllUndo = GetFunction(#Au3Lib, "AU3_WinMinimizeAllUndo")
;WinMove()
Prototype.l PB_WinMove(szTitle.s, szText.s, nX.l, nY.l, nWidth.l = -1, nHeight.l = -1) : Global AU3_WinMove.PB_WinMove = GetFunction(#Au3Lib, "AU3_WinMove")
;WinSetOnTop()
Prototype.l PB_WinSetOnTop(szTitle.s, szText.s, nFlag.l) : Global AU3_WinSetOnTop.PB_WinSetOnTop = GetFunction(#Au3Lib, "AU3_WinSetOnTop")
;WinSetState()
Prototype.l PB_WinSetState(szTitle.s, szText.s, nFlags.l) : Global AU3_WinSetState.PB_WinSetState = GetFunction(#Au3Lib, "AU3_WinSetState")
;WinSetTitle()
Prototype.l PB_WinSetTitle(szTitle.s, szText.s, szNewTitle.s) : Global AU3_WinSetTitle.PB_WinSetTitle = GetFunction(#Au3Lib, "AU3_WinSetTitle")
;WinSetTrans()
Prototype.l PB_WinSetTrans(szTitle.s, szText.s, nTrans.l) : Global AU3_WinSetTrans.PB_WinSetTrans = GetFunction(#Au3Lib, "AU3_WinSetTrans")
;WinWait()
Prototype.l PB_WinWait(szTitle.s, szText.s, nTimeout.l = 0) : Global AU3_WinWait.PB_WinWait = GetFunction(#Au3Lib, "AU3_WinWait")
;WinWaitActive()
Prototype.l PB_WinWaitActive(szTitle.s, szText.s, nTimeout.l = 0) : Global AU3_WinWaitActive.PB_WinWaitActive = GetFunction(#Au3Lib, "AU3_WinWaitActive")
;WinWaitClose()
Prototype.l PB_WinWaitClose(szTitle.s, szText.s, nTimeout.l = 0) : Global AU3_WinWaitClose.PB_WinWaitClose = GetFunction(#Au3Lib, "AU3_WinWaitClose")
;WinWaitNotActive()
Prototype.l PB_WinWaitNotActive(szTitle.s, szText.s, nTimeout.l = 0) : Global AU3_WinWaitNotActive.PB_WinWaitNotActive = GetFunction(#Au3Lib, "AU3_WinWaitNotActive")
Else
MessageRequester("Error", "AutoItX3 Is Not A Valid Library", #MB_ICONERROR)
EndIf
Else
MessageRequester("Error", "AutoItX3 Library Not Found", #MB_ICONERROR)
EndIf
;EndMacro
;IncludeFile "Au3Wrap.pbi"
;/InitAu3()
AU3_Run("notepad.exe", "")
Delay(2000)
AU3_Send("Au3Wrap")
Re: AutoIt and PureBasic
Hi acreis
Thanks
I have copied AutoItX3.dll to the folder that contains the source.
I have tried it and it works.
ly
Thanks
I have copied AutoItX3.dll to the folder that contains the source.
I have tried it and it works.
ly
Last edited by ly47 on Tue Apr 28, 2015 12:24 pm, edited 2 times in total.
Re: AutoIt and PureBasic
Don't use the old Library! Remove the libfile from ...\PureLibraries\UserLibraries.
Use for example the code from acreis with AutoItX3.dll!
Or use this one: http://www.purebasic.fr/english/viewtop ... 00#p317000
as include. It's more or less compatible to AutoIt, but with PB-Code.
Use for example the code from acreis with AutoItX3.dll!
Or use this one: http://www.purebasic.fr/english/viewtop ... 00#p317000
as include. It's more or less compatible to AutoIt, but with PB-Code.
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Re: AutoIt and PureBasic
Hi ts-soft
Thanks.
It works only if I use "IncludeFile "AutoWin_include.pbi"
If I use AutoWin lib in "PureLibraries\UserLibraries it will not work ERROR:
[15:09:29] [COMPILER] Library missing: Misc (needed by 'AutoWin' library).
I assume it is an old lib.
thanks again
ly
Thanks.
It works only if I use "IncludeFile "AutoWin_include.pbi"
If I use AutoWin lib in "PureLibraries\UserLibraries it will not work ERROR:
[15:09:29] [COMPILER] Library missing: Misc (needed by 'AutoWin' library).
I assume it is an old lib.
thanks again
ly
Re: AutoIt and PureBasic
Hi acreis
I'm checking now AU3_ControlClick and AU3_MouseClick.
AU3_ControlClick does not work.
I don't know why.
thanks
ly
I'm checking now AU3_ControlClick and AU3_MouseClick.
AU3_ControlClick does not work.
I don't know why.
thanks
ly
Code: Select all
IncludeFile("C:\Basic\PureBasic_v5.31\zz\Au3Wrap R7\Au3Wrap R7\Au3Wrap_X.pbi")
AU3_AutoItSetOption("MouseCoordMode",0)
Enumeration
#ID_BT1 = 1001
#ID_BT2
#ID_BT3
EndEnumeration
Global.l hInstance
hInstance = GetModuleHandle_( null )
Global.l hBtn1,hBtn2,hBtn3
Declare WndProc(hWnd, uMsg, wParam, lParam)
Declare XHiWord(a.l)
Declare XLoWord(a.l)
Global Appname.s,Caption.s
Appname = "Win32"
Caption = "Simple Window"
Global wc.WNDCLASS
wc\style = #CS_VREDRAW | #CS_HREDRAW
wc\lpfnWndProc = @WndProc()
wc\cbClsExtra = 0
wc\cbWndExtra = 0
wc\hInstance = hInstance
wc\hIcon = LoadIcon_(hInstance, "#1")
wc\hCursor = LoadCursor_(0, #IDC_ARROW)
wc\hbrBackground = CreateSolidBrush_(GetSysColor_(15))
wc\lpszMenuName = 0
wc\lpszClassName = @Appname
RegisterClass_(wc)
hWnd = CreateWindowEx_(0,Appname,Caption,
#WS_OVERLAPPEDWINDOW | #WS_VISIBLE ,
100, 100, 600, 400,
0,0,wc\hInstance,0)
UpdateWindow_(hWnd)
ShowWindow_(hWnd,#SW_SHOWNORMAL)
SetForegroundWindow_(hWnd)
;- ------ TEST -------
; AU3_MouseClick("",440+15, 328+45,1,2)
; AU3_WinActive("Simple Window","")
AU3_ControlClick("Test-1","","#ID_BT2")
;- ------ TEST -------
While GetMessage_(m.MSG, 0, 0, 0)
TranslateMessage_(m)
DispatchMessage_(m)
Wend
Procedure WndProc(hWnd,uMsg,wParam,lParam)
Select uMsg
Case #WM_CREATE
hBtn1 = CreateWindowEx_( 0,
"button", "Exit",
#WS_VISIBLE|#WS_CHILD,
520, 328, 60, 25,
hWnd, #ID_BT1, hInstance, null )
hBtn2 = CreateWindowEx_( 0,
"button", "Test-1",
#WS_VISIBLE|#WS_CHILD,
440, 328, 60, 25,
hWnd,#ID_BT2, hInstance, null )
hBtn3 = CreateWindowEx_( 0,
"button", "Test-2",
#WS_VISIBLE|#WS_CHILD,
360, 328, 60, 25,
hWnd,#ID_BT3, hInstance, null )
Case #WM_COMMAND
Select XLoWord(wParam)
Case #ID_BT1
PostQuitMessage_(0)
Case #ID_BT2
MessageRequester("!","Test-1")
Case #ID_BT3
MessageRequester("!","Test-2")
EndSelect
Case WM_DESTROY
PostQuitMessage_( 0 )
EndSelect
ProcedureReturn DefWindowProc_(hWnd, uMsg, wParam, lParam)
EndProcedure
Procedure XHiWord(a.l)
ProcedureReturn Int(a / $10000)
EndProcedure
Procedure XLoWord(a.l)
ProcedureReturn Int(a - (Int(a/$10000)*$10000))
EndProcedure
Re: AutoIt and PureBasic
I dont know anything about autoit.
I just fixed the include file.
Sorry
I just fixed the include file.
Sorry
Re: AutoIt and PureBasic
Hi
Problem solved.
thanks
ly
Problem solved.
thanks
ly
Code: Select all
IncludeFile("C:\Basic\PureBasic_v5.31\zz\Au3Wrap R7\Au3Wrap R7\Au3Wrap_X.pbi")
AU3_AutoItSetOption("MouseCoordMode",0)
Enumeration
#ID_BT1 = 1001
#ID_BT2
#ID_BT3
EndEnumeration
Global.l hInstance
hInstance = GetModuleHandle_( null )
Global.l hBtn1,hBtn2,hBtn3
Declare WndProc(hWnd, uMsg, wParam, lParam)
Declare XHiWord(a.l)
Declare XLoWord(a.l)
Global Appname.s,Caption.s
Appname = "Win32"
Caption = "Simple Window"
Global wc.WNDCLASS
wc\style = #CS_VREDRAW | #CS_HREDRAW
wc\lpfnWndProc = @WndProc()
wc\cbClsExtra = 0
wc\cbWndExtra = 0
wc\hInstance = hInstance
wc\hIcon = LoadIcon_(hInstance, "#1")
wc\hCursor = LoadCursor_(0, #IDC_ARROW)
wc\hbrBackground = CreateSolidBrush_(GetSysColor_(15))
wc\lpszMenuName = 0
wc\lpszClassName = @Appname
RegisterClass_(wc)
hWnd = CreateWindowEx_(0,Appname,Caption,
#WS_OVERLAPPEDWINDOW | #WS_VISIBLE ,
100, 100, 600, 400,
0,0,wc\hInstance,0)
UpdateWindow_(hWnd)
ShowWindow_(hWnd,#SW_SHOWNORMAL)
SetForegroundWindow_(hWnd)
;- ------ TEST ----
; AU3_MouseClick("",440+15, 328+45,1,2) ; < works
; AU3_ControlClick("Simple Window", "", "[ID: 1002]") ; < works
; AU3_ControlClick("Simple Window", "", "1002") ; < working
; AU3_ControlClick("Simple Window", "", "[CLASS:Button; TEXT:Test-2; INSTANCE:1]") ; < works
AU3_ControlClick("Simple Window", "", "[CLASS:Button; TEXT:Test-1]") ; < works
;- ------ TEST -------
While GetMessage_(m.MSG, 0, 0, 0)
TranslateMessage_(m)
DispatchMessage_(m)
Wend
Procedure WndProc(hWnd,uMsg,wParam,lParam)
Select uMsg
Case #WM_CREATE
hBtn1 = CreateWindowEx_( 0,
"button", "Exit",
#WS_VISIBLE|#WS_CHILD,
520, 328, 60, 25,
hWnd, #ID_BT1, hInstance, null )
hBtn2 = CreateWindowEx_( 0,
"button", "Test-1",
#WS_VISIBLE|#WS_CHILD,
440, 328, 60, 25,
hWnd,#ID_BT2, hInstance, null )
hBtn3 = CreateWindowEx_( 0,
"button", "Test-2",
#WS_VISIBLE|#WS_CHILD,
360, 328, 60, 25,
hWnd,#ID_BT3, hInstance, null )
Case #WM_COMMAND
Select XLoWord(wParam)
Case #ID_BT1
PostQuitMessage_(0)
Case #ID_BT2
MessageRequester("!","Test-1")
Case #ID_BT3
MessageRequester("!","Test-2")
EndSelect
Case #WM_DESTROY
PostQuitMessage_( 0 )
EndSelect
ProcedureReturn DefWindowProc_(hWnd, uMsg, wParam, lParam)
EndProcedure
Procedure XHiWord(a.l)
ProcedureReturn Int(a / $10000)
EndProcedure
Procedure XLoWord(a.l)
ProcedureReturn Int(a - (Int(a/$10000)*$10000))
EndProcedure
Re: AutoIt and PureBasic
Old thread, but a friend asked me to write him something to convert the autox.h file to a pb file he could include/use in his app with autoitx_x64.dll
While I'm not sure writing the converter was a good use of time (it may have been faster just to convert by hand), the result looks good and seems to work -- I have not done extensive testing, but it is every function they list in the autoitx help file/c header.
-=[ edit 2018/11/15: I think this includes most (all?) functions in the autoitx3 dll Not all AutoIt functions are exported; I commented out the ones that are not present in the dll; I think I got all the declares consistient (ie: declares with *StringVariable rather than stringVariable.s) ]=-
AutoItX3.pbi
While I'm not sure writing the converter was a good use of time (it may have been faster just to convert by hand), the result looks good and seems to work -- I have not done extensive testing, but it is every function they list in the autoitx help file/c header.
-=[ edit 2018/11/15: I think this includes most (all?) functions in the autoitx3 dll Not all AutoIt functions are exported; I commented out the ones that are not present in the dll; I think I got all the declares consistient (ie: declares with *StringVariable rather than stringVariable.s) ]=-
AutoItX3.pbi
Code: Select all
; File AutoItX3.pbi
; Forum: https://www.purebasic.fr/english/viewtopic.php?f=5&t=62157
;
#AU3_INTDEFAULT=(-2147483647)
Import "AutoItX3_x64.lib"
AU3_Init()
AU3_error()
AU3_AutoItSetOption( *szOption, nValue)
AU3_Opt( *szOption, nValue)
AU3_Send( *szSendText, nMode = 0)
; not exported: AU3_BlockInput(nFlag)
; not exported: AU3_CDTray(*szDrive, *szAction)
AU3_IsAdmin()
AU3_Shutdown( nFlags)
AU3_Sleep( nMilliseconds)
AU3_ClipGet( *szClip, nBufSize)
AU3_ClipPut( *szClip)
AU3_DriveMapAdd( *szDevice, *szShare, nFlags, *szUser, *szPwd, *szResult, nBufSize)
AU3_DriveMapDel( *szDevice)
AU3_DriveMapGet( *szDevice, *szMapping, nBufSize)
; not exported: AU3_IniDelete(*szFilename, *szSection, *szKey)
; not exported: AU3_IniRead(*szFilename, *szSection, *szKey, *szDefault, *szValue, nBufSize.i)
; not exported: AU3_IniWrite(*szFilename, *szSection, *szKey, *szValue)
AU3_ProcessClose( *szProcess)
AU3_ProcessExists( *szProcess)
AU3_ProcessSetPriority( *szProcess, nPriority)
AU3_ProcessWait( *szProcess, nTimeout = 0)
AU3_ProcessWaitClose( *szProcess, nTimeout = 0)
; not exported: AU3_RegDeleteKey(*szKeyname)
; not exported: AU3_RegDeleteVal(*szKeyname, *szValueName)
; not exported: AU3_RegEnumKey(*szKeyname, nInstance, *szResult, nBufSize.i)
; not exported: AU3_RegEnumVal(*szKeyname, nInstance, *szResult, nBufSize.i)
; not exported: AU3_RegRead(*szKeyname, *szValueName, *szRetText, nBufSize.i)
; not exported: AU3_RegWrite(*szKeyname, *szValueName, *szType, *szValue)
AU3_Run( *szProgram, *szDir, nShowFlag = #SW_SHOWNORMAL)
AU3_RunAs( *szUser, *szDomain, *szPassword, nLogonFlag, *szProgram, *szDir, nShowFlag = #SW_SHOWNORMAL)
; not exported: AU3_RunAsSet(*szUser, *szDomain, *szPassword, nOptions.i)
AU3_RunAsWait( *szUser, *szDomain, *szPassword, nLogonFlag, *szProgram, *szDir, nShowFlag = #SW_SHOWNORMAL)
AU3_RunWait( *szProgram, *szDir, nShowFlag = #SW_SHOWNORMAL)
AU3_PixelChecksum(*lpRect.RECT, nStep=1)
AU3_PixelGetColor( nX, nY)
AU3_PixelSearch(*lpRect.RECT, nCol, nVar, nStep, *pPoResult)
AU3_MouseClick( *szButton, nX = #AU3_INTDEFAULT, nY = #AU3_INTDEFAULT, nClicks = 1, nSpeed = -1)
AU3_MouseClickDrag( *szButton, nX1, nY1, nX2, nY2, nSpeed = -1)
AU3_MouseDown( *szButton)
AU3_MouseGetCursor()
AU3_MouseGetPos(*lpPo.RECT)
; not exported: AU3_MouseGetPosX()
; not exported: AU3_MouseGetPosY()
AU3_MouseMove( nX, nY, nSpeed = -1)
AU3_MouseUp( *szButton)
AU3_MouseWheel( *szDirection, nClicks)
AU3_ControlClick( *szTitle, *szText, *szControl, *szButton, nNumClicks, nX = #AU3_INTDEFAULT, nY = #AU3_INTDEFAULT)
AU3_ControlClickByHandle( hWnd, hCtrl, *szButton, nNumClicks, nX = #AU3_INTDEFAULT, nY = #AU3_INTDEFAULT)
AU3_ControlCommand( *szTitle, *szText, *szControl, *szCommand, *szExtra, *szResult, nBufSize)
AU3_ControlCommandByHandle( hWnd, hCtrl, *szCommand, *szExtra, *szResult, nBufSize)
AU3_ControlDisable( *szTitle, *szText, *szControl)
AU3_ControlDisableByHandle( hWnd, hCtrl)
AU3_ControlEnable( *szTitle, *szText, *szControl)
AU3_ControlEnableByHandle( hWnd, hCtrl)
AU3_ControlFocus( *szTitle, *szText, *szControl)
AU3_ControlFocusByHandle( hWnd, hCtrl)
AU3_ControlGetFocus( *szTitle, *szText, *szControlWithFocus, nBufSize)
AU3_ControlGetFocusByHandle( hWnd, *szControlWithFocus, nBufSize)
AU3_ControlGetHandle( hWnd, *szControl)
AU3_ControlGetHandleAsText( *szTitle, *szText, *szControl, *szRetText, nBufSize)
AU3_ControlGetPos(*szTitle, *szText, *szControl, *lpRect.RECT)
AU3_ControlGetPosByHandle(hWnd, hCtrl, *lpRect.RECT)
; not exported: AU3_ControlGetPosHeight(*szTitle, *szText, *szControl)
; not exported: AU3_ControlGetPosWidth(*szTitle, *szText, *szControl)
; not exported: AU3_ControlGetPosX(*szTitle, *szText, *szControl)
; not exported: AU3_ControlGetPosY(*szTitle, *szText, *szControl)
AU3_ControlGetText( *szTitle, *szText, *szControl, *szControlText, nBufSize)
AU3_ControlGetTextByHandle( hWnd, hCtrl, *szControlText, nBufSize)
AU3_ControlHide( *szTitle, *szText, *szControl)
AU3_ControlHideByHandle( hWnd, hCtrl)
AU3_ControlListView( *szTitle, *szText, *szControl, *szCommand, *szExtra1, *szExtra2, *szResult, nBufSize)
AU3_ControlListViewByHandle( hWnd, hCtrl, *szCommand, *szExtra1, *szExtra2, *szResult, nBufSize)
AU3_ControlMove( *szTitle, *szText, *szControl, nX, nY, nWidth = -1, nHeight = -1)
AU3_ControlMoveByHandle( hWnd, hCtrl, nX, nY, nWidth = -1, nHeight = -1)
AU3_ControlSend( *szTitle, *szText, *szControl, *szSendText, nMode = 0)
AU3_ControlSendByHandle( hWnd, hCtrl, *szSendText, nMode = 0)
AU3_ControlSetText( *szTitle, *szText, *szControl, *szControlText)
AU3_ControlSetTextByHandle( hWnd, hCtrl, *szControlText)
AU3_ControlShow( *szTitle, *szText, *szControl)
AU3_ControlShowByHandle( hWnd, hCtrl)
AU3_ControlTreeView( *szTitle, *szText, *szControl, *szCommand, *szExtra1, *szExtra2, *szResult, nBufSize)
AU3_ControlTreeViewByHandle( hWnd, hCtrl, *szCommand, *szExtra1, *szExtra2, *szResult, nBufSize)
AU3_StatusbarGetText( *szTitle, *szText, nPart, *szStatusText, nBufSize)
AU3_StatusbarGetTextByHandle( hWnd, nPart, *szStatusText, nBufSize)
AU3_ToolTip( *szTip, nX = #AU3_INTDEFAULT, nY = #AU3_INTDEFAULT)
AU3_WinActivate( *szTitle, *szText)
AU3_WinActivateByHandle( hWnd)
AU3_WinActive( *szTitle, *szText)
AU3_WinActiveByHandle( hWnd)
AU3_WinClose( *szTitle, *szText)
AU3_WinCloseByHandle( hWnd)
AU3_WinExists( *szTitle, *szText)
AU3_WinExistsByHandle( hWnd)
AU3_WinGetCaretPos(*lpPo.RECT)
; not exported: AU3_WinGetCaretPosX()
; not exported: AU3_WinGetCaretPosY()
AU3_WinGetClassList( *szTitle, *szText, *szRetText, nBufSize)
AU3_WinGetClassListByHandle( hWnd, *szRetText, nBufSize)
AU3_WinGetClientSize(*szTitle, *szText, *lpRect.RECT)
AU3_WinGetClientSizeByHandle(hWnd, *lpRect.RECT)
; not exported: AU3_WinGetClientSizeHeight(*szTitle, *szText )
; not exported: AU3_WinGetClientSizeWidth(*szTitle, *szText )
AU3_WinGetHandle( *szTitle, *szText)
AU3_WinGetHandleAsText( *szTitle, *szText, *szRetText, nBufSize)
AU3_WinGetPos(*szTitle, *szText, *lpRect.RECT)
AU3_WinGetPosByHandle(hWnd, *lpRect.RECT)
; not exported: AU3_WinGetPosHeight(*szTitle, *szText )
; not exported: AU3_WinGetPosWidth(*szTitle, *szText )
; not exported: AU3_WinGetPosX(*szTitle, *szText )
; not exported: AU3_WinGetPosY(*szTitle, *szText )
AU3_WinGetProcess( *szTitle, *szText)
AU3_WinGetProcessByHandle( hWnd)
AU3_WinGetState( *szTitle, *szText)
AU3_WinGetStateByHandle( hWnd)
AU3_WinGetText( *szTitle, *szText, *szRetText, nBufSize)
AU3_WinGetTextByHandle( hWnd, *szRetText, nBufSize)
AU3_WinGetTitle( *szTitle, *szText, *szRetText, nBufSize)
AU3_WinGetTitleByHandle( hWnd, *szRetText, nBufSize)
AU3_WinKill( *szTitle, *szText)
AU3_WinKillByHandle( hWnd)
; not exported: AU3_WinList(*szTitle, *szText )
AU3_WinMenuSelectItem( *szTitle, *szText, *szItem1, *szItem2, *szItem3, *szItem4, *szItem5, *szItem6, *szItem7, *szItem8)
AU3_WinMenuSelectItemByHandle( hWnd, *szItem1, *szItem2, *szItem3, *szItem4, *szItem5, *szItem6, *szItem7, *szItem8)
AU3_WinMinimizeAll()
AU3_WinMinimizeAllUndo()
AU3_WinMove( *szTitle, *szText, nX, nY, nWidth = -1, nHeight = -1)
AU3_WinMoveByHandle( hWnd, nX, nY, nWidth = -1, nHeight = -1)
AU3_WinSetOnTop( *szTitle, *szText, nFlag)
AU3_WinSetOnTopByHandle( hWnd, nFlag)
AU3_WinSetState( *szTitle, *szText, nFlags)
AU3_WinSetStateByHandle( hWnd, nFlags)
AU3_WinSetTitle( *szTitle, *szText, *szNewTitle)
AU3_WinSetTitleByHandle( hWnd, *szNewTitle)
AU3_WinSetTrans( *szTitle, *szText, nTrans)
AU3_WinSetTransByHandle( hWnd, nTrans)
AU3_WinWait( *szTitle, *szText, nTimeout = 0)
AU3_WinWaitActive( *szTitle, *szText, nTimeout = 0)
AU3_WinWaitActiveByHandle( hWnd, nTimeout)
AU3_WinWaitByHandle( hWnd, nTimeout)
AU3_WinWaitClose( *szTitle, *szText, nTimeout = 0)
AU3_WinWaitCloseByHandle( hWnd, nTimeout)
AU3_WinWaitNotActive( *szTitle, *szText, nTimeout)
AU3_WinWaitNotActiveByHandle( hWnd, nTimeout = 0)
EndImport
AU3_Init()
#SW_ENABLE = 64
#SW_DISABLE = 65
Procedure _WinWaitActive( title$, text$, timeout=0)
If AU3_WinWait( title$,text$, timeout)
If Not au3_winactive(title$,text$) : AU3_WinActivate(title$,text$) : EndIf
AU3_WinWaitActive( title$,text$,timeout)
EndIf
ProcedureReturn AU3_WinActivate( title$,text$)
EndProcedure
Procedure.s GetKeyboardLayoutName()
Protected *p=AllocateMemory(100)
Protected.s layoutName
If GetKeyboardLayoutName_(*p)
layoutName = PeekS(*p)
EndIf
FreeMemory(*p)
ProcedureReturn layoutName
EndProcedure
Procedure _Au3RecordSetup()
AU3_Opt("WinWaitDelay",100)
au3_opt("WinDetectHiddenText",1)
au3_opt("MousecoordMode",0)
au3_opt("WinTitleMatchMode", -1)
If GetKeyboardLayoutName() <> "00000409"
dbgout("WARNING: Not the proper keyboard layout")
EndIf
EndProcedure
Macro _WinAPI_SetForegroundWindow( h ) : SetForegroundWindow_(h) : EndMacro
Macro _WinAPI_SetActiveWindow( h ) : SetActiveWindow_(h) : EndMacro
Macro _WinAPI_EnableWindow(h,e) : EnableWindow_(h,e) : EndMacro