Jump to content

Auto3Lib


PaulIA
 Share

Recommended Posts

mmmm well

it works thx !

i don't understand you structure at all

if i read this

custom draw listview

i understand the it should be two differents structures, but...i don't know

another point : how to get the drawstage ? it's the start of everything to get the drawstage and then play with this (if i understand well)

The NMLVCUSTOMDRAW structure has two other structures embedded inside of it. Since AutoIt can't handle this, I have just "unfolded" these embedded structures. I played with this a little more and found that the _tagNMLVCUSTOMDRAW structure was missing a couple of fields. I have corrected the previous post to correct this. I have also added more code to the skeleton framework post to show you how to get the DrawStage field.

You asked me not to do this for you, so I'm trying just to give you what you are asking for. If you need more help, feel free to run up the white flag and I'll post a full piece of code. I do admire that you're trying to work this out for yourself though, so keep plugging away. :whistle:

Auto3Lib: A library of over 1200 functions for AutoIt
Link to comment
Share on other sites

Hi PaulIA

I have question: Will you rewrite your library with new AutoIt syntax to use named struct items instead of your own _tag functions?

From latest AutoIt beta 3.2.3.0 changelog:

- Added: DllStruct...() can reference elements by name.

- Added: Struct variables

I downloaded the new beta when it came out and have been playing with the new structure syntax. I will be converting Auto3Lib over to the new syntax in the future, but I'm going to wait for a few more releases to give the bugs time to shake out. I've written a script that will replace the _tag... statements with DllStruct... statements, so it will be an easy conversion. However, I don't want to force everybody to have to use the beta code just for this.
Auto3Lib: A library of over 1200 functions for AutoIt
Link to comment
Share on other sites

I do admire that you're trying to work this out for yourself though, so keep plugging away

thx a lot !

i do my possible to increase my knowledge and to make your library and autoit better

-- Arck System _ Soon -- Ideas make everything

"La critique est facile, l'art est difficile"

Projects :

[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list]
Link to comment
Share on other sites

Hi,

I'm having some problems with _LanMan_NetShareEnum. Although the code below is not what I'm using in my script, it crashes with the same error as my script does:

Local $f
Local $shares
For $f = 1 To 10
   $shares = _LanMan_NetShareEnum()
Next

The error I get is:

Line 2377 (File "C:\AutoIt\Current\Include\A3LWinAPI.au3"):

$aResult = DllCall("Kernel32.dll", "int", "WideCharToMultiByte", "int", 0, "int", 0, "ptr", $pUnicode, "int",

$iBuffLen / 2, "ptr", $pBuffer, "int", $iBuffLen, "int", 0, "int", 0)

