Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/27/2020 in all areas

  1. water

    Task Scheduler

    Version 1.6.0.1

    2,266 downloads

    Extensive library to control and manipulate Microsoft Task Scheduler Service. Please check this site for the implementation status! Please check the History.txt file in the archive for the changelog. Please check the WIKI for details about how to use the UDF. BTW: If you like this UDF please click the "I like this" button. This tells me where to next put my development effort KNOWN BUGS (last changed: 2021-02-03) None Things to come (last changed: 2021-02-03) None
    1 point
  2. To get a script to launch at a specific time, the easiest solution is (imho) to set up a task in the Task Manager. You'll need to be an admin if you want it to log in and run the script. If you're not an admin, you can either have the task fail or start as soon as the user logs back in. Setting up the task should just be a one-time thing, unless you're trying to run this from multiple computers. If you are, take a look at water's Task Scheduler UDF (see a pattern? This guy is everywhere )
    1 point
  3. Hello Mr developer , yeah you can watch water's outlook UDF in my signature. Also, if you do research on my activity in the forum you're going to find some code example of what I did very recently in outlook. It totally fit to your needs. I will edit and post some example code. But may you're going to be faster than me . #include <GuiComboBoxEx.au3> #include <OutlookEX.au3> #include <GUIConstants.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> #include <Array.au3> _OL_ErrorNotify(2) Global $oBoite = "" Global $xInboxFolder = "\Inbox" Global $xSubFolder = "\Test12345" ;~ $oBoite = "xxxxxxx@hotmail.com" ;~ $oBoite = "Contact@web-xxxx.com" Global $oItem , $oOutlook , $aFolder , $oStoreID , $aItems , $EntryID Global $nMsg , $cHeight , $iRow , $aResult , $aFolder2 , $aItems2 , $aItems3 $oOutlook = _OL_Open() If @error <> 0 Then Exit MsgBox(16, "Outlook", "Erreur de connection à Outlook. @error = " & @error & ", @extended: " & @extended) $aFolder = _OL_FolderAccess($oOutlook, $oBoite, $olFolderInbox) If @error <> 0 Then Exit MsgBox(16, "Outlook", "Erreur de connection aux dossiers Outlook. @error = " & @error & ", @extended: " & @extended) _ArrayDisplay ($aFolder , "$aFolder") $aItems = _OL_ItemFind($oOutlook, $oBoite&$xInboxFolder , $olMail, "" , "", "", "SenderEmailAddress,SenderName,Subject,Body,EntryID,Categories", "[ReceivedTime], True", 0 ) If @error <> 0 Then Exit MsgBox(16, "Outlook", "Erreur de connection aux items Outlook $aItems. @error = " & @error & ", @extended: " & @extended) _ArrayDisplay ($aItems, "$aItems") $aResult = _OL_FolderTree($oOutlook, $oBoite ) If @error <> 0 Then Exit MsgBox(16, "Outlook", "Erreur d'arbo. @error = " & @error & ", @extended: " & @extended) _ArrayDisplay ($aResult, "$aResult") $aFolder2 = _OL_FolderFind( $oOutlook , $oBoite&$xInboxFolder , 99 , "Test12345" ) If @error <> 0 Then Exit MsgBox(16, "Outlook", "Erreur Dossier introuvable folderfind. @error = " & @error & ", @extended: " & @extended) _ArrayDisplay ( $aFolder2, "$aFolder2") $aItems2 = _OL_ItemFind($oOutlook, $oBoite&"\Inbox\Test12345" , $olMail, "" , "", "", "SenderEmailAddress,SenderName,Subject,Body,EntryID,Categories", "[ReceivedTime], True", 0 ) If @error <> 0 Then Exit MsgBox(16, "Outlook", "Erreur de connection aux items Outlook $aItems2. @error = " & @error & ", @extended: " & @extended) _ArrayDisplay ($aItems2, "$aItems2") $aItems3 = _OL_ItemFind($oOutlook, $oBoite&"\Inbox\Test12345" , $olMail , "", "", "", "EntryID") If $aItems3[0][0] = 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemMove Example Script", "Could not find a mail item in folder $oBoite&'\Inbox\Test12345'. @error = " & @error) _OL_ItemMove($oOutlook, $aItems3[1][0], $aFolder[3], $oBoite&"\Inbox\Test54321" ) If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemMove Example Script", "Error moving specified task. @error = " & @error) Warning on this : Global $oBoite = "" $aItems2 = $oBoite&"\Inbox\Test12345" _OL_ItemMove _OL_ItemMove will move an item from a folder if you correct all values so be aware of it before lunch the script. If you comment that line then you can lunch without any modification
    1 point
  4. No, sorry. I played a bit with it, but felt it was kind of slow and I didn't feel the need to it...
    1 point
  5. Jos

    Code not running

    You can simply just post the Script here in a codebox for starters: This is all of it ...right? #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Res_Fileversion=0.0.0.0 #AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <File.au3> $cpu = @CPUArch $os = @OSVersion $restart = FileExists ( "restart.txt" ) $file_loc = "C:\Users\Administrator\Desktop\IBoss_Fix.exe" $file_des = "C:\Users\Administrator\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup" $framework = "Microsoft .NET Framework 4.5 Setup" $powershell86 = "PowerShell 7x86 Setup" $powershell64 = "PowerShell 7x64 Setup" FileInstall ( "D:\Iboss_fix_Project\_SAA-Student-iBoss-cloud-Windows\install_ibsa.bat" , @ScriptDir ) FileInstall ( "D:\Iboss_fix_Project\_SAA-Student-iBoss-cloud-Windows\Win 7 prereq" , @ScriptDir ) FileInstall ("D:\Iboss_fix_Project\_SAA-Student-iBoss-cloud-Windows\msi_installers" , @ScriptDir ) If $restart = "1" Then FileOpen ($framework) ControlClick ($framework, "MICROSOFT SOFTWARE SUPPLEMENTAL LICENSE TERMS", 104) ControlClick ($framework, "MICROSOFT SOFTWARE SUPPLEMENTAL LICENSE TERMS", 12324) WinWait ( $framework, "Installation Is Complete") ControlClick( $framework, "Installation Is Complete", 12325) If $cpu = "X86" Then FileOpen( "Win 7 prereq\PowerShell-7.0.3-win-x86.msi" ) WinWait ( $powershell86 ) ControlClick( $powershell86, "The Setup Wizard will install PowerShell 7-x86 on your computer. Click Next to continue or Cancel to exit the Setup Wizard." , 3470) ControlClick ( $powershell86, "Click Next to install to the default folder or click Change to choose another." , 3470) ControlClick ( $powershell86, "Initialization and Customization" , 3470) ControlClick ( $powershell86, "Ready to install PowerShell 7-x86", 3504) WinWait ( $powershell86, "Click the Finish button to exit the Setup Wizard." ) ControlClick ( $powershell86, "Click the Finish button to exit the Setup Wizard.", 3409) Else FileOpen( "Win 7 prereq\PowerShell-7.0.3-win-x86.msi" ) WinWait ( $powershell86 ) ControlClick( $powershell64, "The Setup Wizard will install PowerShell 7-x64 on your computer. Click Next to continue or Cancel to exit the Setup Wizard." , 3470) ControlClick ( $powershell64, "Click Next to install to the default folder or click Change to choose another." , 3470) ControlClick ( $powershell64, "Initialization and Customization" , 3470) ControlClick ( $powershell64, "Ready to install PowerShell 7-x86", 3504) WinWait ( $powershell64, "Click the Finish button to exit the Setup Wizard." ) ControlClick ( $powershell64, "Click the Finish button to exit the Setup Wizard.", 3409) EndIf ElseIf $os = "WIN_7" Then _FileCreate ("restart.txt") FileMove ( $file_loc, $file_des ) If $cpu = "X86" Then FileOpen ( "Win 7 prereq\1) Windows 7 Management Framework\Win7-KB3191566-x86\Win7-KB3191566-x86.msu" ) WinWaitActive( "Windows Update Standalone Installer", "Yes" ) ControlClick ( "Windows Update Standalone Installer", "Yes", 6) ControlClick ( "Download and Install Updates" , "I Accept" ,64409 ) ControlClick ( "Download and Install Updates" , "Restart Now", 64421 ) Else FileOpen ( "Win 7 prereq\1) Windows 7 Management Framework\Win7-KB3191566-x86\Win7AndW2K8R2-KB3191566-x64.msu" ) WinWaitActive( "Windows Update Standalone Installer", "Yes" ) ControlClick ( "Windows Update Standalone Installer", "Yes", 6) ControlClick ( "Download and Install Updates" , "I Accept" ,64409 ) ControlClick ( "Download and Install Updates" , "Restart Now", 64421 ) EndIf EndIf FileOpen ( "install_ibsa.bat" ) Send ( "u {ENTER}" ) WinWaitActive ( "Internet Properties") ControlClick ( "Internet Properties", " To set up an Internet connection, click Setup.", 1) If $cpu = "X32" Then FileOpen ( "msi_installers\SAA-Stu-ibsa32.msi") WinWaitClose ( "IBSA") Else FileOpen ( "msi_installers\SAA-Stu-ibsa64.msi") WinWaitClose ( "IBSA") FileMove ($file_des, $file_loc) EndIf So what exactly is going wrong as I do not know what you mean by : You mean the script stop doing anything and seems to hang? if so: Start with adding some debugging to see where it is hanging...eg: add this at the top of the script:  Opt("TrayIconDebug", 1) ;0=no info, 1=debug line info Which allows you to hover the systemstray icon and see which line it is waiting/hanging. Jos
    1 point
  6. Ya I have worked on this in the past : #include <Constants.au3> #include <GUIConstants.au3> #include <WinAPISysWin.au3> Opt("MustDeclareVars", 1) MsgBox ($MB_SYSTEMMODAL,"",MonthCalendar()) Func MonthCalendar($iLeft = -1, $iTop = -1) Local Const $asMonth[12] = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] Local Const $cHighlight = 0xD6E0FF Local $hGUI = GUICreate("", 250, 150, $iLeft, $iTop, $WS_POPUP + $WS_BORDER) Local $iPrev = GUICtrlCreateLabel(ChrW(0x25C0), 25, 15, 25, 25, $SS_CENTER) GUICtrlSetFont(-1, 16) Local $iNext = GUICtrlCreateLabel(ChrW(0x25B6), 205, 15, 25, 25, $SS_CENTER) GUICtrlSetFont(-1, 16) Local $iYear = GUICtrlCreateLabel(@YEAR, 100, 21, 50, 25, $SS_CENTER) Local $aiMonth[12], $i = 0 For $y = 0 To 2 For $x = 0 To 3 $aiMonth[$i] = GUICtrlCreateLabel($asMonth[$i], 50 * $x + 38, 30 * $y + 50, 30, 20, $SS_CENTER + $SS_CENTERIMAGE) GUICtrlSetFont(-1, 10) $i += 1 Next Next GUISetState(@SW_SHOW) $i = Int(@MON) - 1 GUICtrlSetBkColor($aiMonth[$i], $cHighlight) Local $iOK = GUICtrlCreateDummy () Local $aAccelKeys[1][2] = [["{ENTER}", $iOK]] GUISetAccelerators($aAccelKeys) Local $nMsg While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE GUIDelete () Return ("") Case $iPrev GUICtrlSetData($iYear, GUICtrlRead($iYear) - 1) Case $iNext GUICtrlSetData($iYear, GUICtrlRead($iYear) + 1) Case $aiMonth[0] To $aiMonth[11] If $i = $nMsg - $aiMonth[0] Then ContinueLoop GUICtrlSetBkColor($nMsg, $cHighlight) GUICtrlSetBkColor($aiMonth[$i], Default) $i = $nMsg - $aiMonth[0] Case $iOK Local $sReturn = GUICtrlRead($iYear) & "|" & $i + 1 GUIDelete() Return $sReturn EndSwitch WEnd EndFunc ;==>MonthCalendar
    1 point
  7. #include <GDIPlus.au3> #include <WinAPISysWin.au3> #include <WindowsConstants.au3> _GDIPlus_Startup() $hImgBack = _GDIPlus_ImageLoadFromFile("back.png") If @error Then Exit MsgBox(0, "Error", "Can't load back.png") $hImgNeedle = _GDIPlus_ImageLoadFromFile("needle.png") If @error Then Exit MsgBox(0, "Error", "Can't load needle.png") _GDIPlus_BitmapSetResolution($hImgBack, 96, 96) _GDIPlus_BitmapSetResolution($hImgNeedle, 96, 96) $aSize = _GDIPlus_ImageGetDimension($hImgBack) $hGUI = GUICreate("", $aSize[0], $aSize[1], -1, -1, -1, BitOR($WS_EX_LAYERED, $WS_EX_TOOLWINDOW, $WS_EX_CONTROLPARENT)) GUISetState() $hImgBuff = _GDIPlus_BitmapCreateFromScan0($aSize[0], $aSize[1]) $hGraphBuff = _GDIPlus_ImageGetGraphicsContext($hImgBuff) $hMatrix = _GDIPlus_MatrixCreate() _GDIPlus_MatrixTranslate($hMatrix, $aSize[0] / 2, $aSize[1] / 2) AdlibRegister("Update", 100) Do Until GUIGetMsg() = -3 ; $GUI_EVENT_CLOSE _GDIPlus_ImageDispose($hImgBack) _GDIPlus_ImageDispose($hImgNeedle) _GDIPlus_ImageDispose($hImgBuff) _GDIPlus_GraphicsDispose($hGraphBuff) _GDIPlus_MatrixDispose($hMatrix) _GDIPlus_Shutdown() Func Update() _GDIPlus_GraphicsClear($hGraphBuff, 0x00000000) _GDIPlus_GraphicsResetTransform($hGraphBuff) _GDIPlus_GraphicsDrawImage($hGraphBuff, $hImgBack, 0, 0) _GDIPlus_MatrixRotate($hMatrix, 5) _GDIPlus_GraphicsSetTransform($hGraphBuff, $hMatrix) _GDIPlus_GraphicsDrawImage($hGraphBuff, $hImgNeedle, -$aSize[0] / 2, -$aSize[1] / 2) $hBMP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImgBuff) _WinAPI_UpdateLayeredWindowEx($hGUI, -1, -1, $hBMP, 255, True) EndFunc
    1 point
  8. GokAy

    Merge 2 elements of 1d array

    Hey @Musashi, thanks for pointing that out. Problem is, there is conflicting info in the first post. However, it does what Siwa has asked for?! I took the numbering from the examples. @Siwa, should they be 5 and 6 instead? Just change this part accordingly too. $aTemp[0] = ubound($aTemp)
    1 point
  9. alfev

    OutlookEX UDF

    @water thanks for your help with this, that sorted it for me. As an idiot, I'm uniquely positioned for writing a short idiots guide to resolving this... Create a backup copy of ... C:\Program Files (x86)\AutoIt3\Include\OutlookEX.au3 Edit the original OutlookEX.au3, find the section that looks like this... Func _OL_ItemSend($oOL, $vItem, $sStoreID = Default)     If Not IsObj($vItem) Then         If StringStripWS($vItem, 3) = "" Then Return SetError(1, 0, 0)         $vItem = $oOL.Session.GetItemFromID($vItem, $sStoreID)         If @error Then Return SetError(1, @error, 0)     EndIf     $vItem.Send()     If @error Then Return SetError(2, @error, 0)     Return $vItem EndFunc   ;==>_OL_ItemSend Replace it with the copy @water wrote... Func _OL_ItemSend($oOL, $vItem, $sStoreID = Default) Local $oInspector Local Const $olMinimized = 1 ; The window is minimized If Not IsObj($vItem) Then If StringStripWS($vItem, BitOR($STR_STRIPLEADING, $STR_STRIPTRAILING)) = "" Then Return SetError(1, 0, 0) $vItem = $oOL.Session.GetItemFromID($vItem, $sStoreID) If @error Then Return SetError(1, @error, 0) EndIf $vItem.Send() If @error Then ; Handle the MAPI_E_INVALID_PARAMETER (HRESULT 0x80070057) error found in Outlook 365 Version 2009. ; Described here and the following posts: https://www.autoitscript.com/forum/topic/126305-outlookex-udf/?do=findComment&comment=1466457 If @error = 0x80070057 Then $oInspector = $vItem.GetInspector $oInspector.Activate $oInspector.WindowState = $olMinimized $vItem.Send() If @error Then Return SetError(2, @error, 0) Else Return SetError(2, @error, 0) EndIf EndIf Return $vItem EndFunc ;==>_OL_ItemSend Save OutlookEx.au3 Recompile your script. Sorted, thanks.
    1 point
  10. If you go with @water's OutlookxxxUDFs you can insert your alert into Outlook, and Microsoft will take care of it for you.
    1 point
  11. If you work with 1-based arrays, this notation is ambiguous. Yes, the array has 7 elements, but element [0] contains the number of elements from 1 to element [0], which is 6. In your example it works because you are using UBound but if you loop with 1 to element[0] you will get the error : ==> Array variable has incorrect number of subscripts #include <Array.au3> main() func main() Local $aArray[7] = ["7","a","b","c","d","e","f"] ; ==> Error ;Local $aArray[7] = ["6","a","b","c","d","e","f"] ; ==> OK For $i = 1 To $aArray[0] ConsoleWrite("Element " & $i & " = " & $aArray[$i] & @CRLF) Next EndFunc
    1 point
  12. GokAy

    Merge 2 elements of 1d array

    Hey Siwa, This should do it, unless there is a more efficient way. #include <Array.au3> main() func main() ;local $aArray[6] = ["6","a","b","c","d","e"] local $aArray[7] = ["7","a","b","c","d","e","f"] if ubound($aArray) = 7 Then ; Change number according to your need local $aTemp[2] _ArrayConcatenate($aTemp,_ArrayExtract($aArray,3,-1,0,0)) $aTemp[1] = $aArray[1] & $aArray[2] ; Change according to your need $aTemp[0] = ubound($aTemp) $aArray = $aTemp ; Assign back to original array EndIf _ArrayDisplay($aArray,"test") EndFunc
    1 point
  13. You confuse columns with rows. A 1D array only has one column, the elements are placed in the rows. You are using a so called 1-based array which means, that the first element (Row[0]) contains the number of entries (1 to Row[0]). This should probably be [5, a, b, c, d, e ] . #include <Array.au3> Global $sData, $aData $sData = 'a,b,c,d,e' $aData = StringSplit($sData, ',') _ArrayDisplay($aData) @Siwa : EDIT On Special occasions ==> [7,a,b,c,d,e,f] must become ==> [6,ab,c,d,e,f] On Special occasions ==> [6,a,b,c,d,e,f] must become ==> [5,ab,c,d,e,f] I recommend to read a tutorial regarding arrays first, e.g. : https://www.autoitscript.com/wiki/Arrays
    1 point
  14. ni3dprint, Concatenating the variable name as you are doing results in a literal string - when that string is passed to GUICtrlRead it is interpreted as a number, as that is what the function expects. And a literal string which does not start with a numeric character is interpreted as 0 - hence the function fails to read the correct control. What you need to do is to use Eval like this: #include <GUIConstantsEx.au3> #include <EditConstants.au3> $hGUI = GUICreate("Test", 500, 500) Local $iNumber1 = GUICtrlCreateInput("34", 50, 80, 40, 30, $ES_NUMBER) $cButton = GUICtrlCreateButton("Test", 10, 300, 80, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cButton _Test() EndSwitch WEnd Func _Test() Local $n = 1 Local $sCounterID = ("iNumber" & $n) $iCounter = GUICtrlRead(Eval($sCounterID)) ConsoleWrite($sCounterID & @CRLF) ConsoleWrite($iCounter & @CRLF) EndFunc ;==>_Test But even better would be to use an array to hold the ControlIDs of your inputs - then you can use a simple loop to iterate through them. M23
    1 point
  15. water

    OutlookEX UDF

    Seadoggie01 just expained how to create a new function that does not interfere with the OutlookEX UDF. If you want to go this route you need to write the Temp function yourself. Or we extend _OL_Wrapper_SendMail to cope with the error (like the example I posted above).
    1 point
  16. 1) Hi guys, so me and my friends started a new business and I wanted to have a system for it. 2) I don't know yet where to start and I'm not very good at programming but I'm willing to learn if this system will ease our jobs a little. 3) So, I wanted to have a system where we put all our expenses and sales, and weekly or monthly, we could generate a report from it. We might also need a POS. 4) My question is, where do I start? Can I just use MS access for the database? What should I learn first? ok, so, you can not code point 3 without prior experience. For point 2 I recommend reading the help file, run the examples and modify them to gain experience. If you read on SQLite from the help file, you'll answer point 4. As for point 1, is better to go with some industry standard due to the lack of know how, that in the end will give you the experience to come up with your own if so you wish. The learning curve for coding can reach years for proficiency. You have not shared the business type or country or ages of you and your friends, but regardless, the above is my answer
    1 point
  17. Sounds like you need an accounting system, which I wouldn't recommend writing from scratch. Take a look at Wave or Quickbooks
    1 point
  18. Hi, I did this a year ago, tweaking ArrayDisplayInternals.au3 five times for personal use. It required first to study __ArrayDisplay_Share(), gladly the function has great comments in it. Here is the summary of the tweaks (first two are cosmetic), maybe it will give you some ideas in case you wanna tweak your own version. 1) Allow ArrayDisplay initial width to be larger than 210 (default) : cosmetic. Useful if you got plenty of ArrayDisplay important titles in a script and they are cropped, then better start with an original width > 210, or you'll have to resize constantly each ArrayDisplay : ; In calling script _ArrayDisplay($aArray, "Important title not cropped" & "<<<width>>>" & "300", ...) ; in __ArrayDisplay_Share() ; ==== pixelsearch insert 1a ==== Local $iPosChevrons = StringInStr($sTitle, "<<<width>>>") ; 0 when not found If $iPosChevrons <> 0 Then Local $iForcedWidth = Number(StringMid($sTitle, $iPosChevrons + 11)) ; ex. $sTitle = "ArrayDisplay title<<<width>>>300" => 300 $sTitle = StringLeft($sTitle, $iPosChevrons - 1) ; ex. $sTitle = "ArrayDisplay title<<<width>>>300" => "ArrayDisplay title" EndIf ; =============================== ... ; ==== pixelsearch change 1b ==== ; Create GUI ; Local $iOrgWidth = 210, $iHeight = 200, $iMinSize = 250 Local $iOrgWidth = (($iPosChevrons = 0) ? (210) : ($iForcedWidth)), $iHeight = 200, $iMinSize = 250 ; =============================== 2) ArrayDisplay GUI always on top : cosmetic (tired of the "seek & hide" game with ArrayDisplay GUI) ; ==== pixelsearch change 2 ==== ; Local $hGUI = GUICreate($sTitle, $iOrgWidth, $iHeight, Default, Default, _ ; BitOR($_ARRAYCONSTANT_WS_SIZEBOX, $_ARRAYCONSTANT_WS_MINIMIZEBOX, $_ARRAYCONSTANT_WS_MAXIMIZEBOX)) Local $hGUI = GUICreate($sTitle, $iOrgWidth, $iHeight, Default, Default, _ BitOR($_ARRAYCONSTANT_WS_SIZEBOX, $_ARRAYCONSTANT_WS_MINIMIZEBOX, $_ARRAYCONSTANT_WS_MAXIMIZEBOX), 0x00000008) ; $WS_EX_TOPMOST = 0x00000008 ; =============================== 3) Allow a non-contiguous rows set to be displayed, for example rows 0, 2 and 9 ; ==== pixelsearch insert 3a ==== Local $bFilter = False If StringRight($sArrayRange, 1) = "," Then ; ex. "0,2,9," will filter on rows 0 & 2 & 9 : important "," at the end (+++) Local $aFilter = StringSplit(StringTrimRight($sArrayRange, 1), ",") ; remove last "," then Split on "," Local $bFilter = True, $iFilterInc = 0 $sArrayRange = "" ; keep compatibility with original function code EndIf ; =============================== As there are several parts of __ArrayDisplay_Share() involved in this, I only indicated the 1st part of the tweak, all following parts of the tweak are based on the test : If $bFilter Then... 4) Right-click on a row calls an external function named "_ArrayDisplay_Is_Calling", with 2 parameters being the row content and the array title. If the external function doesn't exist in the calling script, then right-click does nothing (as is in the original __ArrayDisplay_Share function) so the tweak(s) are compatible with any script using _ArrayDisplay ; ==== pixelsearch insert 4a ==== Case - 9 ; $GUI_EVENT_SECONDARYDOWN = - 9 (right click) Local $sTextRightClick = __ArrayDisplay_GetItemTextString2($idListView) ; no 2nd parameter => check if ANY row is selected If $sTextRightClick <> "" Then If $iCoordMode <> 1 Then Opt("GUICoordMode", $iCoordMode) ; reset user's Coord mode (before Call) If $iOnEventMode <> 0 Then Opt("GUIOnEventMode", $iOnEventMode) ; reset user's GUI mode (before Call) #ignorefunc _ArrayDisplay_Is_Calling ; Call() is great to call a function that may not exist without script fatal error (see help file) Call("_ArrayDisplay_Is_Calling", $sTitle, $sTextRightClick) ; @error = 0xDEAD and @extended = 0xBEEF if function does not exist or invalid number of parameters. ; don't test 0xDEAD and 0xBEEF to stay compatible with all scripts. If $iCoordMode <> 1 Then Opt("GUICoordMode", 1) ; Melba23's Coord mode (as defined much higher before While 1 loop) If $iOnEventMode <> 0 Then Opt("GUIOnEventMode", 0) ; Melba23's GetMessage mode (as defined just before While 1 loop) EndIf ; =============================== ... ; ==== pixelsearch insert 4b ==== Func __ArrayDisplay_GetItemTextString2($hWnd, $iItem = -1) ; based on _GUICtrlListView_GetItemTextString() in GuiListView.au3 ; and on _GUICtrlListView_GetNextItem() also in GuiListView.au3 Local $sRow = "", $sSeparatorChar = Opt('GUIDataSeparatorChar'), $iSelected If $iItem = -1 Then $iSelected = GUICtrlSendMsg($hWnd, 0x1000 + 12, -1, 0x0002) ; get current row selected If $iSelected = - 1 Then Return "" ; -1 if no row selected, i.e right click (in list view) in empty place or buttons or headers Else $iSelected = $iItem ; get row EndIf For $x = 0 To __ArrayDisplay_GetColumnCount($hWnd) - 1 $sRow &= __ArrayDisplay_GetItemText($hWnd, $iSelected, $x) & $sSeparatorChar Next Return StringTrimRight($sRow, 1) EndFunc ;==>__ArrayDisplay_GetItemTextString2 ; =============================== In calling script : ; ==================================================== Func _ArrayDisplay_Is_Calling(Const $sTitle, $sTextRightClick) ; display image in GUI window (function usable for other purpose) ... EndFunc ; _ArrayDisplay_Is_Calling() 5) DebugArrayDisplay : Exit button changed to Cancel Button (setting @extended to 101) and it will return to the script, so it gives more flexibility to the script, instead of a brutal exit. Also, the label control indicating the number of rows is now clickable, showing also "Ok" in its caption. "Ok / Cancel", we know where to click ; ==== pixelsearch change 5a ==== ; $idExit_Script = GUICtrlCreateButton("Exit Script", $iOffset, $aiGUISize[1] - 20, $iButtonWidth_Var, 20) ; $idData_Label = GUICtrlCreateLabel($sDisplayData, 0, $aiGUISize[1] - 20, $iButtonWidth_Var, 18, BitOR($_ARRAYCONSTANT_SS_CENTER, $_ARRAYCONSTANT_SS_CENTERIMAGE)) $idExit_Script = GUICtrlCreateButton("Cancel", $iOffset, $aiGUISize[1] - 20, $iButtonWidth_Var, 20) $idData_Label = GUICtrlCreateLabel("OK " & $sDisplayData, 0, $aiGUISize[1] - 20, $iButtonWidth_Var, 18, BitOR($_ARRAYCONSTANT_SS_CENTER, $_ARRAYCONSTANT_SS_CENTERIMAGE)) ; =============================== ... ; ==== pixelsearch change 5b ==== ; Case $_ARRAYCONSTANT_GUI_EVENT_CLOSE Case $_ARRAYCONSTANT_GUI_EVENT_CLOSE, $idData_Label ; Exitloop if Red X, Esc (if not deactivated), or left click $idData_Label ; =============================== ... Case $idExit_Script ; Clear up GUIDelete($hGUI) ; ==== pixelsearch change 5c ==== ; Exit Opt("GUICoordMode", $iCoordMode) ; Reset original Coord mode Opt("GUIOnEventMode", $iOnEventMode) ; Reset original GUI mode Return SetExtended(101, 1) ; @extended = 101 and Return 1 (my way to know in calling script what to do if @extended = 101) ; =============================== In calling script, for example : _DebugArrayDisplay($aListe_img, _ $aListe_img[0] & " image" & (($aListe_img[0] = 1) ? ("") : ("s")) & " to resize", _ "1:", 0, Default, "Image name", 940) ; _DebugArrayDisplay() HAD an 'Exit Script' button (tweaked it to a 'Cancel' button to return here with @extended = 101) ; note "1:" for fun => skip row 0 (contains number of images in Array) If @extended = 101 Then Return - 1 ; requires my 5th tweak in __ArrayDisplay_Share() : user clicked on Cancel button in __ArrayDisplay_Share() Now you may ask : what are you going to do when a new AutoIt release will appear ? Well I guess I'll use (again) a utility named Beyond Compare to track the differences between the 2 original versions of __ArrayDisplay_Share(), then reinject the tweaks into the new __ArrayDisplay_Share() It shouldn't be too difficult as all 5 tweaks got "delimiters" like ; ==== pixelsearch insert 4a ==== etc... AutoIt is fun
    1 point
  19. To reply to the original poster (who possibly now works as a consultant to the UK NHS writing Excel macros for covid tracking-sorry), you need to know the limitations of your tools. To somebody that has an hammer, everything looks like a nail. Use the appropriate tools for your needs. Keep up to date with the current trends, both in your coding life and in your cv, and you will go far. Diversify, expand your horizons, and never, ever mix code from different languages while you are not fully alert! Don't use Excel for storing data,as Microsoft offered Access for that. Come to think, probably don't use Access either, but that's another story! Document your code well. Keep the documentation up to date in parallel with your coding changes. Standardise on subroutines/API's that perform repeated actions - no need to keep solving the same problem over and over. What I find astonishing is new versions of software will be released by developers, without little thought for how they will be rolled out and integrated into a production environment. You have to struggle with poor documentation and write custom scripts to answer prompts and configure destination paths so that you can shoehorn it into your environment without the support desk being overloaded with simple questions. Computers were supposed to save time and effort. Men in white coats tending to mainframes in air-conditioned rooms with false floors shouldn't exist any more. Answer me then, why is it so hard to make something just work, and work well? Can't we throw artificial intelligence at it to supplement natural intelligence of coders? Having said that, I did make $600/hour twenty odd years ago fixing COBOL code during the leadup to the Y2K fizzer. Experience beats enthusiasm every time! Bill Gates spoke about WYSIWYG (What You See Is What You Get) all those decades ago (yes, I was there to hear it, watch it crash, and giggle), but what we really need is WYWIWYG (What You Want Is What You Get) - sadly it still doesn't happen very often yet! /abusive rant mode off/
    1 point
  20. Dent

    OutlookEX UDF

    alfev: Funny that you should have literally posted this an hour ago as I came here looking for help with exactly this issue too! I have a script that I've had for a couple of years that runs daily and emails me with a success or failure message, only I noticed I wasn't getting the emails they were sitting in Drafts. I have the latest version of the udf and the problem persists. The only thing that has changed on that machine (Windows 10 Home) is Windows/Office automatic updates. On my other machine which is Win10Pro I've used gpedit.msc to completely disable updates after being forced to update and losing a week trying to fix the system (that I had to eventually rebuild). However that doesn't exist on Win10Home so I'm hoping a registry hack will disable future updates.
    1 point
  21. haha... I just bougth this book: https://www.ebay.com/itm/302366891714
    1 point
  22. You could have a look at my OutlookEX UDF (for download please see my signature). The following small example connects to the active item and sets the second and third word of the body to bold. #include <OutlookEX.au3> Global Const $wdCollapseStart = 1 ; Collapse the range to the starting point Global Const $wdWord = 2 ; A word Global Const $wdCharacter = 1 ; A character Global $oOL = _OL_Open() Global $oItem = $oOL.ActiveInspector Global $oDoc = $oItem.WordEditor Global $oRange = $oDoc.Range ; Get the range object $oRange.Collapse($wdCollapseStart) ; Move the range start/end to the start of the document $oRange.MoveStart($wdWord, 1) ; Move the range start/end to word 2 $oRange.MoveEnd($wdWord, 2) ; Move the range end two words to the right $oRange.MoveEnd($wdCharacter, -1) ; Move the range end one character to the left (so the space isn't included) $oRange.Font.Bold = True ; Set the font.underline property for the range
    1 point
  23. seadoggie01

    RegEx Challenge

    My best attempt? (?xm)(?(DEFINE) (?<FirstN>[A-Z][a-z]+) (?<FirstL>[a-z]+) (?<FirstU>[A-Z]+) (?<LastN>[A-Z][a-z]+) (?<LastL>[a-z]+) (?<LastU>[A-Z]+) (?<FullName> \b(?&FirstN)[ -](?&LastN)\b| \b(?&FirstN)[ -](?&LastL)\b| \b(?&FirstN)[ -](?&LastU)\b| \b(?&FirstL)[ -](?&LastN)\b| \b(?&FirstL)[ -](?&LastL)\b| \b(?&FirstL)[ -](?&LastU)\b| \b(?&FirstU)[ -](?&LastN)\b| \b(?&FirstU)[ -](?&LastL)\b #|\b(?&FirstU)[ -](?&LastU)\b ) ) (?&FullName) Creates first and last name group with uppercase, lowercase, and "normal" case. Full name is a giant alternative of the possible combinations (I commented out double uppercase) The é breaks it, but I imagine there's a way to fix that. I don't deal with strange Unicode characters, I delete them (Edit: This is basically an extension of genius257's RegEx, so mostly I copy pasted)
    1 point
  24. Hi I am trying to have a gui with a listview that automatically resizes with the gui (including column width based on % of gui size). I've been able to achieve this but there is an incessant flickering which I cannot seem to get rid of Any solution? Reproducer: #Include <GuiListView.au3> #Include <WindowsConstants.au3> #Include <GUIConstantsEx.au3> $maingui = GUICreate('Test', @DesktopWidth/2, @DesktopHeight/2, @DesktopWidth/2 - (@DesktopWidth/2)/2, @DesktopHeight/2 - (@DesktopHeight/2)/2, _ BitOR($WS_SIZEBOX,$WS_TABSTOP,$WS_MINIMIZEBOX)) $maingui_lv = GUICtrlCreateListView('Col 1|Col 2|Col 3|Col 4|Col 5|Col 6|Col 7|Col 8|Col 9', 0, 0, @DesktopWidth/2, @DesktopHeight/2 - 23, BitOR($LVS_REPORT, $LVS_SHOWSELALWAYS)) _GUICtrlListView_SetExtendedListViewStyle($maingui_lv, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_DOUBLEBUFFER, $LVS_EX_GRIDLINES)) GUICtrlSetResizing($maingui_lv, $GUI_DOCKBORDERS) ;Generate some random data For $i = 0 To 100 GUICtrlCreateListViewItem( _ Random(0 ,1000000, 1) &"|"& _ Random(0 ,1000000, 1) &"|"& _ Random(0 ,1000000, 1) &"|"& _ Random(0 ,1000000, 1) &"|"& _ Random(0 ,1000000, 1) &"|"& _ Random(0 ,1000000, 1) &"|"& _ Random(0 ,1000000, 1) &"|"& _ Random(0 ,1000000, 1) &"|"& _ Random(0 ,1000000, 1) , $maingui_lv) Next GUIRegisterMsg($WM_SIZE, "WM_SIZE") GUISetState() While 1 $msg = GUIGetMsg(1) Switch $msg[1] Case $maingui Switch $msg[0] Case $GUI_EVENT_CLOSE Exit EndSwitch EndSwitch WEnd Func WM_SIZE($hWnd, $Msg, $wParam, $lParam) Local $iHeight, $iWidth $iWidth = BitAND($lParam, 0xFFFF) ; _WinAPI_LoWord $iHeight = BitShift($lParam, 16) ; _WinAPI_HiWord GuiSetState(@SW_LOCK, $maingui) _GUICtrlListView_SetColumnWidth($maingui_lv, 0, ($iWidth-17)*0.20) _GUICtrlListView_SetColumnWidth($maingui_lv, 1, ($iWidth-17)*0.30) _GUICtrlListView_SetColumnWidth($maingui_lv, 2, ($iWidth-17)*0.03) _GUICtrlListView_SetColumnWidth($maingui_lv, 3, ($iWidth-17)*0.08) _GUICtrlListView_SetColumnWidth($maingui_lv, 4, ($iWidth-17)*0.07) _GUICtrlListView_SetColumnWidth($maingui_lv, 5, ($iWidth-17)*0.07) _GUICtrlListView_SetColumnWidth($maingui_lv, 6, ($iWidth-17)*0.10) _GUICtrlListView_SetColumnWidth($maingui_lv, 7, ($iWidth-17)*0.10) _GUICtrlListView_SetColumnWidth($maingui_lv, 8, ($iWidth-17)*0.05) GuiSetState(@SW_UNLOCK, $maingui) Return $GUI_RUNDEFMSG EndFunc
    1 point
×
×
  • Create New...