Leaderboard
Popular Content
Showing content with the highest reputation on 01/20/2017 in all areas
-
As you are writing data to a contiguous range of cells you could create an array and use a single call _Excel_RangeWrite. To handle errors I would first decide how severe an "error" is. I very much like the way IBM used it in the old mainframe days. I - Information. Processing has ended and everything worked fine W - Warning. Processing has ended but there was a problem which could be solved by the program (a file already existed and the script had to overwrite it) E - Error. Processing could not be done successfully. You need to solve a problem so processing can continue. All files remain in a defined state. S - Severe. The program ended in an abnormal way (no error handling and system cleanup was possible). Some files may now have an undefined state. When an E or S error happened you should not allow the script to continue. Exit on the first occurrence of the error.1 point
-
1 point
-
HotKey being Locked! Not The Send Keys But Actual Assigned Hotkeyset
Skysnake reacted to JLogan3o13 for a topic
Why not take the common sense approach and set your hotkey to something other than one of the most used letters in the English alphabet? Something you won't be using all the time?1 point -
Sorry my bad the ListView Item includes an EOL character so just added StringStripWS with flag 7 and everything is working again. Also added another function _GET_DISMPATH() This will look for Dism in the default location C:\Windows\System32\Dism.exe If it's not found it will ask to browse to the location where Dism.exe is located, it then writes this to EasyDism.ini for future reference it then adds EnvSet to that Path, that way you can just use the command: @ComSpec & ' /c Dism.exe /....' If the user doesn't have Dism and cancels it will give them the link to Windows Assessment and Deployment Kit so they can install. If its a network environment and you have Windows Assessment and Deployment Kit saved to a Shared folder you can add the following to EasyDism.ini [General] Dism Install = \\Server\Share When the user clicks on the link they will be taken to the share. Hope that makes sense, its what I used in my tool since Windows Assessment and Deployment Kit is kind of a large download. #RequireAdmin #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <StaticConstants.au3> #include <TabConstants.au3> #include <GuiTab.au3> #include <WindowsConstants.au3> #include <SendMessage.au3> #include <Constants.au3> #include <Process.au3> #include <ComboConstants.au3> #include <WinAPIDlg.au3> #include <GuiListView.au3> #include <ColorConstants.au3> #include <Array.au3> #include <String.au3> #include <FontConstants.au3.> #include <GuiEdit.au3> #include <ScrollBarsConstants.au3> #include <GuiStatusBar.au3> #include <File.au3> Opt('ExpandVarStrings', 1) Global $sINI_EASYDISM = '@ScriptDir@\EasyDism.ini' _GET_DISMPATH() $Form1 = GUICreate("Easy_DISM", 620, 680, -1, -1, -1, BitOR($WS_EX_WINDOWEDGE, $TCS_TOOLTIPS)) $c = ' /c ' $dismon = '\Dism.exe /Online"' $miInfo = '\Dism.exe /Get-MountedImageInfo"' $Tab1 = GUICtrlCreateTab(24, -1, 570, 600, BitOR($TCS_MULTILINE, $TCS_FLATBUTTONS)) ;Start AppPkg Tab $TabSheet12 = GUICtrlCreateTabItem("AppPkg") $iStart_12 = GUICtrlCreateDummy() ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $T12Checkbox1 = GUICtrlCreateCheckbox("Online", 504, 80, 60, 17) $T12Button1 = GUICtrlCreateButton("Browse", 504, 48, 75, 25) $T12Button2 = GUICtrlCreateButton("Browse", 416, 298, 75, 25) $T12Button3 = GUICtrlCreateButton("ADD", 504, 298, 75, 25) $T12Button4 = GUICtrlCreateButton("Browse", 416, 325, 75, 25) $T12Button5 = GUICtrlCreateButton("ADD", 504, 325, 75, 25) $T12Button6 = GUICtrlCreateButton("Remove", 504, 352, 75, 25) $T12Button8 = GUICtrlCreateButton("AppPkg Info", 504, 440, 75, 25) $T12Edit1 = GUICtrlCreateEdit("", 120, 80, 370, 210, $ES_READONLY + $WS_VSCROLL + $WS_HSCROLL) GUICtrlSetData(-1, "") $T12Edit2 = GUICtrlCreateEdit("", 120, 380, 370, 210, $ES_READONLY + $WS_VSCROLL + $WS_HSCROLL) GUICtrlSetData(-1, @CRLF & "Remove AppPkg: Select Online or Mount Folder" & @CRLF & "Click Remove Button and select the Apps you wish to remove" & @CRLF & @CRLF & "ADD App Package UNTESTED") $T12Input1 = GUICtrlCreateInput("", 120, 48, 370, 21) $T12Input2 = GUICtrlCreateInput("Used /SkipLicense option (error License required)", 120, 298, 281, 21) $T12Input3 = GUICtrlCreateInput("Un Tested", 120, 325, 281, 21) $T12Input4 = GUICtrlCreateInput("Click Remove and check Pkgs to be removed", 120, 352, 370, 21) $T12Label1 = GUICtrlCreateLabel("Mount Folder", 45, 48, 62, 17) $T12Label2 = GUICtrlCreateLabel("Single AppPkg", 45, 298, 70, 17) $T12Label3 = GUICtrlCreateLabel("AppPkg Folder", 45, 325, 70, 17) $T12Label4 = GUICtrlCreateLabel("Remove Apps", 45, 352, 70, 17) $iEnd_12 = GUICtrlCreateDummy() ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< GUICtrlCreateTabItem("") $Button1 = GUICtrlCreateButton("EXIT", 272, 650, 75, 25) $progress = GUICtrlCreateEdit("", 120, 600, 380, 50, $ES_READONLY) GUISetState(@SW_SHOW, $Form1) $Run = Run(@ComSpec & $c & @ScriptDir & $miInfo, "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) ProcessWaitClose($Run, 2) $data = StdoutRead($Run) GUICtrlSetData($T12Edit1, $data) ;GUICtrlSetData($T2Edit1, $data) ;GUICtrlSetData($T3Edit1, $data) ;GUICtrlSetData($T4Edit1, $data) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 Exit Case $iStart_12 To $iEnd_12 _Tab_12($nMsg) EndSwitch WEnd Func _Tab_12($nMsg) ;<<<<< AppPkg Tab Switch $nMsg Case $T12Checkbox1 If GUICtrlRead($T12Checkbox1) = $Gui_Checked Then GUICtrlSetState($T12Input1, $GUI_DISABLE) GUICtrlSetState($T12Button1, $GUI_DISABLE) ElseIf GUICtrlRead($T12Checkbox1) = $Gui_UnChecked Then GUICtrlSetState($T12Input1, $GUI_ENABLE) GUICtrlSetState($T12Button1, $GUI_ENABLE) EndIf Case $T12Button1 $of_T3Button1 = FileSelectFolder("Select Mount Folder: ", "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}", 4) GUICtrlSetData($T12Input1, $of_T3Button1) $aRun = Run(@ComSpec & ' /c "' & @ScriptDir & '\Dism.exe /Get-MountedImageInfo"', "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) ProcessWaitClose($aRun, 0) $adata = StdoutRead($aRun) GUICtrlSetData($T12Edit1, $adata) Case $T12Button2 $of_T3Button2 = FileOpenDialog("Select Pkg File", @HomeDrive, "AppPkg Files (*.appx;*.appxbundle)", 1 + 4, "") GUICtrlSetData($T12Input2, $of_T3Button2) Case $T12Button3 If GUICtrlRead($T12Checkbox1) = $Gui_UnChecked Then If GUICtrlRead($T12Input1) = "" Then MsgBox(262144, "Empty.....", "No Mount Folder Selected!") Return EndIf If GUICtrlRead($T12Input2) = "" Then MsgBox(262144, "Empty.....", "No AppPkg Selected!") Return EndIf $output = Run(@ComSpec & ' /c "' & @ScriptDir & '\Dism.exe /Image:"' & GUICtrlRead($T12Input1) & '" /Add-ProvisionedAppxPackage /PackagePath:"' & GUICtrlRead($T12Input2) & '" /SkipLicense"', '', @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) $progout = "" $progcatch = "" While 1 $progout &= StdoutRead($output) If $progout <> $progcatch Then GUICtrlSetData($progress, $progout) _GUICtrlEdit_Scroll($progress, $SB_SCROLLCARET) $progcatch = $progout EndIf If @error Then ExitLoop WEnd ElseIf GUICtrlRead($T12Checkbox1) = $Gui_Checked Then If GUICtrlRead($T12Input2) = "" Then MsgBox(262144, "Empty.....", "No AppPkg Selected!") Return EndIf $output = Run(@ComSpec & ' /c "' & @ScriptDir & '\Dism.exe /Online /Add-ProvisionedAppxPackage /PackagePath:"' & GUICtrlRead($T12Input2) & '" /SkipLicense"', '', @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) $progout = "" $progcatch = "" While 1 $progout &= StdoutRead($output) If $progout <> $progcatch Then GUICtrlSetData($progress, $progout) _GUICtrlEdit_Scroll($progress, $SB_SCROLLCARET) $progcatch = $progout EndIf If @error Then ExitLoop WEnd EndIf Case $T12Button4 $of_T3Button4 = FileSelectFolder("Select Pkg : ", "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}", 4) GUICtrlSetData($T12Input3, $of_T3Button4) Case $T12Button5 If GUICtrlRead($T12Checkbox1) = $Gui_UnChecked Then If GUICtrlRead($T12Input1) = "" Then MsgBox(262144, "Empty.....", "No Mount Folder Selected!") Return EndIf If GUICtrlRead($T12Input3) = "" Then MsgBox(262144, "Empty.....", "No AppPkg Folder Selected!") Return EndIf $output = Run(@ComSpec & ' /c "' & @ScriptDir & '\Dism.exe /Image:"' & GUICtrlRead($T12Input1) & '" /Add-ProvisionedAppxPackage /FolderPath:"' & GUICtrlRead($T12Input3) & '""', '', @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) $progout = "" $progcatch = "" While 1 $progout &= StdoutRead($output) If $progout <> $progcatch Then GUICtrlSetData($progress, $progout) _GUICtrlEdit_Scroll($progress, $SB_SCROLLCARET) $progcatch = $progout EndIf If @error Then ExitLoop WEnd ElseIf GUICtrlRead($T12Checkbox1) = $Gui_Checked Then If GUICtrlRead($T12Input3) = "" Then MsgBox(262144, "Empty.....", "No AppPkg Folder Selected!") Return EndIf $output = Run(@ComSpec & ' /c "' & @ScriptDir & '\Dism.exe /Online /Add-ProvisionedAppxPackage /FolderPath:"' & GUICtrlRead($T12Input3) & '""', '', @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) $progout = "" $progcatch = "" While 1 $progout &= StdoutRead($output) If $progout <> $progcatch Then GUICtrlSetData($progress, $progout) _GUICtrlEdit_Scroll($progress, $SB_SCROLLCARET) $progcatch = $progout EndIf If @error Then ExitLoop WEnd EndIf Case $T12Button6 If GUICtrlRead($T12Checkbox1) = $Gui_UnChecked Then If GUICtrlRead($T12Input1) = "" Then MsgBox(262144, "Empty.....", "No Mount Folder Selected!") Return EndIf _GET_PROVISIONEDAPPXPACKAGES(@ComSpec & ' /c Dism.exe /Image:"' & GUICtrlRead($T12Input1) & '" /Get-ProvisionedAppxPackages', 0) ElseIf GUICtrlRead($T12Checkbox1) = $Gui_Checked Then _GET_PROVISIONEDAPPXPACKAGES(@ComSpec & ' /c Dism.exe /Online /Get-ProvisionedAppxPackages', 1) EndIf Case $T12Button8 If GUICtrlRead($T12Checkbox1) = $Gui_UnChecked Then If GUICtrlRead($T12Input1) = "" Then MsgBox(262144, "Empty.....", "No Mount Folder Selected!") Return EndIf $bRun = Run(@ComSpec & ' /c "' & @ScriptDir & '\Dism.exe /Image:"' & GUICtrlRead($T12Input1) & '" /Get-ProvisionedAppxPackages"', "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) $progout = "" $progcatch = "" While 1 $progout &= StdoutRead($bRun) If $progout <> $progcatch Then GUICtrlSetData($T12Edit2, $progout) _GUICtrlEdit_Scroll($T12Edit2, $SB_SCROLLCARET) $progcatch = $progout EndIf If @error Then ExitLoop WEnd ElseIf GUICtrlRead($T12Checkbox1) = $Gui_Checked Then $bRun = Run(@ComSpec & ' /c "' & @ScriptDir & '\Dism.exe /Online /Get-ProvisionedAppxPackages"', "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) $progout = "" $progcatch = "" While 1 $progout &= StdoutRead($bRun) If $progout <> $progcatch Then GUICtrlSetData($T12Edit2, $progout) _GUICtrlEdit_Scroll($T12Edit2, $SB_SCROLLCARET) $progcatch = $progout EndIf If @error Then ExitLoop WEnd EndIf EndSwitch EndFunc ;==>_Tab_12 Func _GET_PROVISIONEDAPPXPACKAGES($sDISM_PARAMETERS, $iDISM_ONLINEMODE = 0) Local $aGET_PROVISIONEDAPPXPACKAGES[0][5], $hRUN_PROVISIONEDAPPXPACKAGES If @OSArch = 'x64' Then DllCall("kernel32.dll", "boolean", "Wow64DisableWow64FsRedirection", "boolean", 1) ;~ Turn On 64 Bit Redirection $hRUN_PROVISIONEDAPPXPACKAGES = Run($sDISM_PARAMETERS, '', @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) DllCall("kernel32.dll", "boolean", "Wow64DisableWow64FsRedirection", "boolean", 0) ;~ Turn Off 64 Bit Redirection Else $hRUN_PROVISIONEDAPPXPACKAGES = Run($sDISM_PARAMETERS, '', @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) EndIf ProcessWaitClose($hRUN_PROVISIONEDAPPXPACKAGES) $sRUN_PROVISIONEDAPPXPACKAGES = StdoutRead($hRUN_PROVISIONEDAPPXPACKAGES) $aRUN_PROVISIONEDAPPXPACKAGES = StringSplit($sRUN_PROVISIONEDAPPXPACKAGES, @CR) For $x = 1 To $aRUN_PROVISIONEDAPPXPACKAGES[0] If StringInStr($aRUN_PROVISIONEDAPPXPACKAGES[$x], 'DisplayName : ') Then ReDim $aGET_PROVISIONEDAPPXPACKAGES[UBound($aGET_PROVISIONEDAPPXPACKAGES) + 1][5] $aGET_PROVISIONEDAPPXPACKAGES[UBound($aGET_PROVISIONEDAPPXPACKAGES) - 1][0] = StringStripWS(StringReplace($aRUN_PROVISIONEDAPPXPACKAGES[$x], 'DisplayName : ', ''), 7) EndIf If StringInStr($aRUN_PROVISIONEDAPPXPACKAGES[$x], 'Version : ') Then $aGET_PROVISIONEDAPPXPACKAGES[UBound($aGET_PROVISIONEDAPPXPACKAGES) - 1][1] = StringStripWS(StringReplace($aRUN_PROVISIONEDAPPXPACKAGES[$x], 'Version : ', ''), 7) EndIf If StringInStr($aRUN_PROVISIONEDAPPXPACKAGES[$x], 'Architecture : ') Then $aGET_PROVISIONEDAPPXPACKAGES[UBound($aGET_PROVISIONEDAPPXPACKAGES) - 1][2] = StringStripWS(StringReplace($aRUN_PROVISIONEDAPPXPACKAGES[$x], 'Architecture : ', ''), 7) EndIf If StringInStr($aRUN_PROVISIONEDAPPXPACKAGES[$x], 'ResourceId : ') Then $aGET_PROVISIONEDAPPXPACKAGES[UBound($aGET_PROVISIONEDAPPXPACKAGES) - 1][3] = StringStripWS(StringReplace($aRUN_PROVISIONEDAPPXPACKAGES[$x], 'ResourceId : ', ''), 7) EndIf If StringInStr($aRUN_PROVISIONEDAPPXPACKAGES[$x], 'PackageName :') Then $aGET_PROVISIONEDAPPXPACKAGES[UBound($aGET_PROVISIONEDAPPXPACKAGES) - 1][4] = StringStripWS(StringReplace($aRUN_PROVISIONEDAPPXPACKAGES[$x], 'PackageName : ', ''), 7) EndIf Next Local $hGUI_PROVISIONEDAPPXPACKAGES = GUICreate('Get PackagexApps', 600, 600, -1, -1, -1, -1, $Form1) $hGUI_LISTVIEW = GUICtrlCreateListView('Display Name|Version|Architecture|ResourceId|Package Name', 5, 5, 590, 555, -1, BitOR($LVS_EX_CHECKBOXES, $LVS_EX_GRIDLINES)) _GUICtrlListView_AddArray($hGUI_LISTVIEW, $aGET_PROVISIONEDAPPXPACKAGES) _GUICtrlListView_SetColumnWidth($hGUI_LISTVIEW, 0, 250) $hBTN_CLOSEGUI = GUICtrlCreateButton('Cancel', 290, 565, 150, 30) $hBTN_REMOVEAPP = GUICtrlCreateButton('Remove Packages', 445, 565, 150, 30) GUISetState(@SW_SHOW, $hGUI_PROVISIONEDAPPXPACKAGES) While 1 $iPKG = GUIGetMsg() Switch $iPKG Case $GUI_EVENT_CLOSE, $hBTN_CLOSEGUI ExitLoop Case $hBTN_REMOVEAPP $iGUI_LISTVIEW = _GUICtrlListView_GetItemCount($hGUI_LISTVIEW) If $iGUI_LISTVIEW > 0 Then For $i = $iGUI_LISTVIEW To 0 Step -1 If _GUICtrlListView_GetItemChecked($hGUI_LISTVIEW, $i) Then Switch $iDISM_ONLINEMODE Case 0 If @OSArch = 'x64' Then DllCall("kernel32.dll", "boolean", "Wow64DisableWow64FsRedirection", "boolean", 1) ;~ Turn On 64 Bit Redirection Run(@ComSpec & ' /k Dism.exe /Image:"' & GUICtrlRead($T12Input1) & '" /Remove-ProvisionedAppxPackage /PackageName:' & $aGET_PROVISIONEDAPPXPACKAGES[$i][4]) DllCall("kernel32.dll", "boolean", "Wow64DisableWow64FsRedirection", "boolean", 0) ;~ Turn Off 64 Bit Redirection Else Run(@ComSpec & ' /k Dism.exe /Image:"' & GUICtrlRead($T12Input1) & '" /Remove-ProvisionedAppxPackage /PackageName:' & $aGET_PROVISIONEDAPPXPACKAGES[$i][4]) EndIf _GUICtrlListView_DeleteItem($hGUI_LISTVIEW, $i) Case 1 If @OSArch = 'x64' Then DllCall("kernel32.dll", "boolean", "Wow64DisableWow64FsRedirection", "boolean", 1) ;~ Turn On 64 Bit Redirection Run(@ComSpec & ' /k "' & @ScriptDir & '\Dism.exe /Online /Remove-ProvisionedAppxPackage /PackageName:' & $aGET_PROVISIONEDAPPXPACKAGES[$i][4]) DllCall("kernel32.dll", "boolean", "Wow64DisableWow64FsRedirection", "boolean", 0) ;~ Turn Off 64 Bit Redirection Else Run(@ComSpec & ' /k "' & @ScriptDir & '\Dism.exe /Online /Remove-ProvisionedAppxPackage /PackageName:' & $aGET_PROVISIONEDAPPXPACKAGES[$i][4]) EndIf _GUICtrlListView_DeleteItem($hGUI_LISTVIEW, $i) EndSwitch EndIf Next EndIf EndSwitch WEnd GUIDelete($hGUI_PROVISIONEDAPPXPACKAGES) EndFunc ;==>_GET_PROVISIONEDAPPXPACKAGES Func _GET_DISMPATH() Local $bGET_DISM_FILEPATH = False, $sGET_DISM_FILEPATH, $hGUI_DISM_FILEPATH, $hGUI_DISMEXIT $sGET_DISM_FILEPATH = IniRead($sINI_EASYDISM, 'General', 'Dism File Path', @WindowsDir & '\System32\Dism.exe') If FileExists($sGET_DISM_FILEPATH) = 0 Then $sGET_DISM_FILEPATH = FileOpenDialog('Please Select Dism.exe File:', @ProgramFilesDir & '\', 'Dism (Dism.exe)', 3) If @error Then ;~ Begin : Dism Install Dialogue GUI $hGUI_DISM_FILEPATH = GUICreate('Deployment Image Servicing and Management Tool', 470, 88) GUICtrlCreateLabel('Deployment Image Servicing and Management Tool (DISM) required please download and install Windows Assessment and Deployment Kit (ADK) using the link below:', 5, 5, 460, 28) GUICtrlCreateLabel(' - ', 5, 33, 15, 20, $SS_CENTERIMAGE) $hGUI_DISMLINK = GUICtrlCreateLabel('Windows Assessment and Deployment Kit (ADK)', 20, 33, 440, 20, $SS_CENTERIMAGE) GUICtrlSetBkColor($hGUI_DISMLINK, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont($hGUI_DISMLINK, 8.5, 400, 4, 'Arial') GUICtrlSetColor($hGUI_DISMLINK, 0x0000FF) GUICtrlSetCursor($hGUI_DISMLINK, 0) $hGUI_DISMEXIT = GUICtrlCreateButton('OK', 375, 58, 85, 25) GUISetState(@SW_SHOW, $hGUI_DISM_FILEPATH) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $hGUI_DISMEXIT ExitLoop Case $hGUI_DISMLINK ShellExecute(IniRead($sINI_EASYDISM, 'General', 'Dism Install', 'https://msdn.microsoft.com/en-us/windows/hardware/dn913721(v=vs.8.5).aspx')) ExitLoop EndSwitch WEnd GUIDelete($hGUI_DISM_FILEPATH) Exit 0 ;~ End : Dism Install Dialogue GUI Else $bGET_DISM_FILEPATH = True EndIf Else $bGET_DISM_FILEPATH = True EndIf If $bGET_DISM_FILEPATH Then Local $sENV_DISM_FILEPATH = _WinAPI_PathRemoveFileSpec($sGET_DISM_FILEPATH) Local $bENV_PATH_FILEPATH = False Local $sENV_PATH_FILEPATH = EnvGet('Path') Local $aENV_PATH_FILEPATH = StringSplit($sENV_PATH_FILEPATH, ';') For $i = 1 To $aENV_PATH_FILEPATH[0] If $aENV_PATH_FILEPATH[$i] = $sENV_DISM_FILEPATH Or $aENV_PATH_FILEPATH[$i] = '$sENV_DISM_FILEPATH$\' Then $bENV_PATH_FILEPATH = True ExitLoop EndIf Next If $bENV_PATH_FILEPATH = False Then EnvSet('PATH', '$sENV_PATH_FILEPATH$;$sGET_DISM_FILEPATH$') EnvUpdate() EndIf If $sGET_DISM_FILEPATH <> '@WindowsDir@\System32\Dism.exe' Then IniWrite($sINI_EASYDISM, 'General', 'DismPath', $sGET_DISM_FILEPATH) Return $sGET_DISM_FILEPATH EndIf Exit 0 EndFunc1 point
-
The string pool will probably be fairly large, given the content of StringsB.txt for instance. Doing a comparison character by character, string after string in such a huge list of all notebook models (just that) will take forever. Instead and if what you're going to do is match one input string with one or more entries in the huge list of "reference strings", if I were you I'd use a 3-step approach. 0- Before anything else you need to build an SQLite database of all reference strings, possibly categorized to avoid mixing peripheral names and notebook/desktop models. I bet you aren't searching completely blindly. Be sure to add an FTS (Full Text Search) table of the text part. You might have to remove special characters to keep only alphanumeric, spaces and possibly hyphens and such. All this can be done automagically. 1- For every input string, put it in a separate table along its own FTS table. Using the suitable FTS tokenizer you can end up with input strings broken down into only significant words, just like the reference strings are. 2- Querying the input FTS table you get a list of words in the input string, which you can then use to build up a query in the reference FTS table, finally retrieving the candidate reference string(s) matching at least the same list of words as the input string. All this may seem a little bit complex, but in practice and once the relevant queries are set up and debugged, things will be extremely fast. 3- Once you have a list of reference strings matching the words in the input string, you can go the pedestrian way to decide which one is a/the best match of the input. You can certainly display a listview and let the user choose, or implement some best match algorithm suitable to your actual context. All in all I believe this will reveal the most efficient approach, at least with the kind of examples you've shown and the volume implied by the nature of the second example file (hundreds of such is no problem). The standard SQLite DLLs include FTS4 which offers a number of features (http://www.sqlite.org/fts3.html). The new FTS5 extension is very fast and even more powerful (http://www.sqlite.org/fts5.html#full_text_query_syntax).1 point
-
Open folder / activate folderwindow
atvaxtr reacted to JLogan3o13 for a topic
@atvaxtr You could use the AutoIt Window info tool to get title and text of the window, which should then work with WinExists. This works fine for me (pointed at my pictures directory): If WinExists("Pictures", "C:\Users\LoganJ\Pictures") Then WinActivate("Pictures", "C:\Users\LoganJ\Pictures") Else ShellExecute(@UserProfileDir & "\Pictures") EndIf Alternatively, you can use WinList to get a list of all windows open that conform to either your title or text specifications, and use that to determine the window's existence. Try something like this to see what I mean: #include <Array.au3> _ArrayDisplay(WinList("Pictures", "C:\Users\LoganJ"))1 point -
You better tone down a notch because its not funny.Thread and topic closed and lets leave it that way. Jos1 point
-
Beep() is not working.
WiValdiBB reacted to PoojaKrishna for a topic
Thanks again for the new code, but no beep. Yes, something is wrong with buzzer. I repalced beep() with soundplay() in my code.1 point