$aResult = DllCall("Kernel32.dll", "int", "WideCharToMultiByte", "int", 0, "int"^ ERROR

Error: Error in expression.

Without getting into the details of my script, the above illustrates the problem I'm having with consecutive calls to _LanMan_NetShareEnum, in order to list the shared resources on the local machine.

I'm using Windows 2000 SP4, AutoIt 3.2.2.0, and the Auto3Lib dated March 1, 2007.

Please can you help. Thanks.

Regards,

Jonny

Link to comment
Share on other sites

Hi,

I'm having some problems with _LanMan_NetShareEnum. Although the code below is not what I'm using in my script, it crashes with the same error as my script does:

Local $f
Local $shares
For $f = 1 To 10
   $shares = _LanMan_NetShareEnum()
Next

The error I get is:

Without getting into the details of my script, the above illustrates the problem I'm having with consecutive calls to _LanMan_NetShareEnum, in order to list the shared resources on the local machine.

I'm using Windows 2000 SP4, AutoIt 3.2.2.0, and the Auto3Lib dated March 1, 2007.

Please can you help. Thanks.

Regards,

Jonny

I think you've got a module from an old version of Auto3Lib. The A3LLanMan.au3 file was replaced with the A3LNetShare.au3 file several versions ago. Make sure you delete all the A3L*.au3 files from the AutoIt\Include folder and then dump the latest Auto3Lib files from the March 1st release back in.
Auto3Lib: A library of over 1200 functions for AutoIt
Link to comment
Share on other sites

Hi, Paulia,

Thanks for all this.

I cannot, however, get listview examples to work.

I have even tried to install using the installer .au3 someone wrote. [PS - perhaps the installer needs fixing; looks like it created 2 copies in my include dir of each A3L file????? - ie did not overwrite new files?]

I get all sorts of errors;

1. [EDIT- deleted number1] - worked out I can't have the include files in current directory as well as include for my duplicated vars

** but do the scripts HAVE to be in the Examples folder too? - I don't get it! ******

2. some sort of "ID=-1" error; varies [eg _mem_init:_API_getwindowThreadProcessID=-1" or similar]

3. sometimes I get asked to insert a disc in D drive, after opening "My Docs" folder, then it errors out.

What am I doing wrong?

I'd like to be able to use and test these?

Best, randall

Edited by randallc
Link to comment
Share on other sites

Hi,

I get a demo ListView at only about 80 items/sec ; how do you get 1000/sec?

Best, Randall

;ListView1A3L.au3
#include <A3LImageList.au3>
#include <A3LListView.au3>
Opt("MustDeclareVars", 1)
Global $cMaxX = 500                   ; Maximum GUI width allowed
Global $cMaxY = 400                   ; Maximum GUI height allowed
Global $hGUI, $iGUIH, $iGUIW, $hList, $hImage, $s_RandomListItem, $ar_RandomListItem[1], $timerstamp1
; =================================================================================================
; Main
CreateGUI()
$timerstamp1 = TimerInit()
For $i = 1 To 50;00;4200; it also works quicker over 4000, but starts slowing down as "_GUICtrlListViewInsertItem" used
    $s_RandomListItem = $i & "|line" & Random(-10000, 10000, 1) & "|" & Random(-10000, 10000, 1) & "|more_" & Chr(Random(Asc("a"), Asc("z"), 1)) & Chr(Random(Asc("a"), Asc("z"), 1)) & String(Random(-10000, 10000, 1))
    GUICtrlCreateListViewItemA3L($s_RandomListItem, $hList);, -1, 0, 1)
Next
ConsoleWrite("Time New :" & Round(TimerDiff($timerstamp1)) & " mseconds to create" & @LF)
MsgLoop()
; =================================================================================================
Func GUICtrlCreateListViewItemA3L($s_RandomListItemf, $hListf)
    Local $ar_RandomListItemf[1]
    $ar_RandomListItemf = StringSplit($s_RandomListItemf, "|")
    _ListView_AddItem ($hList, $i - 1, $ar_RandomListItemf[1])
    For $s = 1 To UBound($ar_RandomListItemf) - 1
        _ListView_AddSubItem ($hList, $i - 1, $ar_RandomListItemf[$s], $s - 1)
    Next
    
EndFunc   ;==>_GUICtrlCreateListViewItemA3L
Func GuiCtrlCreateListViewA3L($s_ColHeadingsf, $a, $b, $c, $d)
    Local $ar_ColHeadingsf[1]
    $hList = _ListView_Create ($hGUI, $a, $b, $c, $d)
    $hImage = _ImageList_Create ()
    _ListView_SetImageList ($hList, $hImage, 1); "Index|col1     |col2|col3"
    $ar_ColHeadingsf = StringSplit($s_ColHeadingsf, "|")
    For $s = 1 To UBound($ar_ColHeadingsf) - 1
        _ListView_InsertColumn ($hList, $s, $ar_ColHeadingsf[$s], 100, "left", $s)
    Next
EndFunc   ;==>GuiCtrlCreateListViewA3L
Func CreateGUI()
    $hGUI = GUICreate("listview items", 810, 623, (@DesktopWidth - 800) / 2, (@DesktopHeight - 600) / 2, $WS_MAXIMIZEBOX + $WS_MINIMIZEBOX)
    GuiCtrlCreateListViewA3L("Index|col1     |col2|col3", 10, 10, 790, 530);, $LVS_SHOWSELALWAYS, BitOR($LVS_EX_GRIDLINES, $LVS_EX_HEADERDRAGDROP, $LVS_EX_FULLROWSELECT, $LVS_EX_REGIONAL));Drag&Drop Columns
    GUISetState()
