Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/05/2020 in all areas

  1. TheXman

    StringFormat for currency

    Another alternative: ConsoleWrite(StringFormat("$%10.2f", 5) & @CRLF) ConsoleWrite(StringFormat("$%10.2f", 50) & @CRLF) ConsoleWrite(StringFormat("$%10.2f", 500.125) & @CRLF) Output: $ 5.00 $ 50.00 $ 500.13
    2 points
  2. Because that ensures there is no overflow from 59s to anything, which can be up to one year shift!
    2 points
  3. water

    OutlookEX UDF

    Based on the Outlook UDF written by wooltown, we (wooltown and I) decided to extend the functionality of the Outlook UDF. As the OutlookEX UDF ("EX" like "extended") has a completely different approach compared to the Outlook UDF it's a complete rewrite. We would like to discuss the design of the UDF with the community. Every feedback, function request etc. is highly welcome. As soon as the discussion shows that we are on the right track we would like to release an alpha version for everyone to test. So please don't be shy and post what you think of this UDF or what functions you need! Every item in Outlook is uniquely identified by EntryID and StoreID. The default StoreID is your inbox Every item has properties to describe the item (subject, startdate ..) and methods to act upon the item (move, delete …) The search and action functions are now separated. As an example the user first searches for the items to be deleted and then calls the delete function If a method can be used for more than one item type (e.g. mail, calendar and notes) the function is called _OL_ItemXXX else the function is called _OL_CalendarXXX The number of properties you can get or pass to most functions is not limited by the number of parameters defined for the function. Properties can be passed as parameters (up to 10) or in an unlimited array as parameter 1 The UDF allows to access all kind of folders (see the following listing). Folders can be passed by name or as an object to a function A lot of testing is still needed as we have written and tested the functions using Outlook 2002 SP3 and Outlook 2010 "wrapper" or "shortcut" functions will be available to let you do all tasks in one go e.g. _OL_Wrapper_SendMail for all functions above. Documentation: The documentation for this UDF (aside from the docu in the UDF itself) will be placed in the AutoIt Wiki. So we can easily modify the docu without releasing a new version each time. There will be pages describing the UDF in general and pages for individual item types (like mail) with detailed information and a lot of tips & tricks. Tested with Outlook 2003 and 2010. Some users reported that it works with Outlook 2013 as well. Starting point: http://www.autoitscript.com/wiki/OutlookEX_UDF_-_General Download
    1 point
  4. water

    AD - Active Directory UDF

    Version 1.6.3.0

    17,289 downloads

    Extensive library to control and manipulate Microsoft Active Directory. Threads: Development - General Help & Support - Example Scripts - Wiki Previous downloads: 30467 Known Bugs: (last changed: 2020-10-05) None Things to come: (last changed: 2020-07-21) None BTW: If you like this UDF please click the "I like this" button. This tells me where to next put my development effort
    1 point
  5. BBs19

    MetroGUI UDF

    Version 5.1

    8,853 downloads

    Features: Create modern looking borderless and resizable GUIs with control buttons (Close,Maximize/Restore,Minimize, Fullscreen, Menu) True borderless, resizeable GUI with full support for aerosnap etc. Many color schemes/themes included. See MetroThemes.au3 for more details. 2 type of Windows 8/10 style buttons. Modern checkboxes, radios, toggles and progressbar. All buttons, checkboxes etc. have hover effects! Windows 10 style modern MsgBox. Windows 10/Android style menu that slides in from left.
    1 point
  6. When it comes to databases there are two serious giants: oracle and sql server so yes it's a pretty reliable and performant database engine with a lot of features. But of course this doesn't means it would be the best fit for every project. Since yours it's quite small and will not grow very much in time sqlite might be a better choice and will give you more portability. You just need to find the balance between the features, performance and your requirements.
    1 point
  7. Thanks @argumentum
    1 point
  8. @hoangvu0905 The default marionette port is 2828. You can either -- Change the port on the profile to match the default value Notify the webdriver of the alternate port to use _WD_Option('DriverParams', '--log trace --marionette-port 51267 ')
    1 point
  9. $hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 100, BitOR($ES_MULTILINE, $WS_VSCROLL), $WS_EX_LEFTSCROLLBAR) Works for me correctly. French setting / KB.
    1 point
  10. Moved to the appropriate forum, as the Developer General Discussion forum very clearly states: Moderation Team
    1 point
  11. Plink is non-interactive, so you have two options: Use putty and interact with it or plink your commands one at a time, interrogate the output of each command and kill the plink process / update next command appropriately. My default choice is always plink unless the user actually needs to interact with the session. Of course a single session is faster and more efficient, so consider that if you are going to run this frequently (e.g. traceroute first, then if it works, bunch up the rest into a single plink). Here is a typical way I monitor plink output: Func ExtractFromPlink($sRequest) Local $sConnection = "plink.exe -ssh -no-antispoof " & $sHost & " -P " & $sPort & " -l " & $sUserName & " -pw " & $sUserPassword Local $sCommand = " " & $sRequest & " ; sleep 1" ; sleep prevents truncation of output by fast server disconnect Local $iPid = Run($sConnection & " " & $sCommand, '', @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) Local $sStdoutRead, $sData While ProcessExists ($iPid) $sStdoutRead = StdoutRead ($iPid) If Not @error And $sStdoutRead <> '' Then ; you can watch the output as it happens here, eg for error traps $sData &= $sStdoutRead EndIf If @error Then ExitLoop Wend return $sData ; returns the full plink command output EndFunc ;==>ExtractFromPlink Note on security: Using the above code, the user password is visible as plain text in the process table while plink is running (process explorer etc). Your alternative is to use an ssh key, but anyone who has access to the key then has password-less access to the server... Obviously, you can take steps to protect an SSH key - it all comes down to how much effort you want to put in versus the potential risk. I add this note not so much for the OP, but for anyone else referencing this.
    1 point
  12. Thanks for this - I am new to AutoIT - the IE_UDE looks like it will be a better way forward :-)
    1 point
  13. Another cause that I have done often that causes this error is having the serial monitor in the arduino editor open.
    1 point
  14. Thêm cái này trước cái tắt đi pro _WD_DeleteSession($sSession)
    1 point
  15. Count on a myriad of users to find that this will break down the type system and slow down FP unbearably 😄 A can of worms! Seriously noone is obliged to use FP, so if you intent an exact computation, use an exact decimal format. If otherwise you can be satisfied by a (close) approximation, use FP as much as you can and deal with it's slight inacuracies.
    1 point
  16. The range of FP double is sooo huge that int64 are only a very tiny small portion of what FP can represent. Of course one can write functions doing what you dream of, but then it's just easier to scale the input values so that they fit in int64s in the first place. Or you can simply use the BigNum.au3 UDF: ConsoleWrite(_BigNum_Add('6.05', '-1.86') & @LF) ConsoleWrite(_BigNum_Add('4.19', '0') & @LF) ConsoleWrite((_BigNum_Add('6.05', '-1.86') = _BigNum_Add('4.19', '0')) & @LF) The web page you link to is only for 32-bit FP, so-called single FP while my function explodes the full 64-bit FP values in understandable form (sort of!). In AutoIt and most languages double FP is by default. The advent of 10-based FP as the latest IEEE standard describes isn't going to be fully implemented tomorrow even if software libraries are poping up. That's a huge and complex and slow thing!
    1 point
  17. This should help you see why they are not equal: _Example() Func _Example() Local $sKwota_Naliczona = _String_AsRounded_Number('6.05') Local $sKwota_Pobrana_Wczesniej = 0.00 Local $sKwota_Pobieram = _String_AsRounded_Number('4.19') Local $sKwota_Do_Pobrania = _String_AsRounded_Number('1.86') Local $bTesting_1 = $sKwota_Naliczona - $sKwota_Pobrana_Wczesniej - $sKwota_Pobieram Local $bTesting__A = ($bTesting_1 = $sKwota_Do_Pobrania) Local $bTesting__B = ($bTesting_1 == $sKwota_Do_Pobrania) ConsoleWrite(StringFormat("$sKwota_Do_Pobrania = %.15f", $sKwota_Do_Pobrania) & @CRLF) ConsoleWrite(StringFormat("$bTesting_1 = %.15f", $bTesting_1) & @CRLF) ConsoleWrite( _ 'Test pobrania kosztu - ' & $bTesting__A & ' / ' & $bTesting__B & _ ' ( testowano: ' & $sKwota_Naliczona & ' - ' & $sKwota_Pobrana_Wczesniej & ' - ' & $sKwota_Pobieram & ' = ' & $sKwota_Do_Pobrania & ' )' _ & @CRLF) EndFunc ;==>_Example Func _String_AsRounded_Number($sData) Return Round(Number(StringReplace($sData, ",", ".")), 2) EndFunc ;==>_String_AsRounded_Number Output: $sKwota_Do_Pobrania = 1.860000000000000 $bTesting_1 = 1.859999999999999 Test pobrania kosztu - False / True ( testowano: 6.05 - 0 - 4.19 = 1.86 ) When comparing floating point values for equality, it is best to make sure that they are both rounded to the same decimal place. $bTesting1 was not rounded.
    1 point
  18. #include <Constants.au3> ; m = (Yb - Ya) / (Xb - Xa) $m = (3-50) / (100-22) $b = 50 - $m*22 ; y = mx + b $y = $m * 100 + $b MsgBox ($MB_SYSTEMMODAL,"",$y) Linear geometry...
    1 point
  19. Hello, to avoid error messages from Au3Stripper, some changes are needed. Add an auxiliary function to the SSCtrlHover.au3 Func _cHvr_CSCP() If @AutoItX64 Then Return _cHvr_CSCP_X64() Else Return _cHvr_CSCP_X86() EndIf EndFunc and replace Call(@AutoItX64 ? '_cHvr_CSCP_X64' : '_cHvr_CSCP_X86') with Call('_cHvr_CSCP') in two places. The function _cHvr_CallFunc must be completely rewritten. Here is the code: Func _cHvr_CallFunc(ByRef $aCtrlData, $iCallType) Switch $aCtrlData[$iCallType] Case '_iHoverOn' Call('_iHoverOn', $aCtrlData[1], $aCtrlData[$iCallType + 1]) Case '_iHoverOff' Call('_iHoverOff', $aCtrlData[1], $aCtrlData[$iCallType + 1]) Case '_iFullscreenToggleBtn' Call('_iFullscreenToggleBtn', $aCtrlData[1], $aCtrlData[$iCallType + 1]) EndSwitch EndFunc The line "#Au3Stripper_Ignore_Funcs=..." is no longer needed. Important: if you add new functions as arguments of the function _cHvr_Register, then you also need to add them to the function _cHvr_CallFunc.
    1 point
  20. A little bit of googling, and I found GSpread.NET. I have never used it, so I cannot say how good it is. You may be able to use it with the Excel UDF, but I'm not certain. Adam
    1 point
  21. This is just a summary of the various things I've learned over the past few days. There seems to be a lot of confusion regarding clicking/pressing a key in inactive/minimized windows. Possibly a better understanding of how Windows operates will help. So i'll start from here. Any application window is all about forms and controls. Whenever a mouse is clicked or a key is pressed an EVENT is generated and sent to the application. How this event is sent is like this: All relevant controls are sent events. For example if I click in a textbox within a window, an event is sent to the window as well as the textbox control. A developer may have chosen to handle the click from the textbox even rather than from the window event. This is why ControlSend/ControlClick to the main window often does not work. The developer may be handling the event from the control rather than the window. Hence use the Au3Info tool to get the control ID or other identifying parameters and experiment with sending the click or keypress to the control which responds to it. I suspect *and I havent tested this hypothesis* but in Winspector Spy (where one can spy the events passed by the system to various windows and controls), if one selects capture events sent to parent and child windows also, I suspect one could get the entire set of messages generated by a keypress/click and sent by the system. if we send these same events (using PostMessage and DllCall) in the same sequence to the windows and controls, then I suspect we would have replicated Send/MouseClick for inactive/minimized windows. For example scripts on sending events directly to the window/control see Check out the function _MouseClickPlus For sending keypress events check out Check out the functions _SendMinimizedMessage _SendMinimizedVK and _GetHexByKey_Switch. So to summarize use Winspector Spy to capture and then generate the exact sequence of events or get the relevant control identification using Au3Info and then do a ControlClick/ControlSend. Sometimes a control may not respond to a click, but might respond to a keypress... one needs to experiment to figure out what works. Now the question may arise, why should I use ControlClick/ControlSend rather than Send/MouseClick? Well even if one is not developing gamebots (which may need clicking into minimized windows), a lot of GUI automating scripts may fail when the workstation is locked as Send and MouseClick get disabled by the system. So to get a script running and automating a GUI when the workstation is locked or another app gets focus before the script is through etc one needs to use ControlClick/ControlSend. Automating a GUI from the task scheduler is the final part of my findings. The advantages are no one needs to be logged on to run the script. This involves certain complications. One needs to understand the Windows model presented very clearly in http://developex.com/custom-software/devxexec.html. WinXP had a relatively less constrained model during which this difficulty did not arise. Vista onwards Windows introduced Session 0 isolation which basically prevented services (and related child processes) from interacting directly with any user's desktop. See this image Session 0 has two sessions [service-0x0-3e7$] and [Winsta0]. The Service-0x0-3e7$ (this number may be different on your system) does not have any graphical interface at all, Hence no GUI function will work here. By default task scheduler launches processes into this non-interactive session. To get task scheduler to launch into the Session 0 -> Winsta0 interactive session two methods are recommended. Use the command prompt and schtasks.exe with the /IT switch to create a task. The GUI Task Scheduler does not have this option (at least on Win 7 and not on Vista also I guess). The other option which I have used is to use Task Scheduler to launch PsExec.exe (Search google for PsTools/Sysinternals) with the -i option to launch the process into the Interactive services session of Session 0. Here all GUI commands will work normally. No need to use the AlwaysUp tool (paid tool) as recommended by various forums. Obviously the caveats above apply about workstation being locked etc. If one has the interactive services detection service enabled, then one will get a message everytime a GUI is launched in this session. One can then switch to this session to debug if required. Hint: Launch a cmd prompt from task scheduler and psexec into this session and start explorer if required and it will look like any other normal session. If Interactive Services Detection service is enabled then one can also switch into this session by typing this into a command prompt rundll32 winsta.dll,WinStationSwitchToServicesSession. Another promising app which dosent seem to work as promised at least for me is devxexec at http://developex.com/custom-software/devxexec.html, which claims to be able to launch an admin gui into a user session. So thats it about automating GUIs, launching from the task manager and working around session 0 isolation on Win Vista and beyond.
    1 point
  22. Here ya go: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <ButtonConstants.au3> $WS_EX_NOACTIVATE = 0x08000000 $MA_NOACTIVATE = 3 $MA_NOACTIVATEANDEAT = 4 HotKeySet("{ESC}", "On_Exit") Global $aKeys[48] = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-", "=", _ "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", "[", "]", _ "A", "S", "D", "F", "G", "H", "J", "K", "L", ";", "'", '"', _ "Z", "X", "C", "V", "B", "N", "M", ",", ".", "/", "spc", "enter"] ; Create "keyboard" GUI $hGUI = GUICreate("Test", 360, 120, 500, 100, $WS_POPUPWINDOW, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST, $WS_EX_NOACTIVATE)) $dummy1 = GUICtrlCreateDummy() $iCount = 0 For $j = 0 To 3 For $i = 0 To 11 GUICtrlCreateButton("", $i * 30, $j * 30, 30, 30) GUICtrlSetData(-1, $aKeys[$iCount]) $iCount += 1 ;~ GUICtrlSetFont(-1, 10) ;~ GUICtrlSetBkColor(-1, 30000 + 2000 * ($i + 1) + 2000 * ($j + 1)) Next Next $dummy2 = GUICtrlCreateDummy() GUISetState() GUIRegisterMsg($WM_MOUSEACTIVATE, 'WM_EVENTS') Run("notepad.exe") While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit Case $dummy1 To $dummy2 Local $sText = ControlGetText($hGUI, "", $msg) ; Write key If $sText = "spc" Then Send("{SPACE}") ElseIf $sText = "enter" Then Send("{ENTER}") Else Send($sText) EndIf EndSwitch WEnd Func WM_EVENTS($hWndGUI, $MsgID, $WParam, $LParam) Switch $hWndGUI Case $hGUI Switch $MsgID Case $WM_MOUSEACTIVATE ; Check mouse position Local $aMouse_Pos = GUIGetCursorInfo($hGUI) If $aMouse_Pos[4] <> 0 Then Local $word = _WinAPI_MakeLong($aMouse_Pos[4], $BN_CLICKED) _SendMessage($hGUI, $WM_COMMAND, $word, GUICtrlGetHandle($aMouse_Pos[4])) EndIf Return $MA_NOACTIVATEANDEAT EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc Func On_Exit() Exit EndFunc
    1 point
  23. Info, Never give up on AutoIt! It is amazing what a good night's sleep can do for the "little grey cells": ;-) #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <WinAPI.au3> HotKeySet("{ESC}", "On_Exit") Global $aKeys[48] = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-", "=", _ "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", "[", "]", _ "A", "S", "D", "F", "G", "H", "J", "K", "L", ";", "'", "#", _ "Z", "X", "C", "V", "B", "N", "M", ",", ".", "/", "spc", "enter"] Global $fClick = False ; Create GUI to hold focus $hGUI2 = GUICreate("Focused", 200, 200, 100, 100) $hEdit = GUICtrlCreateEdit("", 10, 10, 200, 200) GUISetState() ; Create "keyboard" GUI $hGUI = GUICreate("Test", 360, 120, 500, 100, $WS_POPUPWINDOW, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST)) $hStart = GUICtrlCreateDummy() $iCount = 0 For $j = 0 To 3 For $i = 0 To 11 GUICtrlCreateLabel("", $i * 30, $j * 30, 30, 30, BitOR($SS_CENTER, $SS_CENTERIMAGE)) GUICtrlSetData(-1, $aKeys[$iCount]) $iCount += 1 GUICtrlSetFont(-1, 10) GUICtrlSetBkColor(-1, 30000 + 2000 * ($i + 1) + 2000 * ($j + 1)) Next Next GUISetState() ; Set focus _WinAPI_SetFocus($hGUI2) $hFocus_Handle = _WinAPI_GetFocus() ; Register the Click function GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND") While 1 Sleep(10) ; If Click flag set If $fClick = True Then ; Reset focus _WinAPI_SetFocus($hFocus_Handle) ; Check mouse position $aMouse_Pos = GUIGetCursorInfo($hGUI) ; Get control index $iIndex = ($aMouse_Pos[4] - $hStart - 1) ; Write key If $iIndex = 46 Then ControlSend($hGUI2, "", $hEdit, "{SPACE}") ElseIf $iIndex = 47 Then ControlSend($hGUI2, "", $hEdit, "{ENTER}") Else ControlSend($hGUI2, "", $hEdit, $aKeys[$iIndex]) EndIf ; Reset Click Flag $fClick = False EndIf WEnd Func MY_WM_COMMAND($hWnd, $MsgID, $wParam, $lParam) Local Const $STN_CLICKED = 0 Local $nNotifyCode = BitShift($wParam, 16) Switch $nNotifyCode Case $STN_CLICKED ; Set Click flag $fClick = True EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND Func On_Exit() Exit EndFuncClick on the "keys" and they print in the "Focused" GUI. Press "Escape" to exit as we are pretending the "Focused" GUI is a third party app. Over to you now to prettify it - please let us see the final result. M23 Edited: Slight improvement over original code.
    1 point
  24. @HoangVuIT I know that there are upcoming changes that will prevent you from sideloading add-ons. There may be ways to still load them using Webdriver, but I don't have plans to investigate at this time.
    0 points
×
×
  • Create New...