-
Posts
36 -
Joined
-
Last visited
Everything posted by waardd
-
GUICTRLCreateEdit v.s. MSGBOX formatting
waardd replied to waardd's topic in AutoIt General Help and Support
If i put in the data myself that would be great but.... The StdOut of plink.exe puts in the data. It goes like this: Global $ret = _MyRun("C:uldplink.exe -v -pw "&$connectww&" "&$connectuser&"@"&$connectserver&$command&$tocheck) GUICtrlSetData($output, $ret) My Editfield shows it as one string. But if i msgbox it it shows it formatted. Entry: blablablaUsername: xxxxxxxxUser ID: 29022Primary group: blablablaCompany ID: lkdjfsldkfjUser info: pa, Jones (John), 465100Email address: something@dot.comCreated: Wed Oct 5 07:23:34 CEST 2011Password expire: Sun Aug 5 05:35:40 CEST 2012User revoke date: (none)Exp. warned: 0Failed logins: 0Authgroup: Sysgroup: vallues But if i msgbox it it shows it formatted MsgBox(0,"test",$ret) --------------------------- blablabla --------------------------- Entry: blablabla Username: xxxxxxxx User ID: 29022 Primary group: blablabla Company ID: lkdjfsldkfj User info: pa, Jones (John), 465100 Email address: something@dot.com Created: Wed Oct 5 07:23:34 CEST 2011 Password expire: Sun Aug 5 05:35:40 CEST 2012 User revoke date: (none) Exp. warned: 0 Failed logins: 0 Authgroup: Sysgroup: vallues --------------------------- OK --------------------------- -
The title is a little wierd but here is my problem. I have a plink output wich displays a big chunck of output. If i put it in a messagebox the formatting is good. All lines are under each other and its good readable. When i put the output in a editfield it displays as one long string. My question is How can i control the edit field so it displays as lines as well like the messagebox?
-
Thanks to Water!!! That UDF did the trick. It read the complete file!!! Tnx
-
What i get is the first 524 lines of my list. If i'm correct its 33274 characters in total (including the keynn=).... so it could be that it is running into a limitation... Damn...... Any suggestions?
-
Hi there, Im stumbling upon a problem. I have a file with several arrayentrys wich i load in to my arry with a function. But when i read thge array with the combobox it displays only a part of the lines? I have a total of 677 lines and the last entry in my combo is line 524 File to read: [sERVERLIJST] key1=aardslang rbf (A)|AIX|A|rbf|aardslang.mydomain . . . key677=xat1 ssox (O)|AIX|O|ssox|xat1.mydomain My functions to load array and send array to combo are: Func _populateARRAY() ; Get the entries Local $srvREAD = IniReadSection("c:\mvdd\settings\serverlijst.ini", "SERVERLIJST") ; Size the Global array correctly Global $ASservers[$srvREAD[0][0] + 1][6] ; Declare this Local array outside the loop Local $srvREAD2 For $i = 1 To $srvREAD[0][0] ; Split the delimited string into an array $srvREAD2 = StringSplit($srvREAD[$i][1], "|") ; Now add the elements to the Global array For $j = 1 To $srvREAD2[0] $ASservers[$i][$j] = $srvREAD2[$j] Next Next EndFunc ;==>_populateARRAY Func _FillCombo() $sServer_Data = "" For $i = 1 To UBound($ASservers) - 1 $sServer_Data &= "|" & $ASservers[$i][1] Next GUICtrlSetData($Cmb_Servers, $sServer_Data) EndFunc My combois formatted as: $Cmb_Servers = GUICtrlCreateCombo("Cmb_Servers", 90, 15, 160, 25, BitOR($CBS_DROPDOWNLIST,$WS_VSCROLL, $CBS_SORT))
-
count number of specific windows
waardd replied to waardd's topic in AutoIt General Help and Support
EUREKA!!! I got it working. With help from a routine by bobsyuruncle I coded it like this: #include <Array.au3> Global $maxlines, $Wlist, $hwnd $Wlist = winlist() $Plist = ProcessList("putty.exe") ;_ArrayDisplay($Wlist,"Wlist") ;_ArrayDisplay($Plist,"Processlist") $maxlinesW = $Wlist[0][0] $maxlinesP = $Plist[0][0] ConsoleWrite("WinlistAantal "&$maxlinesW&@CRLF) ConsoleWrite("PlistAantal "&$maxlinesP&@CRLF) Global $puttyarray[1] _ArrayDisplay($puttyarray) For $j = 1 to $maxlinesP $hwnd = _GetHwndFromPID($Plist[$j][1]) ConsoleWrite("Gevonden PID's> "&$Plist[$j][0]&" "&$Plist[$j][1]&" met hwnd "&$HWND&@CRLF&@CRLF) For $i = 1 to $maxlinesW if $Wlist[$i][1] = $hwnd then Consolewrite($Wlist[$i][0]&" "&$Wlist[$i][1]&@CRLF) $arrayline = $Wlist[$i][0]&" "&$Wlist[$i][1] _arrayadd($puttyarray, $arrayline) EndIf Next Next _ArrayDelete($puttyarray, 0) _ArrayDisplay($puttyarray) Func _GetHwndFromPID($PID); Tnx for this routine bobsyuruncle $hWnd = 0 $stPID = DllStructCreate("int") Do $winlist2 = WinList() For $i = 1 To $winlist2[0][0] If $winlist2[$i][0] <> "" Then DllCall("user32.dll", "int", "GetWindowThreadProcessId", "hwnd", $winlist2[$i][1], "ptr", DllStructGetPtr($stPID)) If DllStructGetData($stPID, 1) = $PID Then $hWnd = $winlist2[$i][1] ExitLoop EndIf EndIf Next Sleep(100) Until $hWnd <> 0 Return $hWnd EndFunc ;==>_GetHwndFromPID -
count number of specific windows
waardd replied to waardd's topic in AutoIt General Help and Support
Arraysearch returns the rowvalue for a partial string, however as said in earlier posts, this is a very variiable string. What im looking for (i think) is this. put processes in a list with winlist()search the putty sessions with a routine that links PID to HWNDput the result in a new arrayprocess the new array -
count number of specific windows
waardd replied to waardd's topic in AutoIt General Help and Support
That depends. Sometimes its just a servername in the Title and sometimes the complete info like lsrv4172 as waarddd /home/waarddd in the title as mentioned before. The examples where all from the title bar. I can winlist() to put all processes in an array but i can't search on a partial string in the array. -
count number of specific windows
waardd replied to waardd's topic in AutoIt General Help and Support
Nope sorry Any other idea's ?? >>>> Window <<<< Title: ridgeback as waardd /home/tab_unix/waardd Class: PuTTY Position: 175, 175 Size: 675, 424 Style: 0x14EF0000 ExStyle: 0x00000100 Handle: 0x00260C18 >>>> Control <<<< Class: Instance: ClassnameNN: Name: Advanced (Class): ID: Text: Position: Size: ControlClick Coords: Style: ExStyle: Handle: >>>> Mouse <<<< Position: 257, 82 Cursor ID: 0 Color: 0x000000 >>>> StatusBar <<<< >>>> ToolsBar <<<< >>>> Visible Text <<<< -
Use diskusage function for multiple disks
waardd replied to waardd's topic in AutoIt General Help and Support
Tnx Hannes08 I found the functions and combined it with my script to look something like this #include <GUIConstantsEx.au3> $Form1_1 = GUICreate("DiscInfo", 615, 350, 192, 124) $var = DriveGetDrive( "all" ) If NOT @error Then For $i = 1 to $var[0] $FileSys = DriveGetFileSystem( $var[$i] ) $SizeFree = (DriveSpaceFree( $var[$i] )/1024) $SizeTotal = (DriveSpaceTotal($var[$i])/1024) $SizeUsed = $SizeTotal - $SizeFree $PercUsed = ($SizeUsed/$SizeTotal)*100 $PercRounded2 = StringFormat("%.2f", $PercUsed) if $PercRounded2 < 0 Then GUICtrlCreateLabel("Drive "&$var[$i]&" is unknown",10,$i*15, 190) Else GUICtrlCreateLabel("Drive "&$var[$i]&" uses "&$PercRounded2&" %",10,$i*15, 190) GUICtrlCreateProgress(200,$i*15,200,15,-1,-1) GuiCtrlSetData(-1,$PercUsed) EndIf Next EndIf GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd This is with help from example script for compinfo.au3 by JSThePatriot -
I have a function to calculate diskusage and set it on a progressbar. $PercC = GUICtrlCreateLabel("",20,55,125,15,-1,-1) $BarC = GUICtrlCreateProgress(20,40,200,15,-1,-1) Func _diskC() $FileSys = DriveGetFileSystem( "c:\" ) $SizeFree = (DriveSpaceFree( "c:\" )/1024) $SizeTotal = (DriveSpaceTotal("c:\")/1024) $SizeUsed = $SizeTotal - $SizeFree $PercUsed = ($SizeUsed/$SizeTotal)*100 $PercRounded2 = StringFormat("%.2f", $PercUsed)&"% in use op C:" GuiCtrlSetData($BarC,$PercUsed) GuiCtrlSetData($PercC,$PercRounded2) EndFunc What i want is a automated routine to do this for al disks in a system independant of the configuration and show them al in on screen (kinda like explorer in windows)
-
count number of specific windows
waardd replied to waardd's topic in AutoIt General Help and Support
Here are some title examples of putty sessions bobtail as waardd /home/tab_unix/waardd ridgeback as waardd /home/tab_unix/waardd lsrv4172 as waarddd /home/waarddd lsrv1173 as waarddd /home/waarddd lsrv1173 as gkkp /appl/gkk/prod tuatara snuitmot waarddd@lsrv1200:~ So you see there are lots of options -
count number of specific windows
waardd replied to waardd's topic in AutoIt General Help and Support
I want to count the windows that are running a putty session. To count the processes i already have a function. Each putty session (putty.exe proces) can have a different connection and therefor a different window title. Example: window title 1: lsrv1200 as waardd window title 2: spinner as waardd window title 3: spinner as waard window title 4: lsrv1300 as waard what i want is a list of connections like: connected to spinner 2 times connected to lsrv1200 1 time connected to lsrv1300 1 time But remember te window title varies a lot!! -
Check status co-worker in communicator 2007
waardd replied to waardd's topic in AutoIt General Help and Support
Tnx Furek86. This really helped me out -
I have a function that can count instances of putty.exe Func _puttyteller();check aantal puttys $list = ProcessList() $puttycount = 0 ;_ArrayDisplay($list) For $i = 1 To $list[0][0] If $list[$i][0] = "putty.exe" Then $puttycount = $puttycount + 1 EndIf Next GuiCtrlSetData($Inputputtycount, $puttycount) ;MsgBox(0, "", $x) EndFunc But what i really want is a function that counts the various instances of putty connected to different servers. For example. If there are 4 connections to servers with putty (2x serverA, 1x serverB and 1x serverC) my function counts 4 times putty. What i am looking for is a function that gives me: ServerA 2 ServerB 1 ServerC 1
-
File usage monitor - not sure where to start.....
waardd replied to shornw's topic in AutoIt General Help and Support
I'm not shure but is this a pointer in the direction you want to go? ;Computer Management Shared Files ShellExecute("compmgmt.msc") WinWaitActive("Computerbeheer") send("{DOWN}{DOWN}{DOWN}{DOWN}{RIGHT}{DOWN}{DOWN}{DOWN}") ControlClick("Computerbeheer", "", "[CLASS:ToolbarWindow32; INSTANCE:2]", "left", 1, 69, 10) send("{DOWN}{DOWN}{DOWN}{ENTER}") Sleep(1000) send("afile") Replace "Computerbeheer" with "Computer management" -
Check status co-worker in communicator 2007
waardd replied to waardd's topic in AutoIt General Help and Support
I searched the site but i really can't tell what to do. Al i want is a field where i can display the communicator status of a co-worker... I keep reading 2 options: 1- not scriptable 2- scriptable in VB C+ or others... I cant rewrite option 2 for autoit... who can help me? For instance on the MSDN page read the example: http://msdn.microsoft.com/en-us/library/bb758775(v=office.12).aspx -
Check status co-worker in communicator 2007
waardd posted a topic in AutoIt General Help and Support
I have a function that checks my status in communicator: Func _statusIM() $oCommunicator = ObjCreate("Communicator.UIAutomation") $statusIM = $oCommunicator.MyStatus msgbox(0,"Status",$$statusIM); 1 = offline, 2 = beschikbaar, 10 = bezet en niet storen, 14 = ben zo terug, 34 = afwezig EndFunc My question now is: How can i check the status of my co-worker?? -
variable numer of menu items to case
waardd replied to waardd's topic in AutoIt General Help and Support
No sorry... i found my error. Because of the double use of the array, the array was filled the second time with numbers. Therefor my run command did not work. I solved it by creating a second array and now it works perfect. Tnx for all your help. Global $linkList=_FileListToArray("C:homelinks","*", 1) Global $linkitems=_FileListToArray("C:homelinks","*", 1) For $i = 1 To Ubound($linklist)-1 $linklist[$i] = GUICtrlCreateMenuItem(StringLeft($linklist[$i],(StringLen($linkList[$i])-4)), $Links,$i) Next Case $linklist[0] To $linklist[UBound($linklist) - 1] For $i = 0 To UBound($linklist) - 1 If ($nMsg == $linklist[$i]) Then TrayTip("Link","Toepassing wordt gestart.",2) ShellExecute("C:homelinks" & $linkitems[$i]) EndIf Next -
variable numer of menu items to case
waardd replied to waardd's topic in AutoIt General Help and Support
@AlmarM Your creation works that the message says "item x" is pressed, but after the selection the corresponding item must be run and then it says that it can not run c:<dir><dir>x where x is a number. For insatnce Item 1 relates to 56 so it tries to run c:homelinks65 -
This code generates a menuitem with entrys, but also a combobox. My question is how to set the case statement to match the menuitems... $RunKiezer = GUICtrlCreateCombo("", 10, 265, 125) ; create first item Local $FileList=_FileListToArray("C:\home\links\","*", 1) Local $cData = "" For $i = 1 To Ubound($FileList)-1 ;create automatic menu $filelist[$i] = GUICtrlCreateMenuItem(StringLeft($filelist[$i],(StringLen($fileList[$i])-4)), $Links) $cData &= "|" & StringLeft($filelist[$i],(StringLen($fileList[$i])-4)) Next GUICtrlSetData($RunKiezer, $cData)
-
Tnx for the remark Blue_Drache Indeed a copy-paste error
-
Tnx KaFu. The functions seems to have solved my problem.
-
I defined several hotkeys sh+F1 - sh+F9 and Ctrl+F1 but there is a problem with it. About 4 out of 10 times the Shift or Ctrl seems to stay pressed after executing the hotkey. This is not a HW problem since its on more then 5 keyboard. After i press shift or Ctrl again the key stays so to say up. Who cab help me with this? In the example $F9 is Exit. The hotkeys are programmed to function in Putty Hotkey: HotKeySet("+{F9}", "_F9") Fuction: Func _F9() $state = WinGetState("[CLASS:PuTTY]", "") If BitAnd($state, 8) Then Send($F9 & "{ENTER}") EndIf EndFunc
-
Looks great!! Had to translate the terms to dutch to get it to work Here is my final solution: Func _AdapterToArray() Global $strComputer = "localhost" Global $objWMIService, $colAdapters, $n, $a, $avArray Global $nw1, $nw2, $nwlabelcolor2, $nwlabelcolor1 ;set wmiservice $objWMIService = ObjGet("winmgmts:" & $strComputer & "rootCIMV2") ;set array to number of adaptors $colItems = $objWMIService.ExecQuery("SELECT Description FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True", "WQL", 0x00).Count Global $avArray[$colitems+1][9] $avArray [0][0] = "Volgnummer" $avArray [0][1] = "Omschrijving" $avArray [0][2] = "MAC" $avArray [0][3] = "IPv4" $avArray [0][4] = "Subnet IPv4" $avArray [0][5] = "IPv6" $avArray [0][6] = "Subnet IPv6" $avArray [0][7] = "Servicenaam" $avArray [0][7] = "InterfaceIndex" ;fill array with Name and MAC adaptors $colAdapters = $objWMIService.ExecQuery ("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True") $n = 1 For $objAdapter in $colAdapters $avArray [$n][0] = $n $avArray [$n][1] = $objAdapter.Description $avArray [$n][2] = $objAdapter.MACAddress $avArray [$n][3] = $objAdapter.IPAddress(0) $avArray [$n][4] = $objAdapter.IPSubnet(0) $avArray [$n][5] = $objAdapter.IPAddress(1) $avArray [$n][6] = $objAdapter.IPSubnet(1) $avArray [$n][7] = $objAdapter.ServiceName $avArray [$n][7] = $objAdapter.InterfaceIndex $n = $n + 1 Next ;_ArrayDisplay($avArray) Global $adaptorLAN = _ArraySearch($avArray, "Network Connection", 0, 0, 0, 1, 1, 1) if $adaptorLAN = -1 Then $nw1string = "LAN adaptor niet aangesloten!" $nw1 = "Disconnected" $nwlabelcolor1 = "0xaa0000" Else Global $nw1string = $avArray[_ArraySearch($avArray, "Connection", 0, 0, 0, 1, 1, 1)][1]& " heeft IPv4: "& $avArray[_ArraySearch($avArray, "Connection", 0, 0, 0, 1, 1, 1)][3] $nwlabelcolor1 = "0x00aaaa" $nw1 = $avArray[_ArraySearch($avArray, "Connection", 0, 0, 0, 1, 1, 1)][3] EndIf Global $adaptorwifi = _ArraySearch($avArray, "WiFi", 0, 0, 0, 1, 1, 1) if $adaptorwifi = -1 Then $nw2string = "WiFi adaptor niet aangesloten!" $nw2 = "Disconnected" $nwlabelcolor2 = "0xaa0000" Else Global $nw2string = $avArray[_ArraySearch($avArray, "WiFi", 0, 0, 0, 1, 1, 1)][1]& " heeft IPv4: "& $avArray[_ArraySearch($avArray, "WiFi", 0, 0, 0, 1, 1, 1)][3] $nwlabelcolor2 = "0x00aaaa" $nw2 = $avArray[_ArraySearch($avArray, "WiFi", 0, 0, 0, 1, 1, 1)][3] EndIf EndFunc