EndFunc   ;==>CreateGUI
Func MsgLoop()
    $iGUIH = _API_GetClientHeight ($hGUI)
    $iGUIW = _API_GetClientWidth ($hGUI)
;~   GUIRegisterMsg($WM_SIZE  , "WM_SIZE"            )
;~   GUIRegisterMsg($WM_SIZING, "WM_SIZING"          )
    GUIRegisterMsg($WM_NOTIFY, "_ListView_WM_NOTIFY")
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc   ;==>MsgLoop
Link to comment
Share on other sites

I think you've got a module from an old version of Auto3Lib. The A3LLanMan.au3 file was replaced with the A3LNetShare.au3 file several versions ago. Make sure you delete all the A3L*.au3 files from the AutoIt\Include folder and then dump the latest Auto3Lib files from the March 1st release back in.

Thanks Paul. That's what the problem was.

Regards.

Jonny

Link to comment
Share on other sites

Hi,

I get a demo ListView at only about 80 items/sec ; how do you get 1000/sec?

Best, Randall

I had performed the speed tests on the ListView prior to changing to the new _tag... structure. At the time, the new structure was more important than speed as AutoIt was never designed to be a speed demon. With the latest beta, the Struct...EndStruct addition will allow me to do the same thing I was doing with the _tag... calls, so I will be switching to the new Struct convention over the next few releases. If you want to perform some speed tests with how the new Auto3Lib ListView will be after this switch, try this code (requires latest beta):

#include <A3LListView.au3>

Opt("MustDeclareVars", 1)

Global $hGUI, $hList, $iI, $iTimer

$hGUI  = GUICreate("ListView", 400, 300)
$hList = _ListView_Create($hGUI, 2, 2, 394, 268)
GUISetState()

_ListView_InsertColumn($hList, 0, "Items", 100)
$iTimer = TimerInit()
_ListView_BeginUpdate($hList)
for $iI = 1 to 5000
  _LV_InsertItem($hList, 5000, "Item " & $iI)
next
_ListView_EndUpdate($hList)
_Lib_ShowMsg("Insertion time: " & TimerDiff($iTimer) / 1000 & " seconds")

do
until GUIGetMsg() = $GUI_EVENT_CLOSE

Func _LV_InsertItem($hWnd, $iIndex, $sText)
  Local $tBuffer, $tItem

  $tBuffer = DllStructCreate(tagBuffer(4096))
  $tItem   = DllStructCreate(tagLVITEM())
  $tBuffer.Text  = $sText
  $tItem.Mask    = $LVIF_TEXT
  $tItem.Item    = $iIndex
  $tItem.TextMax = 4096
  ; Simulate the overhead of checking for an external control
  if _Lib_InProcess($hwnd) then
    $tItem.Text = DllStructGetPtr($tBuffer)
    Return _API_SendMessage($hWnd, $LVM_INSERTITEM, 0, DllStructGetPtr($tItem))
  else
    ; 
  endif
EndFunc

Func tagBuffer($iSize)
  Return "char Text[" & $iSize & "]"
EndFunc

Func tagLVITEM()
  Return "int Mask; int Item; int SubItem; int State; int StateMask; ptr Text; int TextMax; " & _
         "int Image; int Param; int Indent; int GroupID; int Columns; int pColumns"
EndFunc

I ran this on a 3GHz machine and I get about 2,500 items/second and the insertion time is linear (ie. 5,000 items takes 2 seconds, 7,500 items takes 3 seconds, etc.)

Edited by PaulIA
Auto3Lib: A library of over 1200 functions for AutoIt
Link to comment
Share on other sites

Hi,

OK, thanks; I presume I just wait and see?

The example you posted produces the speed you expected on my machine too; although

1. No ListView items show (because it is not updated yet??)

2. No SubItem routine; perhaps that is the slow point anyway?

Best, randall

[PS -3. was I right in my esarlier question; do these scripts only run if they are in the Examples folder???]

Link to comment
Share on other sites

Hi,

