Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/31/2020 in all areas

  1. Jos

    Is AutoIt capable of that?

    This topic is locked as the OP has no intrest in getting support. Use PM when you want to do the coding for the OP for a hefty fee. Jos
    2 points
  2. 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
  3. TheXman

    Read and List Bitor Value

    Here's a very simple example: #AutoIt3Wrapper_AU3Check_Parameters=-w 3 -w 4 -w 5 -w 6 -d #include <Constants.au3> example() Func example() Local $iDrives = 10 ; 1010 (binary) ; DCBA ; │ │ ; │ └>2^0 ; └>2^3 If BitAND($iDrives, 2^0) Then ConsoleWrite("Drive A:" & @CRLF) ;1 in decimal If BitAND($iDrives, 2^1) Then ConsoleWrite("Drive B:" & @CRLF) ;2 in decimal If BitAND($iDrives, 2^2) Then ConsoleWrite("Drive C:" & @CRLF) ;4 in decimal If BitAND($iDrives, 2^3) Then ConsoleWrite("Drive D:" & @CRLF) ;8 in decimal EndFunc Output: Drive B: Drive D: Or #include <Constants.au3> #include <Array.au3> Const $DRIVE_ARRAY = StringSplit("ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", $STR_NOCOUNT) ; ZY XWVU TSRQ PONM LKJI HGFE DCBA _ArrayDisplay(get_drives(10), "Drives = 10") ;00 0000 0000 0000 0000 0000 1010 (BD) _ArrayDisplay(get_drives(96), "Drives = 96") ;00 0000 0000 0000 0000 0110 0000 (FG) _ArrayDisplay(get_drives(252), "Drives = 252") ;00 0000 0000 0000 0000 1111 1100 (CDEFGH) _ArrayDisplay(get_drives(33554432), "Drives = 33554432") ;10 0000 0000 0000 0000 0000 0000 (Z) Func get_drives($iDrives) #cs Binary bits ZYXWVUTSRQPONMLKJIHGFEDCBA │ │ └>2^25 └>2^0 #ce Local $aDrives[0] ;Identify each bit that is set (0 - 25) For $i = 0 To 25 If BitAND($iDrives, 2 ^ $i) Then _ArrayAdd($aDrives, $DRIVE_ARRAY[$i]) Next Return $aDrives EndFunc
    1 point
  4. unfortunately i do not speak your language, so i did not quite understand your video demonstrations. but it seems to me the above quotes are the core of your question, and yes, AutoIt alone can do all that very easily. for that you do not need any special functions or UDF, or external libraries. STEP 1 start by looking at the AutoIt superb help file for the functions Run() and WinMove(). write a simple script to launch a program with Run() and then move and resize that program window with WinMove(). STEP 2 once you have that working, decide on a data representation to store the coordinates of each window in a file. a simple INI format comes to mind, where your file looks something like this: [VLC] X=200 Y=60 W=800 H=600 [Word] X=0 Y=0 W=2000 H=1800 STEP 3 show what you come up with, then we can continue from there. P.S. i did not quite understand your desire to run that over network.
    1 point
  5. That is not very polite, giving orders is the best way to never receive help. But since I am there, the answer is yes. Do not ask me to write it for you, I will not.
    1 point
  6. Maybe this : #include <GUIConstants.au3> $hGui = GUICreate("Test GUI", 300, 200) $lab1 = GUICtrlCreateLabel("Test Label", 20, 40, 100, 25, $SS_SUNKEN) $but1 = GUICtrlCreateButton("Button1", 20, 70, 100, 25) $lab2 = GUICtrlCreateLabel("Test Label 2", 20, 100, 100, 25, $SS_SUNKEN) $but2 = GUICtrlCreateButton("Button2", 20, 130, 100, 25) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $lab1 MsgBox(0, "Label", "Clicked", 2) Case $GUI_EVENT_SECONDARYUP $aCur = GUIGetCursorInfo($hGui) If Not IsArray($aCur) Then ContinueLoop Switch $aCur[4] Case $lab1 MsgBox(0, "Label 1", "Right Clicked", 2) Case $but1 MsgBox(0, "Button 1", "Right Clicked", 2) Case $lab2 MsgBox(0, "Label 2", "Right Clicked", 2) Case $but2 MsgBox(0, "Button 2", "Right Clicked", 2) EndSwitch EndSwitch WEnd
    1 point
  7. I don’t think this is the place to advertise for someone to do your work for you. We are here to help others with their own work
    1 point
  8. I am pretty sure that a wide range of user-defined functions already exists for exactly this use case. Like many others, i have written a function that lists files/folders recursively with the possibility to filter by RegEx. But it has a few extras: On the one hand you can directly pass multiple search locations. On the other hand you can do much more complex filtering, because you can pass your own matching function: ; #FUNCTION# ====================================================================================== ; Name ..........: _listFilesFlexible() ; Description ...: Finds files and/or folders in a directory tree with multiple filtering options ; Syntax ........: _listFilesFlexible($sSD, [Const $sPat = '', [Const $iF = 3, [Const $1BASED = 0]]]) ; Parameters ....: $sSD - search location[s] (you can separate multiple with "|") ; Const $sPat - [optional] regular expression for filename matching or a function pointer for more complex matching ; remark: RegEx is normally case-sensitive - add (?i) at pattern start to switch to case-insensitive ; "" (Default): No filename matching - all elements will be retrieved ; Const $iF - [optional] 1=only files, 2=only folders, 3=files and folders (default:3) ; Const $1BASED - [optional] 0= zero-based - no count in $Array[0] (Default), 1= 1-based - count in $Array[0] ; Return values .: Success - Return Array with Matches ; Failure - Return "" and set @error ; Author ........: AspirinJunkie ; ================================================================================================= Func _listFilesFlexible($sSD, Const $sPat = '', Const $iF = 3, Const $1BASED = 0) Local $cEl = $1BASED, $cAS = 1 ; counter for number of elements vs. current array size Local $aRet[1] = [0] Local $aSD = StringSplit($sSD, '|', 1) ; stack for search folders Local $FFFF, $FFNF, $sDir, $sP Local $hDLL = DllOpen('kernel32.dll') Local $p_F = DllCall($hDLL, "ptr", "GetProcAddress", "handle", DllCall($hDLL, "handle", "GetModuleHandleW", "wstr", "kernel32.dll")[0], "str", "GetFileAttributesW")[0] ; get the function address of GetModuleHandleW If Not ($iF = 3 Or $iF = 1 Or $iF = 2) Then Return SetError(3, 0, "") If $sPat = "" Then Do ; pull next dir from stack $sDir = $aSD[$aSD[0]] & "\" $aSD[0] -= 1 $FFFF = FileFindFirstFile($sDir & '*') If $FFFF <> -1 Then Do $FFNF = FileFindNextFile($FFFF) If @error Then ExitLoop $sP = $sDir & $FFNF If @extended Then ; folder If BitAND($iF, 2) Then ; matched dir If $cEl >= $cAS Then $cAS += $cAS ReDim $aRet[$cAS] EndIf $aRet[$cEl] = $sP $cEl += 1 EndIf ; ignore reparse points If BitAND(DllCallAddress('dword', $p_F, 'wstr', $sP)[0], 0x400) Then ContinueLoop ; push subfolder to folder stack $aSD[0] += 1 If $aSD[0] = UBound($aSD) Then ReDim $aSD[UBound($aSD) * 2] $aSD[$aSD[0]] = $sP ElseIf BitAND($iF, 1) Then ; matched file If $cEl >= $cAS Then $cAS += $cAS ReDim $aRet[$cAS] EndIf $aRet[$cEl] = $sP $cEl += 1 EndIf Until 0 FileClose($FFFF) EndIf Until $aSD[0] = 0 ElseIf IsFunc($sPat) Then ; $sPat = function Do ; pull next dir from stack $sDir = $aSD[$aSD[0]] & "\" $aSD[0] -= 1 $FFFF = FileFindFirstFile($sDir & '*') If $FFFF <> -1 Then Do $FFNF = FileFindNextFile($FFFF) If @error Then ExitLoop $sP = $sDir & $FFNF If @extended Then ; folder If BitAND($iF, 2) And $sPat($sP) Then ; match by function If $cEl >= $cAS Then $cAS += $cAS ReDim $aRet[$cAS] EndIf $aRet[$cEl] = $sP $cEl += 1 EndIf ; ignore reparse points If BitAND(DllCallAddress('dword', $p_F, 'wstr', $sP)[0], 0x400) Then ContinueLoop ; push subfolder to folder stack $aSD[0] += 1 If $aSD[0] = UBound($aSD) Then ReDim $aSD[UBound($aSD) * 2] $aSD[$aSD[0]] = $sP ; file ElseIf BitAND($iF, 1) And $sPat($sP) Then ; match by function If $cEl >= $cAS Then $cAS += $cAS ReDim $aRet[$cAS] EndIf $aRet[$cEl] = $sP $cEl += 1 EndIf Until 0 FileClose($FFFF) EndIf Until $aSD[0] = 0 Else ; $sPat = regex Do ; pull next dir from stack $sDir = $aSD[$aSD[0]] & "\" $aSD[0] -= 1 $FFFF = FileFindFirstFile($sDir & '*') If $FFFF <> -1 Then Do $FFNF = FileFindNextFile($FFFF) If @error Then ExitLoop $sP = $sDir & $FFNF If @extended Then ; folder If BitAND($iF, 2) And StringRegExp($FFNF, $sPat) Then ; match by regex If $cEl >= $cAS Then $cAS += $cAS ReDim $aRet[$cAS] EndIf $aRet[$cEl] = $sP $cEl += 1 EndIf ; ignore reparse points If BitAND(DllCallAddress('dword', $p_F, 'wstr', $sP)[0], 0x400) Then ContinueLoop ; push subfolder to folder stack $aSD[0] += 1 If $aSD[0] = UBound($aSD) Then ReDim $aSD[UBound($aSD) * 2] $aSD[$aSD[0]] = $sP ElseIf BitAND($iF, 1) And StringRegExp($FFNF, $sPat) Then ; match by regex If $cEl >= $cAS Then $cAS += $cAS ReDim $aRet[$cAS] EndIf $aRet[$cEl] = $sP $cEl += 1 EndIf Until 0 FileClose($FFFF) EndIf Until $aSD[0] = 0 EndIf DllClose($hDLL) If $1BASED = 1 Then $aRet[0] = $cEl - 1 ReDim $aRet[$cEl] Return $aRet EndFunc ;==>_listFilesFlexible Example for simple RegEx usage: #include <Array.au3> ; all dll-files in system dir $aFiles = _listFilesFlexible(@SystemDir, "(?i)\.dll$", 1) _ArrayDisplay($aFiles) More complex example (multiple search folders with search by file size): #include <Array.au3> ; all dll files in system dir AND user profile dir which are greater than 5 mb $aFiles = _listFilesFlexible(@SystemDir & "|" & @UserProfileDir, _myCheck, 1) _ArrayDisplay($aFiles) Func _myCheck(Const $sPath) If StringRight($sPath, 4) <> ".dll" Then Return 0 If FileGetSize($sPath) > 5242880 Then Return 1 Return 0 EndFunc
    1 point
  9. I think the explanation for this behavior can be found here. You mean the script exits when the your laptop hibernates?
    1 point
  10. I have posted a fixed version in that thread, I am going to try it with a new project, wish me luck guys!
    1 point
  11. @dany Thanks for the UDF, it looks very promising, sadly it is no longer working with the latest version of AutoIt. I am not going to necro-post this thread, but I am indeed here to resurrect it! I fixed up the UDF to run with the latest version, as well as converted the encoding of the script files to UTF-8 Here is the file: AU3Text (Fixed - UTF16 NoBOM - AutoIt v3.3.14.5).zip Edit: Fixed some more stuff. Edit 2: Fixed yet more stuff, reverted some of the code to use UTF16 w/o BOM because Ini functions require that encoding...
    1 point
  12. If I may take a step back and ask a question, if you want to use AES, why aren't you using the AES-specific function (_CryptoNG_AES_CBC_EncryptData) and using its example script in the CryptoNG help file as a starting point? To answer your initial question, I'm not sure how you came up with that parameter list for that function. The CryptoNG help file shows the following for the function: _CryptoNG_EncryptData($sAlgorithmId, $sText, $vEncryptionKey, $sProvider = Default) But as I mention before, I would use algorithm-specific functions over the more generic Encryption/Decryption functions, if they exist. Which in this particular case, one does exist. If you are determined to use that function, look at the example for _CryptoNG_EncryptData in the CryptoNG help file and use that as a starting point. It is an example of AES encryption but uses a 192-bit encryption key. It can be easily modified to use a 256-bit encryption key.
    1 point
  13. How is anyone supposed to know what is "too advanced" for you to implement? I guess the fact that you question how advanced it may be, is a pretty good sign that it is probably too advanced.
    1 point
  14. @Musashi It is true that I always try to avoid downloading stuff if I can easily use built-in functionality (old fashion way). So to give OP a perspective of choices, here the unzip function that I use : #include <Constants.au3> #include <String.au3> Opt("MustDeclareVars", 1) Const $sZipFile = @ScriptDir & "\Test.zip" Const $sFolder = @ScriptDir & "\Temp" DirRemove ($sFolder, $DIR_REMOVE) UnZip($sZipFile, $sFolder) If @error Then Exit MsgBox ($MB_SYSTEMMODAL,"","Error unzipping files : " & @error) Func UnZip($sZipFile, $sDestFolder) If Not FileExists($sZipFile) Then Return SetError (1) ; source file does not exists If Not FileExists($sDestFolder) Then If Not DirCreate($sDestFolder) Then Return SetError (2) ; unable to create destination Else If Not StringInStr(FileGetAttrib($sDestFolder), "D") Then Return SetError (3) ; destination not folder EndIf Local $oShell = ObjCreate("shell.application") Local $oZip = $oShell.NameSpace($sZipFile) Local $iZipFileCount = $oZip.items.Count If Not $iZipFileCount Then Return SetError (4) ; zip file empty For $oFile In $oZip.items $oShell.NameSpace($sDestFolder).copyhere($ofile) Next EndFunc ;==>UnZip
    1 point
  15. Welcome to the forum! As a note to both new and current members and as mentioned above, please read the FAQs on the AutoIt Wiki before posting. This will save you time, as the answers to many common questions are out there. Most importantly for new forum members, please see the section on Why isn't my thread getting any replies? Forum members are here, volunteering their time to help you with your questions, and we will always do our best to assist. Below are just a few of the items we need from you in order to provide the best help, please see the FAQ section for more: First, foremost and always, know and follow the forum rules: Every member of this forum is expected to know and adhere to the forum rules. The rules are based on common sense and should not be daunting for anyone to follow. Doing so will ensure you receive assistance and will prevent any necessary sanctions by the Moderation team. We would much rather help you with your scripts than have to attend to the unpleasant business of suspending or banning accounts. Add a meaningful title to your thread: "HELP!!" tells no one anything, and will often delay your receiving assistance. Include a detailed description of what you are trying to do, what you have tried on your own, and what problem/error you are experiencing: "Doesn't work" or "AutoIt's broke" doesn't cut it. Forum members are also here to help you write and improve your own scripts; this is not a forum where you put in an order and someone writes the code for you. Always Post Code: Even if the code is not doing what you want it to, posting the code you are working from rather than asking forum members to guess is always going to result in more rapid assistance. If you cannot post the code for business reasons, create a script that reproduces the issue you are seeing.
    1 point
  16. Here's a short method I've used now and then: #include <GUIConstantsEx.au3> $hGui = GUICreate("Test GUI", 300, 200) $send = GUICtrlCreateLabel("Test Label", 20, 40, 100, 40) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $send MsgBox(0, "Label", "Clicked", 1) Case $GUI_EVENT_SECONDARYUP $aCur = GUIGetCursorInfo($hGui) If IsArray($aCur) Then If $aCur[4] = $send Then MsgBox(0, "Label", "Right Clicked", 1) EndIf EndIf EndSwitch WEnd Sometimes the method just depends on what other processing you need to include.
    1 point
  17. #include <GUIConstants.au3> #include <GuiMenu.au3> #include <WindowsConstants.au3> #include <WinAPIShellEx.au3> Global Enum $idSettings = 1000 Global $hMain = GUICreate("", 120, 50) Global $btnMenu = GUICtrlCreateButton("Menu", 10, 10, 100, 30) Global $hBtnMenu = GUICtrlGetHandle($btnMenu) Global $pButtonProc = DllCallbackGetPtr(DllCallbackRegister("ButtonProc", "lresult", "hwnd;uint;wparam;lparam;uint_ptr;dword_ptr")) GUISetState(@SW_SHOW, $hMain) _WinAPI_SetWindowSubclass($hBtnMenu, $pButtonProc, 1000) While (True) Switch (GUIGetMsg()) Case $GUI_EVENT_CLOSE GUIDelete($hMain) Exit 0 EndSwitch WEnd Func ButtonProc($hWndFrom, $iMsg, $wParam, $lParam, $iSubclassId, $pData) Switch ($hWndFrom) Case $hBtnMenu Switch ($iMsg) Case $WM_RBUTTONUP Local $hMenuButton = _GUICtrlMenu_CreatePopup($MNS_NOCHECK) _GUICtrlMenu_AddMenuItem($hMenuButton, "Settings", $idSettings) _GUICtrlMenu_TrackPopupMenu($hMenuButton, $hWndFrom) _GUICtrlMenu_DestroyMenu($hMenuButton) EndSwitch EndSwitch Return _WinAPI_DefSubclassProc($hWndFrom, $iMsg, $wParam, $lParam) EndFunc ;==>EditProc
    1 point
  18. FIle Monitorng Example - using ExecNotificationQuery Some one in the Help Forum wanted to have script to monitor files in a certain directory. You could write a basic script in AU3 to do that, but it would not be as efficient as using the native WMI functions for this. $strComputer = "." $objWMIService = ObjGet("winmgmts:" & $strComputer & "rootcimv2") $colMonitoredEvents = $objWMIService.ExecNotificationQuery _ ("SELECT * FROM __InstanceOperationEvent WITHIN 5 WHERE " _ & "Targetinstance ISA 'CIM_DirectoryContainsFile' and " _ & "TargetInstance.GroupComponent= " _ & "'Win32_Directory.Name=""c:1""'") While 1 $objEventObject = $colMonitoredEvents.NextEvent() Select Case $objEventObject.Path_.Class()="__InstanceCreationEvent" ConsoleWrite ("A new file was just created: " & $objEventObject.TargetInstance.PartComponent() & @CR) Case $objEventObject.Path_.Class()="__InstanceDeletionEvent" ConsoleWrite ("A file was just deleted: " & $objEventObject.TargetInstance.PartComponent() & @CR) EndSelect WEnd Create a folder C:1 and add or delete a file in there. See what happens. Enjoy !! ptrex
    1 point
  19. sleepydvdr

    unable to run files

    I just want to make sure you are coding the ShellExecute statement correctly. I think this is how it should be: ShellExecute("C:\Program Files\Avaya\CMS Supervisor R16\ACScript.exe", '"' & "C:\Users\****\Desktop\call data\Export Data Bra data.acsauto /AUTO" & '"')
    1 point
  20. thanks, i was thinking of making a udf to watch for them outside of an autoit gui, but i don't have the platform sdk at work anymore, nor internet access to look up what DLL's i'd have to call to watch for the events.
    1 point
  21. instead of using _isPressed() you could just watch for the events - $GUI_EVENT_PRIMARYDOWN and $GUI_EVENT_SECONDARYDOWN while 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_PRIMARYDOWN msgbox(0,"Click","Left Click") Case $msg = $GUI_EVENT_SECONDARYDOWN msgbox(0,"Click","Right Click") EndSelect and just call your functions instead of msgbox'ing which button was clicked...
    1 point
  22. Here try this: (You will need Beta to use this, you can copy and run my signature script to get it if you don't have it). #include <GUIConstants.au3> #include <Misc.au3> Opt("GUICoordMode", 1) Opt("WinTitleMatchMode", 1) Opt("MouseCoordMode", 2) $MAIN_GUI = GuiCreate("Test", 200, 200) $LABEL = GuiCtrlCreateLABEL("50", 30, 30, 80, 30) GuiSetState(@SW_SHOW) While 1 $MSG = GUIGetMsg() If $MSG = -3 Then Exit If _IsPressed(01) Then $pos = MouseGetPos() If $pos[0] > 30 And $pos[0] < 110 And $pos[1] > 30 And $pos[1] < 60 Then LeftClick() EndIf EndIf If _IsPressed(02) Then $pos = MouseGetPos() If $pos[0] > 30 And $pos[0] < 110 And $pos[1] > 30 And $pos[1] < 60 Then RightClick() EndIf EndIf Sleep(10) WEnd Func LeftClick() ;MsgBox(0, "Info", "LeftClick") $RANDOM = RANDOM(1, 1000, 1) GUICtrlSetData($LABEL, $RANDOM) EndFunc Func RightClick() ;MsgBox(0, "Info", "RightClick On LABEL") $RANDOM = RANDOM(1, 1000, 1) GUICtrlSetData($LABEL, $RANDOM) EndFunc
    1 point
×
×
  • Create New...