Leaderboard
Popular Content
Showing content with the highest reputation on 11/04/2020 in all areas
-
Date Range Picker
SkysLastChance and one other reacted to Nine for a topic
In this thread, it was asked if there was a Date Range Picker somewhere. Couldn't find one. With @Zedna calendar with @maniootek proposal, I felt it could be fun to create one. So here it is. Like always, if you have some suggestions, I am open to any. Version 2022-04-10 *Window drag can now be performed anywhere with the background of the GUI (non-control space) * Clicking on the month label, select the whole month Version 2020-12-05 * Standardized presentation of month calendar where column 1 is Sunday and column 7 is Saturday. Version 2020-11-04 * Dates selection using Shift-Click inside a single month or between months * Auto-multi lingual Hope you like it. Date Range Picker.au32 points -
@maniootek and @mLipok - Implemented separate months calendar, so it should please you both2 points
-
As the WebDriver UDF - Help & Support thread has grown too big, I started a new one. The prior thread can be found here.1 point
-
Look closely. You don't see the problem? I guess the error message saying "undefined function" wasn't a big enough hint.1 point
-
It doesn't work well for me. Calendar is cropped and overlaps other controls. But this is not important for your issue. I would think that my first impression of using a label box would work far better than a pseudo-combo-box. #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <GUIConstantsEx.au3> #include <IE.au3> #include <WinAPI.au3> #include <Misc.au3> #include <Date.au3> Global $Persian_JS_Date Local $hDLL = DllOpen("user32.dll") Local $AlphaKey = 0xFFFF00 ; the transparent color of your choice $Main_GUI = GUICreate("", 550, 500) $Show_Calendar = GUICtrlCreateButton("Show Calendar", 350, 150, 100, 50) $idBox = GUICtrlCreateLabel(_NowDate(), 350, 250, 100, 50, $SS_SUNKEN + $SS_CENTER + $SS_CENTERIMAGE) $Date_GUI = GUICreate("Persian Calendar", 330, 255, -1, -1, $WS_POPUP + $WS_CLIPCHILDREN, $WS_EX_LAYERED) GUISetBkColor($AlphaKey, $Date_GUI) _WinAPI_SetLayeredWindowAttributes($Date_GUI, $AlphaKey, 0, $LWA_COLORKEY) $Persian_Date_IE = _IECreateEmbedded() $Persian_Calendar_Obect = GUICtrlCreateObj($Persian_Date_IE, -20, -63, 1000, 1000) _IENavigate($Persian_Date_IE, @ScriptDir & "\jalali.html") $Persian_Date_IE.document.body.style.backgroundColor = $AlphaKey GUISetState(@SW_SHOW, $Main_GUI) $Date_GUI_Close = GUICreate("Persian Calendar Close", 200, 200, 50, 24, $WS_POPUP + $WS_CLIPSIBLINGS, $WS_EX_LAYERED, $Date_GUI) GUISetBkColor($AlphaKey, $Date_GUI_Close) GUISwitch($Date_GUI_Close) _WinAPI_SetLayeredWindowAttributes($Date_GUI_Close, $AlphaKey, 0, $LWA_COLORKEY) $Exit_Button_Calendar_GUI = GUICtrlCreateButton("Close", 0, 0, 50, 24) While 1 GUISwitch($Date_GUI) $msg = GUIGetMsg() Switch $msg Case $Exit_Button_Calendar_GUI GUISetState(@SW_HIDE, $Date_GUI) GUISetState(@SW_HIDE, $Date_GUI_Close) GUISwitch($Main_GUI) Case $Show_Calendar GUISetState(@SW_SHOW, $Date_GUI) GUISetState(@SW_SHOW, $Date_GUI_Close) Case $GUI_EVENT_CLOSE Exit Case $idBox ConsoleWrite("Box has been clicked" & @CRLF) ; do your stuff here EndSwitch $Persian_JS_Date = 0 $nLeftclicks = 0 If _IsPressed("01", $hDLL) Then ;If left mouse button pressed $Pos = MouseGetPos() ;Get mouse position Do While (_IsPressed("01", $hDLL)) ;Wait until user releases button Sleep(10) WEnd $nLeftclicks += 1 ;Increment click count Sleep(100) ;Wait for 100ms $aTemp = MouseGetPos() ;Get new mouse position again Until (Not ($aTemp[0] = $Pos[0] And $aTemp[1] = $Pos[1] And _IsPressed("01", $hDLL))) ;Loop until mouse is on a new position or it is not pushed again EndIf If $nLeftclicks = "2" And $Persian_Date_IE.document.getElementById('display_area_1').innertext <> "1399" Then $Persian_JS_Date = $Persian_Date_IE.document.getElementById('display_area_1').innertext $cDate = $Persian_JS_Date MsgBox(0, "", $cDate) $Persian_Date_IE.document.getElementById('display_area_1').innertext = '1399' ; GUISetState(@SW_HIDE, $Date_GUI) Exit EndIf $winpos = WinGetPos($Date_GUI) WinMove("Persian Calendar Close", "", $winpos[0] + $winpos[2], $winpos[1]) WEnd Also I would personally write an autoit calendar instead of using the JS code.1 point
-
No, It's not possible to directly create such an event handler. However, you can signal events between server and clients using WM_USER messages. In the same way as it's done in the example about IPC Techniques. This assumes that a window exists in both server and clients. Since the ROT object in the examples is a dictionary object, another option is to create one or more additional key/item pairs in the dictionary object to signal events. Then both server and clients must check (regularly in a kind of loop) whether an item value has changed which indicates a new event.1 point
-
We would need the html file too.1 point
-
No I do not change code. Just send you PM with recorded VIDEO.1 point
-
Maybe show your script, it would be easier to have some code to test and understand your issue...1 point
-
Isn't that an abnormal behavior for a Windows control ? Why don't you simply use a Label box or something more appropriate ? Just asking...1 point
-
Problem comes from _StringTitleCase function. Done I know, lets call it a design choice1 point
-
The idea is that the left and right calendars are independently changeable so that you can set the date range you like.1 point
-
Can Autoit do this? - (Moved)
caramen reacted to Confuzzled for a topic
RetiredGuy has a need, and the AutoIT is incidental - he wants to download his historical comments from the Washington Post. They deliberately make their site hard to access behind a paywall, and of course their underlying data is not going to be exposed for scraping, easily. There are a lot of concepts to learn here: Accessing your comments at the website, downloading them, storing them, and presenting them in a format you need. You have to understand HTML, Javascript, CSS, templates, and how the data is stored and accessed as the browser builds the page that it displays to you, and what you have to do to intercept that. Break your problem down into smaller chunks, and then solve them one-by-one, building on what you have learnt. It is glaringly obvious from the posts above that you have a long way to go, but I sense that you have time, patience, and a purposeful persistence that will win out in the end. Show that you have mastered the concept of downloading what is displayed to you before you initiate the 'more' command, and then you can build on that, and I am sure those watching will jump in to offer suggestions. Explain the steps on paper, before you start coding in any language at all. How do you build a table of those articles that have your comments attached and ignore the rest? How you access only your comments amongst all the others? How you download them? What format do you store them in? How do you sort them and present them? Once you can explain that to your mother-in-law or a teenager (that cannot code) so they can understand it in plain English, then you will find that your code will most likely automagically fall into place. Correspondingly, nobody feels obligated to spoon feed you. Experiment with what you observe, Read about how they want to help you at https://www.washingtonpost.com/view-your-comment-history-on-the-my-profile-tab/d1ec02fd-b3db-44a5-9c45-c66be29323ff_note.html Research a little on GitHub on what others have done, mostly with other languages other than AutoIT. What did those programmers do to solve the challenges? How did they approach it? The actual code is not that important for your research at the initial stages - the underlying concepts are. Google search is your friend (sorta), as long as you know what questions to ask. Use trigger words like 'screen scrape', 'script', etc and slowly it will fall into place. Just firing off code that you have cut and pasted from examples will not help you unless you understand the concepts behind what it is there for - why each command is being invoked, how it works, and what the end results are. Unfortunately that is something you have to do for yourself. We can offer suggestions, but you still have to put in the hard yards to reap the rewards. Once you have mastered the fundamentals, the rest is relatively easy! Best of luck. PS> I started with punch cards and worked my way forwards. Other than programming a VCR, I still can show those cheeky upstarts a thing or two! Learning is a lifetime challenge, whether formal or not. Never get bored - get even! Persistence vs enthusiasm - experience always wins. Structured learning however where you learn the fundamentals that apply across all languages is something that I would strongly recommend. There are a lot of courses online these days that are free, and find one that is compatible with your learning style. Most universities and colleges offer them. Well worth doing.1 point -
The first post (ROT objects section) and the third post (last section) have been updated. New 7z-file at bottom of first post.1 point
-
UsageAn obvious use of ROT objects is in connection with tasks such as inter-process communication (IPC) and job processing. The advantage of using ROT objects for these tasks is partly that you can handle large amounts of data and partly that you can handle the vast majority of AutoIt data types. Using a ROT object it's very easy to transfer arrays between two different processes. At the same time, the internal data types of the array elements are preserved. If an array containing integers, floats, and strings is passed from a sender to a recipient, then it's still integers, floats, and strings at the recipient. This means that the recipient can sort the array with exactly the same result as a sort of the array at the sender. Not just simple data types are preserved. If an array element contains another array (embedded array) or an object (embedded object), then this embedded array or object is still valid at the recipient. ROT objects are based on COM techniques. How is it possible that proprietary AutoIt data types such as arrays, can be transferred between a sender process and a receiver process using a technique based on standard COM data types? This is possible because the AutoIt array is converted to a safearray of variants (default COM array) at the sender and converted back to an AutoIt array at the receiver. But en route between sender and recipient it's a safearray. These conversions are performed automatically by internal AutoIt code (compiled C/C++ code, very fast). If you are interested you can find more information on these topics in Accessing AutoIt Variables. Passing array between AutoIt programsExamples\2) IPC Demo\Array\ contains two files that very simply demonstrate the exchange of arrays between programs running in two different processes. The example is a copy of the example in this thread but implemented with the new IRunningObjectTable UDF. 1) Server.au3: #include <Array.au3> #include "..\..\..\Includes\IRunningObjectTable.au3" Example() Func Example() MsgBox( 0, "Server", "This is server" ) Local $sDataTransferObject = "DataTransferObject" & ROT_CreateGUID() ROT_RegisterObject( Default, $sDataTransferObject ) ; Default => Object = Dictionary object Local $oDataTransferObject = ObjGet( $sDataTransferObject ) ; Dictionary object ; Create array Local $aArray[1000][10] For $i = 0 To 1000 - 1 For $j = 0 To 9 $aArray[$i][$j] = $i & "/" & $j Next Next _ArrayDisplay( $aArray, "Array on server" ) ; Transfer data $oDataTransferObject.Add( "$aArray", $aArray ) ; Start client RunWait( @AutoItExe & " /AutoIt3ExecuteScript " & '"2) Client.au3" ' & $sDataTransferObject ) ; ------- Server waiting while client is executing ------- MsgBox( 0, "Server", "This is server again" ) ; Receive data on server $aArray = $oDataTransferObject.Item( "$aArray" ) _ArrayDisplay( $aArray, "Modified array on server" ) EndFunc 2) Client.au3: #include <Array.au3> Example() Func Example() MsgBox( 0, "Client", "This is client" ) ; Data transfer object Local $sDataTransferObject = $CmdLine[1] Local $oDataTransferObject = ObjGet( $sDataTransferObject ) ; Receive data on client Local $aArray = $oDataTransferObject.Item( "$aArray" ) _ArrayDisplay( $aArray, "Array on client" ) ; Modify array on client For $i = 0 To 100 - 1 $aArray[$i][0] = "Modified" $aArray[$i][1] = "on" $aArray[$i][2] = "client" Next _ArrayDisplay( $aArray, "Modified array on client" ) ; Transfer data $oDataTransferObject.Item( "$aArray" ) = $aArray EndFunc Passing array between AutoIt and VBScriptBecause ROT objects are based on standard COM code, it's possible to exchange data between an AutoIt program and other COM compatible programs e.g. VBScript. The files in Examples\3) IPC Demo2\VBScript\ demonstrate this: 1) Server.au3: #include <GUIConstantsEx.au3> #include "..\..\..\Includes\IRunningObjectTable.au3" Example() Func Example() Local $sArray = "ArrayData" ROT_RegisterObject( Default, $sArray ) ; Default => Object = Dictionary object Local $oArray = ObjGet( $sArray ) ; Dictionary object Local $aArray = [ 123, 123.123, "This is data from AutoIt" ] $oArray( "Array" ) = $aArray Local $sText = "Data exchange between AutoIt and VBScript" Local $hGui = GUICreate( $sText, 400, 300 ) $sText = "Run Client.vbs:" & @CRLF & _ "Open a Command Prompt in the current folder." & @CRLF & _ "Key in ""wscript Client.vbs"" and hit the Enter key." & @CRLF & @CRLF & _ "When you have seen the information in the MsgBox, press the button below." GUICtrlCreateLabel( $sText, 20, 60, 360, 80 ) $sText = "Press Button to continue" Local $idButton = GUICtrlCreateButton( $sText, 20, 180, 360, 30 ) GUISetState( @SW_SHOW, $hGui ) While 1 Switch GUIGetMsg() Case $idButton $aArray = $oArray( "Array" ) MsgBox( 0, "AutoIt: Array from VBScript", "Int: " & $aArray[0] & " (" & VarGetType( $aArray[0] ) & ")" & @CRLF & _ "Flt: " & $aArray[1] & " (" & VarGetType( $aArray[1] ) & ")" & @CRLF & _ "Str: " & $aArray[2] & " (" & VarGetType( $aArray[2] ) & ")" ) Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete( $hGui ) EndFunc Client.vbs: Dim oArray, iAnswer Set oArray = GetObject( "ArrayData" ) iAnswer = MsgBox( "Int: " & oArray( "Array" )(0) & vbCrLf & _ "Flt: " & oArray( "Array" )(1) & vbCrLf & _ "Str: " & oArray( "Array" )(2), 0, "VBScript: Array from AutoIt" ) Dim aArray aArray = Array( 234, 234.234, "This is data from VBScript" ) oArray( "Array" ) = aArray Examples with programs like C# and VB.NET are probably more interesting than VBScript. This way, you can transfer (large) arrays from AutoIt to C# and VB.NET, perform array calculations in compiled code, and return arrays or results back to AutoIt. Here, the AutoIt and C#/VB.NET code are standalone programs that run in their own processes and are connected only through the ROT object. It's a new option to execute code sections that are bottlenecks in interpreted AutoIt code as compiled and possibly multithreaded C#/VB.NET code. Note that such a technique is very different from the technique in Using C# and VB Code in AutoIt through the .NET Framework, where all code runs in the same process. Passing data through ROT Objects (2020-07-11)In IPC Techniques through ROT Objects (Data types section) the AutoIt data types have been tested based on the example for the VarGetType() function in the help file. The data types are sent from Sender to Receiver with these results: $aArray : Array variable type. $dBinary : Binary variable type. $bBoolean : Bool variable type. $pPtr : Int32 variable type. $hWnd : Int32 variable type. $iInt : Int32 variable type. $fFloat : Double variable type. $oObject : Object variable type. $sString : String variable type. $tStruct : Not recognized as a valid variable type. $vKeyword : Keyword variable type. fuMsgBox : Not recognized as a valid variable type. $fuFunc : Not recognized as a valid variable type. $fuUserFunc : Not recognized as a valid variable type. Only the $tStruct and the function data types are not received correctly. The Int32 types for $pPtr and $hWnd can easily be converted to pointer and window handles with the Ptr() and HWnd() functions. In the following section (DllStruct section) it's shown how the $tStruct can be sent by converting the DllStruct to Binary data. In the Large array section (still in the IPC Techniques example) it's shown that even very large arrays can be passed with ROT objects. AutoIt/Perl integration is an example showing how to pass data back and forth between AutoIt and Perl scripts. Also between different programming languages, the data types are preserved with this technique.1 point