OK, thanks; I presume I just wait and see?

Yes, it takes a while to convert 1,200 functions...

1. No ListView items show (because it is not updated yet??)

Fixed in the script above.

2. No SubItem routine; perhaps that is the slow point anyway?

Of course there are SubItem routines, I just didn't put them in this script.

[PS -3. was I right in my esarlier question; do these scripts only run if they are in the Examples folder???]

Some of the scripts need the images from the Image folder. You can modify them to run where ever you want. Edited by PaulIA
Auto3Lib: A library of over 1200 functions for AutoIt
Link to comment
Share on other sites

OK, thanks;

with subitems in previous example is about 4X as slow as without; so I presume the same factor; this means your routines will match ""_GUICtrlListViewInsertItem" approximately for speed, I suspect; we will wait and see?

Best, Randall

Edited by randallc
Link to comment
Share on other sites

OK, thanks;

with subitems in previous example is about 4X as slow as without; so I presume the same factor; this means your routines will match ""_GUICtrlListViewInsertItem" approximately for speed, I suspect; we will wait and see?

Best, Randall

Well, I don't know about your example, but each column that you add will double the insertion time, which is only logical as you're making twice as many calls to the control to insert the subitems. You make it sound like there is some flaw because it takes 4 times longer to do 4 times as much work. I guess I don't get what you're trying to prove.
Auto3Lib: A library of over 1200 functions for AutoIt
Link to comment
Share on other sites

Well, I don't know about your example, but each column that you add will double the insertion time, which is only logical as you're making twice as many calls to the control to insert the subitems. You make it sound like there is some flaw because it takes 4 times longer to do 4 times as much work. I guess I don't get what you're trying to prove.

Sorry, I'm not meaning to sound like there's a flaw; I was just a little disappointed to make the comparison and find no speed difference, as I has interpreted your original claim to mean your method might be different and therefore faster; I am still looking for a faster sort of ListView; but probably needs a C programmer to do a dll, I'm afraid...

Best, Randall

Edited by randallc
Link to comment
Share on other sites

This release contains a module for dealing with pipes. I had written a CreatePipe function for one of the forum members in the last release and the opportunity arose to finish out the rest of the pipe functions. Along with the console demo that shows how to execute a console command and read the output, I have developed a simple client/server pipe demo that shows how to execute console commands on a remote server.

Hello PaulIA

Named pipes are a good answer to lots of my problems :whistle:

I just tried your client/server example, it worked with <local> but not with 127.0.0.1 (no firewall).

Would you give an example for a remote server ?

Can a server and its clients run on different IPs ?

Regards,

Apzo.

Link to comment
Share on other sites

Would you give an example for a remote server ?

Can a server and its clients run on different IPs ?

i can answer to this

yes, clients and servers can run on different servers

you have to go on msdn and learn how pipes works before doing anything

it's not a simple tcp application.

for the problem with <local> and 127.0.0.1, i don't think it's a big problem

perhaps with posting some code paul or me can help you out

if Paul let me answer XD, of course

@randallc

i play with the listview of the library and i can say you that it's faster that autoit implemented listview

maybe you could provide an example where you think that it's slow, because i'm sure it's not

i've developped many scripts with the listview of the library, and it's just too cool, because really fast

-- Arck System _ Soon -- Ideas make everything

"La critique est facile, l'art est difficile"

Projects :

[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list]
Link to comment
Share on other sites

Hello PaulIA

Named pipes are a good answer to lots of my problems :whistle:

I just tried your client/server example, it worked with <local> but not with 127.0.0.1 (no firewall).

Would you give an example for a remote server ?

Can a server and its clients run on different IPs ?

Regards,

Apzo.

As per the MSDN documentation, the format for a pipe name is "\\ServerName\pipe\PipeName". To specify a local server, a period is used for the server name. If you look at the pipe Client source code, you'll see that I look for "<local>" in the server name and replace it with a period when I create the pipe. I could have looked for "127.0.0.1" and done the same thing.

So the demo already works with a remote server. Just use the server name, not the IP address.

Auto3Lib: A library of over 1200 functions for AutoIt
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...