Leaderboard
Popular Content
Showing content with the highest reputation on 05/17/2017 in all areas
-
Form filler major modification
coffeeturtle reacted to MattHiggs for a topic
Hello autoit scripters. I believe it was just over a year ago that I posted my first major autoit script: a form filler which would send pre-selected information to the input control of your choice with either a single left mouse click or by turning a double right click into a shortcut for a paste operation. However, since then, I have been adding to it and made some very major changes. I added a few extra features to make it more usable and convenient, and I fixed a couple of bugs. I have just finished adding and testing the modifications to the script, and wanted to post the updated version. So without further ado: EDIT(6/4/2017): Fixed a bug which prevented the modification of a selected reference email address Download here1 point -
Updated Post 1 - Release CLRv3.0 CLR Change GetMembers Tag (Danyfirex) Added SafeArrayGetElement (Junkew) Add changes SafeArrayAccessData & SafeArrayUnAccessData in Examples (Larsj) Add Example GetTypes and GetMembers (Danyfirex) Add Example Run EXE from Memory (Danyfirex)1 point
-
How to open and close mozilla firefox
Sanchopanza888 reacted to Danp2 for a topic
You can manually launch FF with the proper parameters -- Run('"C:\Program Files (x86)\Mozilla Firefox\firefox.exe" "-repl 4242" -P "hub"') or you could try fixing the line in FF.au3 so the the quotations are in the correct location.1 point -
How to open and close mozilla firefox
Sanchopanza888 reacted to Danp2 for a topic
It looks like there's still a bug in FF.au3 that is preventing FF from opening with the designated profile.1 point -
You can not call a function with parameters with an OnEvent call, or a hotkey.1 point
-
I really dont know. I need to check doc. I'll check later when I got some free time. Saludos1 point
-
Autoit too many CPU usage problem
youtuber reacted to JLogan3o13 for a topic
When are you seeing it use CPU; when you are entering one of the functions or all of the time? Even spamming the "Delete Similar" button I could not drive the CPU usage above 8%.1 point -
Example: https://msdn.microsoft.com/en-us/library/office/ff835817.aspx #include <Word.au3> Local $sWord = @ScriptDir & "\Word.docx" Local $oWord = _Word_Create() Local $oDoc = _Word_DocOpen($oWord, $sWord) Local $oTables = $oDoc.Tables If StringReplace($oDoc.Tables(1).Cell(2,2).Range.Text, Chr(7), "") = 0 Then $oDoc.Tables(1).Cell(2,2).Range.Text = 1 $oDoc.Tables(1).Cell(2,2).Range.ParagraphFormat.Alignment = 1 EndIf1 point
-
And here is a basic example: nb: The StringReplace Chr(7) removes the cell end ascii character Bel #include <Word.au3> Local $sWord = @ScriptDir & "\Word.docx" Local $oWord = _Word_Create() Local $oDoc = _Word_DocOpen($oWord, $sWord) If StringReplace($oDoc.Tables(1).Cell(2,2).Range.Text, Chr(7), "") = 0 Then $oDoc.Tables(1).Cell(2,2).Range.Text = 11 point
-
See https://msdn.microsoft.com/en-us/library/office/ff821612.aspx1 point
-
Shorten the code
KickStarter15 reacted to Malkey for a topic
I found an example here. It uses two images of a check box, one clicked and the other an unclicked check box. It solves the scroll problem. I have just started modifying the example for understanding. Here it is so far. #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseX64=n #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ;https://www.autoitscript.com/forum/topic/139314-custom-listview-icons-checkboxes-multiline-edit-in-place/?do=findComment&comment=978424 #include <Array.au3> #include <GDIPlus.au3> #include <GuiConstantsEx.au3> #include <GuiListView.au3> #include <GuiImageList.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> ;#include <APIConstants.au3> #include <WinAPIEx.au3> ; from http://www.autoitscript.com/forum/topic/98712-winapiex-udf/ Global Const $ODT_LISTVIEW = 102 Global Const $ODA_DRAWENTIRE = 0x1 ; #################################### ; adjustment of the icon positioning, according to windows version Global $iAdjustV = 0 If $__WINVER > 0x0600 Then $iAdjustV = 1 ; $__WINVER defined in WinAPIEx, $__WINVER > 0x0600 means Vista+ ; #################################### _GDIPlus_Startup() $hGUI = GUICreate("ListView Set Item State", 400, 300) $cButton_CheckAll = GUICtrlCreateButton("Check All", 10, 275, 100, 20) $cButton_UncheckAll = GUICtrlCreateButton("UnCheck All", 120, 275, 100, 20) $cButton_StatesToArray = GUICtrlCreateButton("States to Array", 230, 275, 100, 20) ; comment one of the lines below to reproduce each example (don't leave both uncommented!) ; EXAMPLE 1 (WITH OWNERDRAW): $cListView = GUICtrlCreateListView("", 2, 2, 394, 268, BitOR($LVS_REPORT, $LVS_OWNERDRAWFIXED, $LVS_SHOWSELALWAYS)) ; EXAMPLE 2 (WITHOUT OWNERDRAW): ;$cListView = GUICtrlCreateListView("", 2, 2, 394, 268, BitOR($LVS_REPORT, $LVS_SHOWSELALWAYS)) $hListView = GUICtrlGetHandle($cListView) _GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES)) $hIml_Listview = _GUIImageList_Create(16, 16, 5, 3) $hBitmap_Icon = _Load_BMP_From_Mem(_Icon_Image_Checkbox_Unchecked(), True) _GUIImageList_Add($hIml_Listview, $hBitmap_Icon) _WinAPI_DeleteObject($hBitmap_Icon) $hBitmap_Icon = _Load_BMP_From_Mem(_Icon_Image_Checkbox_Checked(), True) _GUIImageList_Add($hIml_Listview, $hBitmap_Icon) _WinAPI_DeleteObject($hBitmap_Icon) _GUICtrlListView_SetImageList($hListView, $hIml_Listview, 1) ; Add columns For $i = 1 To 3 _GUICtrlListView_AddColumn($hListView, "Column " & $i, 120) Next ; Add items For $row = 1 To 20 _GUICtrlListView_AddItem($hListView, "Row " & $row & ": Col 1", 0) _GUICtrlListView_AddSubItem($hListView, $row - 1, "Row " & $row & ": Col 2", 1, 0) _GUICtrlListView_AddSubItem($hListView, $row - 1, "Row " & $row & ": Col 3", 2, 0) Next GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUIRegisterMsg($WM_DRAWITEM, "WM_DRAWITEM") GUISetState() ; Loop until user exits While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $cButton_CheckAll _LV_ImgCheckboxes_CheckAll($hListView) Case $cButton_UncheckAll _LV_ImgCheckboxes_UncheckAll($hListView) Case $cButton_StatesToArray $aLVStates = _LV_ImgCheckboxes_StatesToArray($hListView) _ArrayDisplay($aLVStates) EndSwitch WEnd GUIDelete() _GUIImageList_Destroy($hIml_Listview) _GDIPlus_Shutdown() Exit Func _LV_ImgCheckboxes_CheckAll($hWnd) _GUICtrlListView_BeginUpdate($hWnd) For $i = 0 To _GUICtrlListView_GetItemCount($hWnd) - 1 For $y = 0 To _GUICtrlListView_GetColumnCount($hWnd) - 1 _GUICtrlListView_SetItemImage($hWnd, $i, 1, $y) Next Next _GUICtrlListView_EndUpdate($hWnd) EndFunc ;==>_LV_ImgCheckboxes_CheckAll Func _LV_ImgCheckboxes_UncheckAll($hWnd) _GUICtrlListView_BeginUpdate($hWnd) For $i = 0 To _GUICtrlListView_GetItemCount($hWnd) - 1 For $y = 0 To _GUICtrlListView_GetColumnCount($hWnd) - 1 _GUICtrlListView_SetItemImage($hWnd, $i, 0, $y) Next Next _GUICtrlListView_EndUpdate($hWnd) EndFunc ;==>_LV_ImgCheckboxes_UncheckAll Func _LV_ImgCheckboxes_StatesToArray($hWnd) Local $iColumns = _GUICtrlListView_GetColumnCount($hWnd) If $iColumns = 0 Then Return SetError(1) Local $iItems = _GUICtrlListView_GetItemCount($hWnd) If $iItems = 0 Then Return SetError(2) Local $aStates[$iItems][$iColumns] For $i = 0 To $iItems - 1 For $y = 0 To $iColumns - 1 $aStates[$i][$y] = _GUICtrlListView_GetItemImage($hWnd, $i, $y) Next Next Return $aStates EndFunc ;==>_LV_ImgCheckboxes_StatesToArray Func WM_NOTIFY($hWnd, $Msg, $wParam, $lParam) Local $tNMHDR = DllStructCreate($tagNMHDR, $lParam) Local $hWndFrom = DllStructGetData($tNMHDR, "hWndFrom") Local $nNotifyCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hListView Switch $nNotifyCode Case $NM_CLICK Local $tINFO = DllStructCreate($tagNMITEMACTIVATE, $lParam) Local $iItem = DllStructGetData($tINFO, "Index") Local $iSubitem = DllStructGetData($tINFO, "SubItem") _GUICtrlListView_SetItemImage($hListView, $iItem, Not _GUICtrlListView_GetItemImage($hListView, $iItem, $iSubitem), $iSubitem) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Func WM_DRAWITEM($hWnd, $Msg, $wParam, $lParam) Local $tagDRAWITEMSTRUCT, $iBrushColor, $cID, $itmID, $itmAction, $itmState, $hItm, $hDC ;ConsoleWrite(TimerInit() & @TAB & "WM_DRAWITEM" & @CRLF) $tagDRAWITEMSTRUCT = DllStructCreate( _ "uint cType;" & _ "uint cID;" & _ "uint itmID;" & _ "uint itmAction;" & _ "uint itmState;" & _ "hwnd hItm;" & _ "hwnd hDC;" & _ "int itmRect[4];" & _ "dword itmData" _ , $lParam) If DllStructGetData($tagDRAWITEMSTRUCT, "cType") <> $ODT_LISTVIEW Then Return $GUI_RUNDEFMSG $cID = DllStructGetData($tagDRAWITEMSTRUCT, "cID") $itmID = DllStructGetData($tagDRAWITEMSTRUCT, "itmID") $itmAction = DllStructGetData($tagDRAWITEMSTRUCT, "itmAction") $itmState = DllStructGetData($tagDRAWITEMSTRUCT, "itmState") $hItm = DllStructGetData($tagDRAWITEMSTRUCT, "hItm") $hDC = DllStructGetData($tagDRAWITEMSTRUCT, "hDC") Local $aDefaultVariables[9] = [$tagDRAWITEMSTRUCT, $iBrushColor, $cID, $itmID, $itmAction, $itmState, $hItm, $hDC] Switch $cID ; will look for ControlID, not window handle. Case $cListView Switch $itmAction Case $ODA_DRAWENTIRE ConsoleWrite("test" & @CRLF) Local $aRowColors[2] = [0xFDFDFD, 0xEEDDBB] Local $aRectMargins[4] = [6, -1, 0, 0] Local $aTextFormatting[3] = [BitOR($DT_VCENTER, $DT_SINGLELINE), _ BitOR($DT_VCENTER, $DT_SINGLELINE), _ BitOR($DT_VCENTER, $DT_SINGLELINE)] __WM_DRAWITEM_ListView($hListView, $aDefaultVariables, $aRowColors, $aRectMargins, $aTextFormatting) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_DRAWITEM Func __WM_DRAWITEM_ListView(ByRef $hListView, ByRef $aDefaultVariables, ByRef $aRowColors, ByRef $aRectMargins, ByRef $aTextFormatting) Local $iSubItemCount = _GUICtrlListView_GetColumnCount($hListView) If UBound($aTextFormatting) < $iSubItemCount Then ConsoleWrite("!> Error: invalid parameters in __WM_DRAWITEM_ListView()" & @CRLF) Return EndIf Local $tagDRAWITEMSTRUCT, $iBrushColor, $cID, $itmID, $itmAction, $itmState, $hItm, $hDC $tagDRAWITEMSTRUCT = $aDefaultVariables[0] $iBrushColor = $aDefaultVariables[1] $cID = $aDefaultVariables[2] $itmID = $aDefaultVariables[3] $itmAction = $aDefaultVariables[4] $itmState = $aDefaultVariables[5] $hItm = $aDefaultVariables[6] $hDC = $aDefaultVariables[7] If _GUICtrlListView_GetItemSelected($hListView, $itmID) Then $iBrushColor = $aRowColors[1] Else $iBrushColor = $aRowColors[0] EndIf ; create a brush with the desired color: Local $aBrush = DllCall("gdi32.dll", "hwnd", "CreateSolidBrush", "int", $iBrushColor) ; get the rectangle for the whole row and fill it: Local $iLeft = DllStructGetData($tagDRAWITEMSTRUCT, "itmRect", 1) DllStructSetData($tagDRAWITEMSTRUCT, "itmRect", $iLeft + 0, 1) ; +0 is the left margin _WinAPI_FillRect($hDC, DllStructGetPtr($tagDRAWITEMSTRUCT, "itmRect"), $aBrush[0]) ; draw the text in each subitem For $i = 0 To $iSubItemCount - 1 ; get subitem text: Local $iSubItmText = _GUICtrlListView_GetItemText($hListView, $itmID, $i) ; get subitem coordinates for drawing its respective text: Local $aSubItmRect = _GUICtrlListView_GetSubItemRect($hListView, $itmID, $i) ; the function above accepts not only subitems (one-based index), but also main item (index=0) ; pass the coordinates to a DLL struct: Local $iSubItmRect = DllStructCreate("int Left;int Top;int Right;int Bottom") DllStructSetData($iSubItmRect, 1, $aSubItmRect[0] + $aRectMargins[0]) ; left margin DllStructSetData($iSubItmRect, 2, $aSubItmRect[1] + $aRectMargins[1]) ; upper margin DllStructSetData($iSubItmRect, 3, $aSubItmRect[2] + $aRectMargins[2]) ; right margin DllStructSetData($iSubItmRect, 4, $aSubItmRect[3] + $aRectMargins[3]) ; bottom margin Local $tRect = DllStructGetPtr($iSubItmRect) Local $hIcon = _GUIImageList_GetIcon($hIml_Listview, _GUICtrlListView_GetItemImage($hListView, $itmID, $i)) If $i = 0 Then DllStructSetData($iSubItmRect, "Left", DllStructGetData($iSubItmRect, "Left") + 12) _WinAPI_DrawIconEx($hDC, DllStructGetData($iSubItmRect, "Left") - 16, DllStructGetData($iSubItmRect, "Top") + $iAdjustV, $hIcon, 16, 16) DllStructSetData($iSubItmRect, "Left", DllStructGetData($iSubItmRect, "Left") + 2) Else _WinAPI_DrawIconEx($hDC, DllStructGetData($iSubItmRect, "Left"), DllStructGetData($iSubItmRect, "Top") + $iAdjustV, $hIcon, 16, 16) DllStructSetData($iSubItmRect, "Left", DllStructGetData($iSubItmRect, "Left") + 6 + 18) EndIf _GUIImageList_DestroyIcon($hIcon) If $aTextFormatting[$i] = -1 Then ; do nothing (don't draw) Else _WinAPI_DrawText($hDC, $iSubItmText, $tRect, $aTextFormatting[$i]) EndIf Next EndFunc ;==>__WM_DRAWITEM_ListView ; Based on File to Base64 String Code Generator ; by UEZ ; http://www.autoitscript.com/forum/topic/...ng-code-generator-v103-build-2 ;====================================================================================== ; Function Name: Load_BMP_From_Mem ; Description: Loads an image which is saved as a binary string and converts it to a bitmap or hbitmap ; ; Parameters: $bImage: the binary string which contains any valid image which is supported by GDI+ ; Optional: $hHBITMAP: if false a bitmap will be created, if true a hbitmap will be created ; ; Remark: hbitmap format is used generally for GUI internal images, $bitmap is more a GDI+ image format ; Don't forget _GDIPlus_Startup() and _GDIPlus_Shutdown() ; ; Requirement(s): GDIPlus.au3, Memory.au3 and _GDIPlus_BitmapCreateDIBFromBitmap() from WinAPIEx.au3 ; Return Value(s): Success: handle to bitmap (GDI+ bitmap format) or hbitmap (WinAPI bitmap format), ; Error: 0 ; Error codes: 1: $bImage is not a binary string ; 2: unable to create stream on HGlobal ; 3: unable to create bitmap from stream ; ; Author(s): UEZ ; Additional Code: thanks to progandy for the MemGlobalAlloc and tVARIANT lines and ; Yashied for _GDIPlus_BitmapCreateDIBFromBitmap() from WinAPIEx.au3 ; Version: v0.97 Build 2012-01-04 Beta ;======================================================================================= Func _Load_BMP_From_Mem($bImage, $hHBITMAP = False) If Not IsBinary($bImage) Then Return SetError(1, 0, 0) Local $aResult Local Const $memBitmap = Binary($bImage) ;load image saved in variable (memory) and convert it to binary Local Const $len = BinaryLen($memBitmap) ;get length of image Local Const $hData = _MemGlobalAlloc($len, $GMEM_MOVEABLE) ;allocates movable memory ($GMEM_MOVEABLE = 0x0002) Local Const $pData = _MemGlobalLock($hData) ;translate the handle into a pointer Local $tMem = DllStructCreate("byte[" & $len & "]", $pData) ;create struct DllStructSetData($tMem, 1, $memBitmap) ;fill struct with image data _MemGlobalUnlock($hData) ;decrements the lock count associated with a memory object that was allocated with GMEM_MOVEABLE $aResult = DllCall("ole32.dll", "int", "CreateStreamOnHGlobal", "handle", $pData, "int", True, "ptr*", 0) ;Creates a stream object that uses an HGLOBAL memory handle to store the stream contents If @error Then SetError(2, 0, 0) Local Const $hStream = $aResult[3] $aResult = DllCall($__g_hGDIPDll, "uint", "GdipCreateBitmapFromStream", "ptr", $hStream, "int*", 0) ;Creates a Bitmap object based on an IStream COM interface If @error Then SetError(3, 0, 0) Local Const $hBitmap = $aResult[2] Local $tVARIANT = DllStructCreate("word vt;word r1;word r2;word r3;ptr data; ptr") DllCall("oleaut32.dll", "long", "DispCallFunc", "ptr", $hStream, "dword", 8 + 8 * @AutoItX64, _ "dword", 4, "dword", 23, "dword", 0, "ptr", 0, "ptr", 0, "ptr", DllStructGetPtr($tVARIANT)) ;release memory from $hStream to avoid memory leak $tMem = 0 $tVARIANT = 0 If $hHBITMAP Then Local Const $hHBmp = _GDIPlus_BitmapCreateDIBFromBitmap($hBitmap) _GDIPlus_BitmapDispose($hBitmap) Return $hHBmp EndIf Return $hBitmap EndFunc ;==>_Load_BMP_From_Mem Func _Decompress_Binary_String_to_Bitmap($Base64String) $Base64String = Binary($Base64String) Local $iSize_Source = BinaryLen($Base64String) Local $pBuffer_Source = _WinAPI_CreateBuffer($iSize_Source) DllStructSetData(DllStructCreate('byte[' & $iSize_Source & ']', $pBuffer_Source), 1, $Base64String) Local $pBuffer_Decompress = _WinAPI_CreateBuffer(8388608) Local $Size_Decompressed = _WinAPI_DecompressBuffer($pBuffer_Decompress, 8388608, $pBuffer_Source, $iSize_Source) Local $b_Result = Binary(DllStructGetData(DllStructCreate('byte[' & $Size_Decompressed & ']', $pBuffer_Decompress), 1)) _WinAPI_FreeMemory($pBuffer_Source) _WinAPI_FreeMemory($pBuffer_Decompress) Return $b_Result EndFunc ;==>_Decompress_Binary_String_to_Bitmap Func _Icon_Image_Checkbox_Unchecked() Local $Base64String $Base64String &= '7rBIAAABABAQEAFwCAAAaAUAABYAAMwAKAAYAJAAIAAYAVwZAQBAAQIYDgCAgAAAANfc3ADZ3t4AANvg4ADe4uIAAOLl5QDl6OgAAOns7ADs7+8AAO/x8QDx8/MAAPT19QD29/cAAPj5+QD6+/sAAPz9/QD+/v7wAP///xNc/wB/AD8A/z8APwA/AD8APwA/AD8ACAAb4HYLAAEJAOEBCgsMAA0ODxAREhISbeIBCQcC4gEIBwLiAQfbBwLiAQYHAuIBBQcC4gG2BAcC4gEDBwLiAQIHAv/jAQcC5AEGAuIB7BceAOCfHgN/AG0A4QZhAA==' Return _Decompress_Binary_String_to_Bitmap(_Base64Decode($Base64String)) EndFunc ;==>_Icon_Image_Checkbox_Unchecked Func _Icon_Image_Checkbox_Checked() Local $Base64String $Base64String &= 'z7BIAAABABAQEAFwCAAAaAUAABYAAMwAKAAYAJAAIAAYAVwZAQBAAQIYDgCAgAAAAISEhADe3t5AAN7n5wDnAQbvCO8A7wEG9/cA9/EABv///xN4/wE/AD8A/z8APwA/AD8AHwAMAOB6CwAGAQkA4QEHCAkJCR4KAgDjAQcC5AEHCAKDAwLiAQYHBwICAwI54gEFBsABAwLjAQUCxgIkBOIBBAUCRQbjAVgEBQUCAuQBAwUCCPPkAQUCBwjkAQYC4gHsF3seAOCfA38AbQDhBmEA' Return _Decompress_Binary_String_to_Bitmap(_Base64Decode($Base64String)) EndFunc ;==>_Icon_Image_Checkbox_Checked Func _Base64Decode($input_string) Local $struct = DllStructCreate("int") Local $a_Call = DllCall("Crypt32.dll", "int", "CryptStringToBinary", "str", $input_string, "int", 0, "int", 1, "ptr", 0, "ptr", DllStructGetPtr($struct, 1), "ptr", 0, "ptr", 0) If @error Or Not $a_Call[0] Then Return SetError(1, 0, "") Local $a = DllStructCreate("byte[" & DllStructGetData($struct, 1) & "]") $a_Call = DllCall("Crypt32.dll", "int", "CryptStringToBinary", "str", $input_string, "int", 0, "int", 1, "ptr", DllStructGetPtr($a), "ptr", DllStructGetPtr($struct, 1), "ptr", 0, "ptr", 0) If @error Or Not $a_Call[0] Then Return SetError(2, 0, "") Return DllStructGetData($a, 1) EndFunc ;==>_Base64Decode1 point -
Portableapps.com auto-installer
coffeeturtle reacted to MattHiggs for a topic
So I am not sure what has changed with the portableapps.com launcher, but when I go to install new portable applications using the built in search for apps function, the install menus for those applications (which previously never appeared and the apps just auto-installed) now require that the user go through the setup menus for each portable app you want to install, and if you want to install..say...all of them... this will lead to a lot of tedious menu navigation. I actually wrote this script to automate the install menu navigation when installing apps from the portableapps.com launcher: #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Version=Beta #AutoIt3Wrapper_Res_SaveSource=y #AutoIt3Wrapper_Res_Language=1033 #AutoIt3Wrapper_Res_requestedExecutionLevel=requireAdministrator #AutoIt3Wrapper_Add_Constants=n #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** Opt ( "WinTitleMatchMode", 2 ) While 1 Sleep ( 300 ) If WinExists ( "PortableApps.com Platform", "OK" ) Then $next10 = WinActivate ( "PortableApps.com Platform", "OK" ) ControlClick ( $next10, "", 2 ) EndIf If WinExists ( "PortableApps.com Installer", "I &Agree" ) Then $last = WinActivate ( "PortableApps.com Installer", "I &Agree" ) ControlClick ( $last, "", 1 ) EndIf If WinExists ( "PortableApps.com Installer", "&Next >") Then $lastreal = WinActivate ( "PortableApps.com Installer", "&Next >" ) ControlClick ( $lastreal, "", 1 ) EndIf If WinExists ( "PortableApps.com Installer", "&Install") Then $lastreal1 = WinActivate ( "PortableApps.com Installer", "&Install" ) ControlClick ( $lastreal1, "", 1 ) EndIf If WinExists ( "PortableApps.com Installer", "&Finish") Then $lastreal2 = WinActivate ( "PortableApps.com Installer", "&Finish" ) ControlClick ( $lastreal2, "", 1 ) EndIf WEnd1 point -
Back to my roots- Thank you AutoIT Community!
Realm reacted to QuickWhiteWolf for a topic
Hi everyone, I was previously a member of this forum under the username Wombat. It's been years and multiple email accounts closed since then so I decided to start fresh and take a moment to thank you all... (Admins/Mods let me know if we need to discuss this...) I started programming with AutoIT while working as a scrap catcher for a machine that chopped scrap into pieces for easier moving, I learned styles and gained strengths from some of the best members on this forum by reverse engineering their code. I gained the confidence of our IT manager by making a boast that I could write an application to replace a p.o.s. cobalt based app we were using on the floor at that time, needless to say I was way in over my head but he saw that I had potential and I luckily had built several other apps on the side that were of equal or greater value to the company. I've been working as help-desk for the past 3 years and writing software as well to facilitate the help desk and solve recurring issues with our users. I was given an office and moved out of help-desk about a year ago, after 5 years of hard work I've actually landed the title of Jr. Developer moving into mid level title/pay this year! The company has already set out an improvement path that sees me with 4 certs and a bachelors in 4 more years making great money. Before this I had only ever worked at gas stations, fast food and manual labor jobs. If you're ever worried about your life, want something more, or just want a change you can do it. It's not easy, not at all, but it's possible and software programming is a very rewarding field if you like to make things and see how others interact with them. I utilized AutoIT to bring a company into the twenty-first century, away from paper trails and sticky notes improving the quality of life for the employees on the floor (where I started before learning AutoIT). I was given the go ahead to purchase visual studio and I learned VB.Net and built an awesome piece of Zebra labeling software (Utilizing ZPL code translated froma graphical editor) for our shipping department. Now I'm diving head first into C# and we have another programmer on board as we move on to MS Team Services and begin to tackle a sweet new project involving real time awareness of our product on the factory floor utilizing RFID and windows 10 tablets. That's a long way to come in just 4 years, and I couldn't have done it without the gigantic heart this community has and the mentorship provided for people looking to get into programming. So from the bottom of my heart, with immense respect.... Thank you so much AutoIT community1 point -
Simple Dropbox For URL's
davidacrozier reacted to TheSaint for a topic
I've finally come up with a simple solution for dragging & dropping a URL. It's not perfect, but it does the job. Mostly just a tweak of some Help file examples. Thanks also to AutoBert, for his StringRegExp and example that set me on the right path. I have seen this requested for many times, so enjoy! It goes without saying, that any improvements are welcome. Dropbox For URLs.au3 #include <GUIConstantsEx.au3> #include <GuiRichEdit.au3> #include <MsgBoxConstants.au3> #include <WindowsConstants.au3> Global $hGui, $g_hRichEdit Example() Func Example() Local $cnt, $URL, $val, $text Local $iMsg, $state = $WS_CAPTION + $WS_POPUP + $WS_CLIPSIBLINGS + $WS_SYSMENU $hGui = GUICreate(StringTrimRight(@ScriptName, 4), 160, 100, -1, -1, $state, $WS_EX_TOPMOST) $g_hRichEdit = _GUICtrlRichEdit_Create($hGui, "", 10, 10, 140, 80, BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL)) GUISetState(@SW_SHOW) _GUICtrlRichEdit_SetEventMask($g_hRichEdit, $ENM_LINK) _GUICtrlRichEdit_AutoDetectURL($g_hRichEdit, True) $cnt = 0 While True $iMsg = GUIGetMsg() Select Case $iMsg = $GUI_EVENT_CLOSE _GUICtrlRichEdit_Destroy($g_hRichEdit) ExitLoop Case Else If $cnt = 20 Then $text = _GUICtrlRichEdit_GetText($g_hRichEdit) If $text <> "" Then $val = StringRegExp($text, "(?s)((ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?)", 2) If UBound($val) > 0 Then $URL = $text ClipPut($URL) ;MsgBox(0, "URL", $URL, 0, $hGui) Else _GUICtrlRichEdit_SetText($g_hRichEdit, "Only URL's are supported!") ;MsgBox(0, "Not URL", "Only URL's are supported!", 0, $hGui) EndIf Sleep(600) _GUICtrlRichEdit_SetText($g_hRichEdit, "") EndIf $cnt = 0 Else $cnt = $cnt + 1 EndIf EndSelect WEnd EndFunc ;==>Example GUIDelete($hGui) Exit I also wanted a version that would work with an earlier version of AutoIt (v3.3.0.0), to use with updates for some older scripts (programs). The following works fine on my Win XP laptop, but fails (also when compiled) on my Win 7 Netbook. I found a RichEdit example in the GUICtrlCreateEdit function (Example 2) in the AutoIt v3.3.0.0 Help file, and modified that to suit my script. Failure is no doubt due to 'MSCOMCT2.OCX' missing from the System32 folder, at the very least. Any solution to getting the following to work on Win 7 would be greatly appreciated. Perhaps a different '.OCX' file etc. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <StaticConstants.au3> Global $oMyError RichEditExample() Exit ; Rich edit control EXAMPLE using GUICtrlCreateObj ; Author: Kåre Johansson ; AutoIt Version: 3.1.1.55 ; Description: Very Simple example: Embedding RICHTEXT object ; Needs: MSCOMCT2.OCX in system32 but it's probably already there ; Date: 3 jul 2005 Func RichEditExample() Local $cnt, $DropBoxGUI, $GUIActiveX, $msg, $oRP, $state, $text, $URL, $val $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") $oRP = ObjCreate("RICHTEXT.RichtextCtrl.1") If @error Then Return $state = $WS_CAPTION + $WS_POPUP + $WS_CLIPSIBLINGS + $WS_SYSMENU $DropBoxGUI = GUICreate(StringTrimRight(@ScriptName, 4), 160, 100, -1, -1, $state, $WS_EX_TOPMOST) $GUIActiveX = GUICtrlCreateObj($oRP, 0, 0, 140, 80) GUICtrlSetPos($GUIActiveX, 5, 5, 150, 90) $cnt = 0 With $oRP; Object tag pool .OLEDrag() .Font = 'Arial' .Text = @CRLF & @CRLF & " Drag & Drop a URL here." .SelBold = True .BackColor = 0xff00 ;.FileName = @ScriptDir & '\RichText.rtf' ;$oRP.AboutBox() ;$oRP.SelBold = False ;$oRP.SelItalic = False ;$oRP.SelUnderline = False ;$oRP.SelFontSize = 8 ;$oRP.SaveFile(@ScriptDir & "\RichText.rtf", 0) EndWith GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE GUIDelete($DropBoxGUI) ExitLoop Case Else If $cnt = 20 Then $text = $oRP.Text If $text <> "" Then If $text = @CRLF & @CRLF & " Drag & Drop a URL here." Then Sleep(2000) Else $val = StringRegExp($text, "(?s)((ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?)", 2) If UBound($val) > 0 Then $URL = $text ClipPut($URL) ;MsgBox(0, "URL", $URL, 0, $hGui) Sleep(600) Else With $oRP .Text = "Only URL's are supported!" EndWith ;MsgBox(0, "Not URL", "Only URL's are supported!", 0, $hGui) Sleep(1500) EndIf EndIf With $oRP .Text = "" .SelBold = False EndWith EndIf $cnt = 0 Else $cnt = $cnt + 1 EndIf EndSelect WEnd EndFunc ;==>RichEditExample Func MyErrFunc() MsgBox(0, "AutoItCOM Test", "We intercepted a COM Error !" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $oMyError.description & @CRLF & _ "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _ "err.number is: " & @TAB & Hex($oMyError.number, 8) & @CRLF & _ "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _ "err.source is: " & @TAB & $oMyError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oMyError.helpcontext , 5) ; Will automatically continue after 5 seconds Local $err = $oMyError.number If $err = 0 Then $err = -1 SetError($err) ; to check for after this function returns EndFunc ;==>MyErrFunc And a slower embedded IE based version. This has an error in latest AutoIt, but works fine in v3.3.0.0. #include <Constants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <IE.au3> Local $DropboxGUI, $GUIActiveX, $loaded, $loops, $oBody, $oIE, $sHTML, $timeout, $urlpage _IEErrorHandlerRegister() $oIE = _IECreateEmbedded() $DropboxGUI = GUICreate("URL Dropbox", 140, 140, -1, -1, _ $WS_OVERLAPPED + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_SYSMENU, $WS_EX_TOPMOST) $GUIActiveX = GUICtrlCreateObj($oIE, 5, 5, 125, 100) $oBody = _IETagNameGetCollection($oIE, "body", 0) _IEDocInsertHTML($oBody, "", "afterbegin") $loaded = _IEPropertyGet($oIE, "locationurl") $urlpage = $loaded $loops = 0 $sHTML = "" $sHTML &= "<HTML>" & @CR $sHTML &= "<HEAD>" & @CR $sHTML &= "<TITLE>Drag And Drop Example</TITLE>" & @CR $sHTML &= "</HEAD>" & @CR $sHTML &= "<BODY>" & @CR $sHTML &= "</BODY>" & @CR $sHTML &= "</HTML>" _IELoadWaitTimeout(1) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ; Quit, Close or Exit window GUIDelete($DropboxGUI) ExitLoop Case Else ;;; If $loops = 10 Then $loops = 0 $loaded = _IEPropertyGet($oIE, "locationurl") If $loaded <> $urlpage Then _IEAction($oIE, "stop") _IEDocWriteHTML($oIE, $sHTML) If $loaded = "res://ieframe.dll/navcancl.htm" Then $loaded = "" $urlpage = $loaded _IEBodyWriteHTML($oIE, '<p style="WORD-WRAP: normal; WORD-BREAK: break-all; FONT-SIZE: 8px">' & $loaded & '</p>') EndIf Else $loops = $loops + 1 EndIf EndSelect WEnd Exit1 point -
Simple Dropbox For URL's
davidacrozier reacted to TheSaint for a topic
Added a slower embedded IE based version. This has an error in latest AutoIt so doesn't run, but runs fine in v3.3.0.0. Tested on Win XP and Win 7 (32 bit). Quite slow on my Win 7 Netbook, but I imagine it would be much faster on most PC's, so quite usable. It could however, be much slower with some links/URLs. The slowness, it seems to me, is due to a minimum web page load time that cannot be avoided, that I know of. Would be great if we could avoid the web page for the URL from loading at all.1 point -
Simple Dropbox For URL's
davidacrozier reacted to TheSaint for a topic
Well, I came up with a solution of sorts ... which works for me anyway, but not so great for sharing with an older AutoIt program of mine, that I hope to use it with, and I really do not want to recreate the program again in latest AutoIt, so I am still in need of a better solution. I did quite a bit of research a few days ago, then went away for three days, so are just now attempting to recall the important bits, for those interested. 1. I installed the Visual Basic Runtime from here. That supposedly gave me the required library elements. This wasn't enough though. 2. Then doing some research both at the AutoIt Forum and online elsewhere, for the error message (Class is not licensed for use) that I was still getting, I came across Embedded activeX component - RichText. A post there mentions an ActiveX Fix, which I downloaded from here. The included reg file did the trick. I also came across what appears to be a similar thing, called vbctrls.reg, which is said to be located on the vb6 install CD, under \Common\tools\vb\controls. If that last had been at hand, I would have tried that first instead, but I have it buried away somewhere, and couldn't spare the time to find it ... and couldn't be bothered either. P.S. I am not sure about the legality of that ActiveX Fix, so I have no intentions of recommending it. Users though, are free to do as they wish. It does seem odd to me though, that Microsoft have such a painful arrangement with these old controls, especially as the web is full of people struggling with a similar issue to mine. It is very much like VB .Net made VB6 programs redundant, which should not have been the case. According to what I have read, if the control was provided in a specific manner (attached to a form or something), then the licensing issue doesn't occur ... but I have no clue how to implement such in AutoIt ... if you even can.1 point -
You'd have to run the autoit application on the computer you're connecting to to read the status bar. Another option is to create screenshots of each of the available errors and use imagesearch to see if any of them are shown. This may or may not work depending on the colors from the vnc client. At a lower connection speed vnc, well any remote connection, will lower the bitrate of the screen (so colors may get dulled or not look as pretty), which can affect ImageSearch. Always worth a shot though. (Note, this is not OCRing the error. This is creating a small image of each of the error messages and just searching for that image on the screen. Doesn't matter what the text really is, if it finds the image you can know what the error actually is)1 point
-
Simple Dropbox For URL's
davidacrozier reacted to TheSaint for a topic
Added another method for earlier versions of AutoIt, that were before the inclusion of the RichEdit UDF. NOTE - It works fine for me on Win XP, but fails on Win 7. Any solution to that would be greatly appreciated.1 point -
Here's a simple way to show a dragged area. #include<Misc.au3> #include <windowsconstants.au3> $area = GUICreate("", 1, 1, 1, 1, $WS_POPUP, $WS_EX_TOPMOST) GUISetBkColor(0x0000ff, $area) WinSetTrans($area, "", 80) GUISetState() While 1 If _IsPressed("1") Then $mp = MouseGetPos() WinMove($area, "", $mp[0], $mp[1], 1, 1) While _IsPressed('01') $pos = MouseGetPos() $lefts = Order($mp[0], $pos[0]) $tops = Order($mp[1], $pos[1]) WinMove($area, "", $lefts[0], $tops[0], $lefts[1], $tops[1]) ConsoleWrite($lefts[0] & ', ' & $tops[0] & ', ' & $lefts[1] & ', ' & $tops[1] & @CRLF) WEnd EndIf WEnd Func Order($a, $b) Dim $res[2] If $a < $b Then $res[0] = $a $res[1] = $b - $a Else $res[0] = $b $res[1] = $a - $b EndIf Return $res EndFunc ;==>Order1 point