Leaderboard
Popular Content
Showing content with the highest reputation on 01/18/2022 in all areas
-
A simpler way using a workaround : create a col #3 (width=0) for sorting only ;#AutoIt3Wrapper_run_debug_mode=Y #include <GUIConstantsEx.au3> #include <GuiListView.au3> #Include <Array.au3> Global $g_id_ListView Example() Exit Func Example() Local $array[5] = [ _ "#1|Alice|01/15/2022", _ "#2|Bob|02/22/2021", _ "#3|Carol|03/13/2021", _ "#10|Dave|10/09/2021", _ "#11|Eve|11/21/2021"] ; _ArrayDisplay($array) GUICreate("ListView Sort Question", 300, 200) $g_id_ListView = GUICtrlCreateListView("Row#|Name|Date| ", 10, 10, 280, 180) For $i = 0 to UBound($array)-1 GUICtrlCreateListViewItem($array[$i] & "|" & StringRegExpReplace($array[$i], '.*(\d{2})/(\d{2})/(\d{4})', "$3$1$2"), $g_id_ListView) Next _GUICtrlListView_SetColumnWidth($g_id_ListView, 3, 0) GUISetState(@SW_SHOW) _GUICtrlListView_RegisterSortCallBack($g_id_ListView) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $g_id_ListView ;MsgBox(0,"","col="&GUICtrlGetState($g_id_ListView)) ; If col 2 is clicked then use col 3 for sorting <<<<<<<<<<<<<<<<<<<<<< If GUICtrlGetState($g_id_ListView) = 2 Then _GUICtrlListView_SortItems($g_id_ListView, 3) EndSwitch WEnd _GUICtrlListView_UnRegisterSortCallBack($g_id_ListView) GUIDelete($g_id_ListView) EndFunc ;Func Example()1 point
-
Hello, I wrote a small AutoIt App which takes DOS formatted textfiles and forwards them to MS Word. I searched a lot for a programm which does this, but I didn't find one. The reason for it is an old DOS program, which is used a lot, even today. The user wanted to print the output of that programm with some other font-size, font-style and so on... We used WinPrint, but this is a printing only app, so no formatting can be done afterwards... The solution was, to print with the DOS prgramm to an file, e.g. C:\12345\output.txt ... then read this file, convert it to unicode, put this into word with some pre-defined font / page size and so on ... and then the user can re-format or print it now. Here is the main function of the Dos2Word programm I wrote: Func Convert2Word() ; keine datei da... If Not FileExists($sFilePath) Then Return ; noch in Beaarbeitung... If _WinAPI_FileInUse($sFilePath) Then Return ; nun aber... Local $sFilePathTemp = $sFilePath & "_" & _WinAPI_CreateGUID() & ".txt" FileMove($sFilePath, $sFilePathTemp, $FC_OVERWRITE) ; open word and create new document Local $oWord = _Word_Create() If @error Then ErrorExit("Fehler bei _Word_Create()") Local $oDoc = _Word_DocAdd($oWord) If @error Then ErrorExit("Fehler bei _Word_DocAdd()") ; seite definieren With $oDoc.PageSetup .PageHeight = $sPageHeight .PageWidth = $sPageWidth .TopMargin = $sTopMargin .BottomMargin = $sBottomMargin .LeftMargin = $sLeftMargin .RightMargin = $sRightMargin EndWith ; schrift und absatz With $oDoc.Range .Font.Name = $sFontName .Font.Size = $sFontSize EndWith With $oDoc.Range.ParagraphFormat .SpaceBefore = 0 .SpaceAfter = 0 .LineUnitBefore = 0 .LineUnitAfter = 0 .LineSpacingRule = 0 EndWith Local $hFile = FileOpen($sFilePathTemp, BitOR($FO_READ, $FO_BINARY)) Local $iError Local $iLine = 1 Do Local $sLine = FileReadLine($hFile, $iLine) $iError = @error $iLine += 1 ; ignore special escape line of cm.exe If StringLeft($sLine, 2) = Chr(27) & Chr(64) Then $sLine = StringTrimLeft($sLine, 2) $oDoc.Range.insertAfter(_WinAPI_MultiByteToWideChar($sLine, $sCodePage, 0, True) & @CRLF) Until $iError <> 0 ; und am ende löschen, sofern gewünscht FileClose($hFile) If $sFilesDelete <> "0" Then FileDelete($sFilePathTemp) EndFunc ;==>Convert2Word The Homepage of the program is here: https://mcmilk.de/projects/Dos2Word/ The full source code and precompild signed binaries for 32bit and 64bit systems are also there, the License is GPLv2 With best regards, Milky Maybe someone finds it useful too1 point
-
SeanDoe, In this case I would use _StringBetween: #include <String.au3> #include <Array.au3> $sString = "NameOfDocument: 1/8" $aExtract = _StringBetween($sString, ": ", "/") _ArrayDisplay($aExtract, "", Default, 8) M231 point
-
Unfortunately programming doesn't quite work like that, even in the best case scenario you'd have to write code to bring it all together, there is no magical solution here. This is a misconception you have. Depending on the level of skill you have with computers you can easily get started within a couple of weeks assming you dedicate some time each day towards learning it. AutoIt is especially easy to use even for beginners. Learning to code is also a useful skill in general. Having said that, if you still don't want to take any time for learning, then there are other no code automation solutions out there, I have't used them personally so I can't help you with recommendations in that regard.1 point
-
Yes of course there is a way to identify the actual window. Search the forum about "find window from PID", you should easily find multiple examples of it.1 point
-
@stiv, What about you take note when we move your post to the appropriate forum and not post the next thread again in a wrong section? Moved to the appropriate forum, as the Developer General Discussion forum very clearly states: Moderation Team1 point
-
Speed is probably due to the true condition which basically means return all objects which can be a huge array $UIA_oUIAutomation.CreateTrueCondition($pTrueCondition) $oCondition = ObjCreateInterface($pTrueCondition, $sIID_IUIAutomationCondition, $dtagIUIAutomationCondition) ;~ $oCondition1 = _AutoItObject_WrapperCreate($aCall[1], $dtagIUIAutomationCondition) ;~ Tricky to search all descendants on html objects or from desktop/root element $oElementStart.FindAll($TreeScope, $oCondition, $pElements) These conditions you can make with and, or logic. See below a filter on ControlType and Name. Probably in your scenario I would filter on controltype and or condition (createOrCondition) Local $pCondition1 $oUIAutomation.CreatePropertyCondition( $UIA_ControlTypePropertyId, $UIA_MenuItemControlTypeId, $pCondition1 ) If Not $pCondition1 Then Return ConsoleWrite( "$pCondition1 ERR" & @CRLF ) ConsoleWrite( "$pCondition1 OK" & @CRLF ) Local $pCondition2 ; $UIA_NamePropertyId is LOCALIZED and maybe CASE SENSITIVE $oUIAutomation.CreatePropertyCondition( $UIA_NamePropertyId, "File", $pCondition2 ) ; File <<<<<<<<<<<<<<<<<<<< If Not $pCondition2 Then Return ConsoleWrite( "$pCondition2 ERR" & @CRLF ) ConsoleWrite( "$pCondition2 OK" & @CRLF ) ; And condition $oUIAutomation.CreateAndCondition( $pCondition1, $pCondition2, $pCondition ) If Not $pCondition Then Return ConsoleWrite( "$pCondition ERR" & @CRLF ) ConsoleWrite( "$pCondition OK" & @CRLF That's where I frequently use the findThemAll function for to tweak the filters. The alternative for findall are the treewalkers where you can fully walk the element tree yourself but it depends on what you feel is most easiest to handle. References See for example the different examples 1-25 that try to explain all the details @LarsJmade some wonderfull example threads and some tooling like UIASpy See for example1 point
-
File transfer over tcpip
Abdelrahman reacted to MrSpacely for a topic
Hi I made a combination of scripts wich combined form a simpel server /client system over wich you can transfer files its only a test. The client can upload files to the server the server writes them to a upload folder. I made this because someone said it was imposible with autoit script. I only used build in functions (beta) Can someone test it over the internet? I have only tested it over a high interferrence wifi connection and on localhost. I hope someone can get some use for the scripts or parts of it. If I have more time I want to make it multiclient support and also both way transfer. Ofcourse if I do that I could add username and password support. But I donot have not much time now server.au3 client.au31 point