Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/11/2012 in all areas

  1. Hi, This script was inspired by the example of PaulIA here. I made it easy to set dragable items for specific ListBox control, you can unset them to Here is an example: #include <GuiConstantsEx.au3> #include <DragList_UDF.au3> $hGUI = GUICreate("_DragList_... Demo", 400, 200) $nList1 = GUICtrlCreateList("", 20, 10, 160, 140, $WS_BORDER+$WS_VSCROLL) GUICtrlSetData($nList1, "Hi,|How|Are|You?") $nList2 = GUICtrlCreateList("", 220, 10, 160, 140, $WS_BORDER+$WS_VSCROLL) GUICtrlSetData($nList2, "AutoIt|Is|The|Best!") $SetList1_CheckBox = GUICtrlCreateCheckBox("Set List 1", 60, 160, 70, 20) $SetList2_CheckBox = GUICtrlCreateCheckBox("Set List 2", 260, 160, 70, 20) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $SetList1_CheckBox If GUICtrlRead($SetList1_CheckBox) = $GUI_CHECKED Then _DragList_SetList($nList1, $hGUI) Else _DragList_SetList($nList1) EndIf Case $SetList2_CheckBox If GUICtrlRead($SetList2_CheckBox) = $GUI_CHECKED Then _DragList_SetList($nList2, $hGUI) Else _DragList_SetList($nList2) EndIf EndSwitch Wend Just set the checkboxes, and try to drag the items . This example + DragList_UDF.au3 (functions and the main handler) attached as zip file: _DragList_UDF.zip Enjoy!
    1 point
  2. I thought I'd post a recursive _FileListToArray() version that's approaching it's third birthday. It's one of the latter versions buried in Tlem's 263-post thread from June 2009: I don't claim authorship. Tlem started the ball rolling, contributing all along the way, many other members and about every MVP, MOD and even a couple DEV's had input in that thread. The function also draws from prior recursive _FileListToArray() versions. I do think it is still the most straight-forward version floating around, having all the most useful bells and whistles, and functions both efficiently and properly. It hasn't the "depth" or "sort" options available in the newer popular version by Melba23, but it offers a very concise single-function alternative. After nearly 3 years, I thought that something ought to be dug out of the obscurity of that massive thread (into which a lot of effort was invested by many) and placed where it's easier to find. This is identical to post 252 from the 2009 thread except the the function name is changed, the parameters are reordered to make it backward compatible with the production _FileListToArray, and the SRER escaping special characters, that used to have the comment " ; what other characters? ", is now complete. #include <Array.au3> #include <File.au3> $timer = TimerInit() $aArray = _FileListToArrayPlus(@WindowsDir, "s*.???.*", 1, "", "*.exe.*", 1, True) $timer = Round(TimerDiff($timer) / 1000, 2) & ' sec' _ArrayDisplay($aArray, $timer) Exit ; #FUNCTION# ===================================================================================================================== ; _FileListToArrayPlus($sPath, $sInclude = "*", $iFlag = 0, $sExcludeFolder = "", $sExclude = "", $iPathType = 0, $bRecursive = False) ; Name...........: _FileListToArrayPlus ; Parameters ....: $sPath: Folder to search ; $sInclude: String to match on (wildcards allowed, multiples delimited by ;) ; $iFlag: Returned data type. 0 = Files and folders (default), 1 = Files only, 2 = Folders only ; $sExcludeFolder: List of folders to exclude from search (wildcards allowed, multiples delimited by ;) ; $sExclude: List of filenames to exclude from search (wildcards allowed, multiples delimited by ;) ; $iPathType: Returned data format. 0 = Filename only (default), 1 = Path relative to $sPath, 2 = Full path/filename ; $bRecursive: False = Search $sPath folder only (default), True = Search $sPath and all subfolders ; Author ........: Half the AutoIt community (Forum thread #96952) ;=================================================================================================================================== Func _FileListToArrayPlus($sPath, $sInclude = "", $iFlag = 0, $sExcludeFolder = "", $sExclude = "", $iPathType = 0, $bRecursive = False) Local $sRet = "", $sReturnFormat = "" $sPath = StringRegExpReplace($sPath, "[/]+z", "") & "" ; ensure single trailing slash If Not FileExists($sPath) Then Return SetError(1, 1, "") ; Edit include files list If $sInclude = "*" Then $sInclude = "" If $sInclude Then If StringRegExp($sInclude, "[/:><|]|(?s)As*z") Then Return SetError(2, 2, "") ; invalid characters test $sInclude = StringRegExpReplace(StringRegExpReplace($sInclude, "(s*;s*)+", ";"), "A;|;z", "") ; Strip unwanted whitespace $sInclude = StringRegExpReplace($sInclude, "[][$.+^{}()]", "$0"); Ignore special characters $sInclude = StringReplace(StringReplace(StringReplace($sInclude, "?", "."), "*", ".*?"), ";", "$|") ; Convert ? to ., * to .*?, and ; to | $sInclude = "(?i)A(" & $sInclude & "$)"; case-insensitive, match from first char, terminate strings EndIf ; Edit exclude folders list If $sExcludeFolder Then $sExcludeFolder = StringRegExpReplace(StringRegExpReplace($sExcludeFolder, "(s*;s*)+", ";"), "A;|;z", "") ; Strip unwanted whitespace $sExcludeFolder = StringRegExpReplace($sExcludeFolder, "[][$.+^{}()]", "$0"); Ignore special characters $sExcludeFolder = StringReplace(StringReplace(StringReplace($sExcludeFolder, "?", "."), "*", ".*?"), ";", "$|") ; Convert ?=. *=.*? ;=| $sExcludeFolder = "(?i)A(?!" & $sExcludeFolder & "$)"; case-insensitive, match from first char, terminate strings EndIf ; Edit exclude files list If $sExclude Then $sExclude = StringRegExpReplace(StringRegExpReplace($sExclude, "(s*;s*)+", ";"), "A;|;z", "") ; Strip unwanted whitespace $sExclude = StringRegExpReplace($sExclude, "[][$.+^{}()]", "$0"); Ignore special characters $sExclude = StringReplace(StringReplace(StringReplace($sExclude, "?", "."), "*", ".*?"), ";", "$|") ; Convert ?=. *=.*? ;=| $sExclude = "(?i)A(?!" & $sExclude & "$)"; case-insensitive, match from first char, terminate strings EndIf ; MsgBox(1,"Masks","File include: " & $sInclude & @CRLF & "File exclude: " & $sExclude & @CRLF & "Dir exclude : " & $sExcludeFolder) If Not ($iFlag = 0 Or $iFlag = 1 Or $iFlag = 2) Then Return SetError(3, 3, "") Local $sOrigPathLen = StringLen($sPath), $aQueue[64] = [1,$sPath], $iQMax = 63 ; tuned? While $aQueue[0] $WorkFolder = $aQueue[$aQueue[0]] $aQueue[0] -= 1 $search = FileFindFirstFile($WorkFolder & "*") If @error Then ContinueLoop Switch $iPathType Case 1 ; relative path $sReturnFormat = StringTrimLeft($WorkFolder, $sOrigPathLen) Case 2 ; full path $sReturnFormat = $WorkFolder EndSwitch While 1 $file = FileFindNextFile($search) If @error Then ExitLoop If @extended Then ; Folder If $sExcludeFolder And Not StringRegExp($file, $sExcludeFolder) Then ContinueLoop If $bRecursive Then If $aQueue[0] = $iQMax Then $iQMax += 128 ; tuned? ReDim $aQueue[$iQMax + 1] EndIf $aQueue[0] += 1 $aQueue[$aQueue[0]] = $WorkFolder & $file & "" EndIf If $iFlag = 1 Then ContinueLoop $sRet &= $sReturnFormat & $file & "|" Else ; File If $iFlag = 2 Then ContinueLoop If $sInclude And Not StringRegExp($file, $sInclude) Then ContinueLoop If $sExclude And Not StringRegExp($file, $sExclude) Then ContinueLoop $sRet &= $sReturnFormat & $file & "|" EndIf WEnd FileClose($search) WEnd If Not $sRet Then Return SetError(4, 4, "") Return StringSplit(StringTrimRight($sRet, 1), "|") EndFunc Edit: Put the mysteriously disappearing "" back in. Thanks, agerrika & AZJIO Edit2: Correct all the missing backslashes.
    1 point
  3. Quite often I find myself copying something in Scite, opening my browser and doing a google search for it. If you too find yourself doing this a lot then here's a small command you can add to Scite to speed up the process. It adds rightclick menu option that google searches whatever you have selected. To add just go to the Options menu, select "Open User Options File", append the code posted below, click save and restart Scite. # Right Click Menu Items - (Only define once) user.context.menu=||Google Selected|1140|AutoIt Forum Search|1141 # 40 Google Selected Command command.40.*="http://www.google.com/search?q=$(CurrentSelection)" command.subsystem.40.*=2 command.quiet.40.*=1 # 41 AutoIt Forum Search Command command.41.*="http://www.autoitscript.com/forum/index.php?app=core&module=search&do=search&search_term=$(CurrentSelection)" command.subsystem.41.*=2 command.quiet.41.*=1
    1 point
  4. For DuckDuckGo.com user user.context.menu=||Add as Snippet|1116|DDG Selected|1140|AutoIt Forum Search|1141 # 40 DDG Selected command.40.*="http://duckduckgo.com/?q=$(CurrentSelection)" command.subsystem.40.*=2 command.quiet.40.*=1 # 41 AutoIt Forum Search command.41.*="http//duckduckgo.com/?q=site:autoitscript.com+$(CurrentSelection)" command.subsystem.41.*=2 command.quiet.41.*=1
    1 point
  5. Show the code. Can't troubleshoot without that. What you're telling us is like calling a car mechanic and saying "I have a car and it won't drive. I found another car that looks like mine and it doesn't drive either. I've looked at the wheels and they're all round, but the car still won't drive." Without looking at the car, the mechanic can't help.
    1 point
  6. PM sent with the beta version. For anyone interested this is what the new changelog is currently looking like.
    1 point
  7. ZenMastah, As guinness pointed out earlier, $dekaron.exe appears to be a game. Please read the Forum Rules before you post again. And if and when you post again, lose the attitude. M23
    1 point
  8. A few files for the Beginning: 1. Bubble (a game for AutoIt Move at early beta status): Here 2. Bubble Reqs (Required Resources): Here Here is an Youtube video on how to use the program: http://www.youtube.com/watch?v=wfFr-HjqYE0 Have fun, more content will follow, feel free to inspire me.
    1 point
  9. maba, Two ways to do this: - 1. Delete and create the icon each time - this is what I have done with Icon_1. - 2. Create the icon once and then hide/show it as necessary - and this is what happens with Icon_2. #include <GUIConstants.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <WinAPI.au3> ; Set default values Global $sDef_1 = "Default value 1", $hIcon_1 Global $sDef_2 = "Default value 2", $hIcon_2 ; Create a GUI $hGUI = GUICreate("Test", 500, 500) $hLabel_1 = GUICtrlCreateLabel("Input 1", 10, 10, 200, 20) $hInput_1 = GUICtrlCreateInput($sDef_1, 10, 30, 200, 20) $hLabel_2 = GUICtrlCreateLabel("Input 2", 10, 110, 200, 20) $hInput_2 = GUICtrlCreateInput($sDef_2, 10, 130, 200, 20) $hIcon_2 = GUICtrlCreateIcon(@AutoItExe, -1, 220, 130, 16, 16) GUICtrlSetState(-1, $GUI_HIDE) GUISetState() ; Look for the WM_COMMAND messages GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND") ; Set current value $sInput_1_Content = $sDef_1 While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch ; Get the content of the input and compare the the last version $sInput_1_Text = GUICtrlRead($hInput_1) If $sInput_1_Text <> $sInput_1_Content Then ; It has changed so save it $sInput_1_Content = $sInput_1_Text If $sInput_1_Content <> $sDef_1 Then ; Colour the label to red GUICtrlSetBkColor($hLabel_1, 0xFFCCCC) $hIcon_1 = GUICtrlCreateIcon(@AutoItExe, -1, 220, 30, 16, 16) Else ; Set it back to white GUICtrlSetBkColor($hLabel_1, 0xFEFEFE) GUICtrlDelete($hIcon_1) EndIf EndIf WEnd Func _WM_COMMAND($hWHnd, $iMsg, $wParam, $lParam) ; If it was an update message from the correct input If _WinAPI_HiWord($wParam) = $EN_CHANGE And _WinAPI_LoWord($wParam) = $hInput_2 Then If GUICtrlRead($hInput_2) <> $sDef_2 Then ; Chenge label to green GUICtrlSetBkColor($hLabel_2, 0xCCFFCC) GUICtrlSetState($hIcon_2, $GUI_SHOW) Else ; Set it back to default GUICtrlSetBkColor($hLabel_2, _WinAPI_GetSysColor($COLOR_MENU)) GUICtrlSetState($hIcon_2, $GUI_HIDE) EndIf EndIf EndFunc ;==>_WM_COMMANDAll clear? M23
    1 point
×
×
  • Create New...