Jump to content

Deye

Active Members
  • Posts

    912
  • Joined

  • Days Won

    1

Everything posted by Deye

  1. SOrry I meant : on progress ? these functions are not valid functions _GDIPlus_GraphicsCreateFromImage($hImage) _GDIPlus_GraphicsDrawRectangle($hGraphics, $i, $j, 1, 1, $newColor) The goal is to load the image in grayscale, which enhances the ability to capture any text present. This optimizes OCR recognition, as it performs best with specific adjustments like image sharpening. Additionally, An added benefit of the process is to allow renaming the image file for better organization and accessibility. #include <GUIConstantsEx.au3> #include <File.au3> #include <GDIPlus.au3> ; Declare GDI+ Constants Global Const $GDIP_ILMREADWRITE = 0x00000000 ; Image Locking Mode: Read/Write ;~ Global Const $GDIP_PXF32ARGB = 0x26200A00 ; Pixel Format: 32bpp ARGB ;~ Global Const $GDIP_PXF32ARGB = 0x26200A00 ; Pixel Format: 32bpp ARGB ; Initialize GDI+ _GDIPlus_Startup() Global $imgPath, $imgList, $currentIndex Global $folderPath = "C:\Users\user\Pictures\" ; Image folder path $imgList = _FileListToArrayRec($folderPath, "*.jpg;*.png;*.gif", 1, 0, $FLTAR_SORT) ;~ _ArrayDisplay($imgList) If @error Or $imgList[0] = 0 Then MsgBox(0, "Error", "No images found in the specified folder.") Exit EndIf $currentIndex = 1 $imgPath = $folderPath & $imgList[$currentIndex] ; Create GUI GUICreate("Image Viewer", 800, 650) ; Create controls Global $imgControl = GUICtrlCreatePic("", 10, 10, 780, 500) Global $txtName = GUICtrlCreateInput($imgList[$currentIndex], 10, 520, 780, 30) ;~ MsgBox (0 ,"", $imgList[$currentIndex] ) GUICtrlSetFont($txtName, 12, 700) Global $btnPrev = GUICtrlCreateButton("Prev", 200, 560, 100, 40) Global $btnNext = GUICtrlCreateButton("Next", 320, 560, 100, 40) Global $btnRename = GUICtrlCreateButton("Rename", 440, 560, 100, 40) GUISetState(@SW_SHOW) _ReloadImage() ; Load & enhance the image when the GUI first shows While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE _GDIPlus_Shutdown() Exit Case $btnRename _RenameFile() Case $btnPrev If $currentIndex > 1 Then $currentIndex -= 1 _ReloadImage() EndIf Case $btnNext If $currentIndex < $imgList[0] Then $currentIndex += 1 _ReloadImage() EndIf EndSwitch WEnd Func _ReloadImage() $imgPath = $folderPath & $imgList[$currentIndex] If FileExists($imgPath) Then ; Enhance the image $hProcessedImage = _dstinctiveGreyForText($imgPath) If Not IsPtr($hProcessedImage) Then MsgBox(0, "Error", "Image processing failed.") Else _GDIPlus_ImageSaveToFile($hProcessedImage, "temp_processed.jpg") GUICtrlSetImage($imgControl, "temp_processed.jpg") ; Set the processed image in the GUI GUISetState(@SW_SHOW) GUICtrlSetData($txtName, StringRegExpReplace($imgList[$currentIndex], "\\..*$", "")) EndIf Else MsgBox(0, "Error", "Image not found: " & $imgPath) EndIf EndFunc ;==>_ReloadImage Func _RenameFile() Local $newName = StringRegExpReplace(GUICtrlRead($txtName), '[\W]+', ' ') If $newName <> "" Then Local $ext = StringRegExpReplace($imgList[$currentIndex], "^.*\.(\w+)$", "$1") Local $newFullPath = $folderPath & $newName & "." & $ext If FileMove($imgPath, $newFullPath, 1) Then $imgList[$currentIndex] = $newName & "." & $ext $imgPath = $newFullPath _ReloadImage() Else MsgBox(0, "Error", "Failed to rename file.") EndIf Else MsgBox(0, "Error", "File name cannot be empty.") EndIf EndFunc ;==>_RenameFile Func _dstinctiveGreyForText($sImagePath) If Not FileExists($sImagePath) Then Return SetError(1, 0, 0) EndIf ; Initialize GDI+ Local $hBitmap = _GDIPlus_BitmapCreateFromFile($sImagePath) If $hBitmap = 0 Then Return SetError(2, 0, 0) Local $iWidth = _GDIPlus_ImageGetWidth($hBitmap) Local $iHeight = _GDIPlus_ImageGetHeight($hBitmap) ; Create a new bitmap for processing Local $hNewBitmap = _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight, $GDIP_PXF32ARGB) Local $hGraphics = _GDIPlus_ImageGetGraphicsContext($hNewBitmap) ; Draw original image onto new bitmap _GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap, 0, 0, $iWidth, $iHeight) ; Lock bits to manipulate pixels Local $tBitmapData = _GDIPlus_BitmapLockBits($hNewBitmap, 0, 0, $iWidth, $iHeight, $GDIP_ILMREADWRITE, $GDIP_PXF32ARGB) Local $pScan0 = DllStructGetData($tBitmapData, "Scan0") If $pScan0 Then Local $iStride = DllStructGetData($tBitmapData, "Stride") Local $iTotalBytes = Abs($iStride) * $iHeight Local $tPixels = DllStructCreate("byte[" & $iTotalBytes & "]", $pScan0) ; Process each pixel For $i = 0 To $iTotalBytes - 4 Step 4 Local $b = DllStructGetData($tPixels, 1, $i + 1) Local $g = DllStructGetData($tPixels, 1, $i + 2) Local $r = DllStructGetData($tPixels, 1, $i + 3) ; Convert to grayscale using luminosity formula Local $gray = ($r * 0.3 + $g * 0.59 + $b * 0.11) ; Increase contrast (thresholding effect) If $gray > 128 Then $gray = 255 Else $gray = 0 EndIf ; Set new pixel values DllStructSetData($tPixels, 1, $gray, $i + 1) ; Blue DllStructSetData($tPixels, 1, $gray, $i + 2) ; Green DllStructSetData($tPixels, 1, $gray, $i + 3) ; Red Next ; Unlock bits _GDIPlus_BitmapUnlockBits($hNewBitmap, $tBitmapData) EndIf ; Cleanup _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_BitmapDispose($hBitmap) Return $hNewBitmap EndFunc ;==>_dstinctiveGreyForText
  2. Are there any ways as to how can I distinguish the real names from the ones that arent valid on progress Func _ChangeImageColors($sInputImagePath, $sOutputImagePath, $aColorMap) _GDIPlus_Startup() Local $hImage = _GDIPlus_ImageLoadFromFile($sInputImagePath) If @error Then Return False Local $hGraphics = _GDIPlus_GraphicsCreateFromImage($hImage) Local $iWidth = _GDIPlus_ImageGetWidth($hImage) Local $iHeight = _GDIPlus_ImageGetHeight($hImage) For $i = 0 To $iWidth - 1 For $j = 0 To $iHeight - 1 Local $iPixelColor = _GDIPlus_BitmapGetPixel($hImage, $i, $j) Local $newColor = $aColorMap[0] _GDIPlus_GraphicsDrawRectangle($hGraphics, $i, $j, 1, 1, $newColor) Next Next _GDIPlus_ImageSaveToFile($hImage, $sOutputImagePath) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() Return True EndFunc ;==>_ChangeImageColors
  3. This batch script should create 5 files at "C:\chrome extensions\audio-tab-detector" Please see if you can quickly identify to mention the typos found in this batch script @echo off SET "EXT_DIR=C:\chrome extensions\audio-tab-detector" REM Create the directory if it does not exist if not exist "%EXT_DIR%" ( mkdir "%EXT_DIR%" ) REM Create manifest.json ( echo { echo "manifest_version": 3, echo "name": "Audio Tab Detector", echo "version": "1.0", echo "description": "Detects the next tab with playing audio.", echo "permissions": [ echo "tabs", echo "activeTab" echo ], echo "background": { echo "service_worker": "background.js" echo }, echo "action": { echo "default_popup": "popup.html" echo }, echo "web_accessible_resources": [ echo { echo "resources": ["popup.html"], echo "matches": ["<all_urls>"] echo } echo ] echo } ) > "%EXT_DIR%\manifest.json" REM Check if manifest.json was created successfully if exist "%EXT_DIR%\manifest.json" ( echo manifest.json created successfully. ) else ( echo Failed to create manifest.json. ) REM Create background.js ( echo chrome.action.onClicked.addListener(async (tab) => { echo const tabs = await chrome.tabs.query({}); echo const audioTabs = tabs.filter(t => echo t.audible || (t.url && t.url.includes("youtube.com/watch")) echo ); echo if (audioTabs.length > 0) { echo const nextTab = audioTabs[(audioTabs.indexOf(tab) + 1) %% audioTabs.length]; echo if (nextTab) { echo chrome.tabs.update(nextTab.id, { active: true }); echo } echo } else { echo alert('No audio playing tabs found!'); echo } echo }); ) > "%EXT_DIR%\background.js" REM Check if background.js was created successfully if exist "%EXT_DIR%\background.js" ( echo background.js created successfully. ) else ( echo Failed to create background.js. ) REM Create popup.html ( echo <!DOCTYPE html> echo <html lang="en"> echo <head> echo <meta charset="UTF-8"> echo <meta name="viewport" content="width=device-width, initial-scale=1.0"> echo <title>Audio Tab Detector</title> echo <style> echo body { echo width: 200px; echo text-align: center; echo } echo button { echo margin-top: 20px; echo } echo </style> echo </head> echo <body> echo <h1>Audio Tab Detector</h1> echo <button id="next-audio-tab">Next Audio Tab</button> echo <script src="popup.js"></script> echo </body> echo </html> ) > "%EXT_DIR%\popup.html" REM Check if popup.html was created successfully if exist "%EXT_DIR%\popup.html" ( echo popup.html created successfully. ) else ( echo Failed to create popup.html. ) REM Create popup.js ( echo document.getElementById('next-audio-tab').addEventListener('click', () => { echo chrome.tabs.query({}, (tabs) => { echo let audioTabs = tabs.filter(tab => tab.audible); echo if (audioTabs.length > 0) { echo let currentTabId = tabs.filter(tab => tab.active)[0].id; echo let currentIndex = audioTabs.findIndex(tab => tab.id === currentTabId); echo let nextTabIndex = (currentIndex + 1) %% audioTabs.length; echo let nextTab = audioTabs[nextTabIndex]; echo if (nextTab) { echo chrome.tabs.update(nextTab.id, { active: true }); echo } echo } else { echo alert('No audio playing tabs found!'); echo } echo }); echo }); ) > "%EXT_DIR%\popup.js" REM Check if popup.js was created successfully if exist "%EXT_DIR%\popup.js" ( echo popup.js created successfully. ) else ( echo Failed to create popup.js. ) echo All files created in "%EXT_DIR%" pause
  4. Catagory box : structural and repair https://photos.app.goo.gl/DXujzk2nHwgxaHvFA I am not sure how much of the information about converting HTML to APK is correct.
  5. Let’s clarify and organize the concept for your app showcasing pictures of home items sorted into specific "boxes," where each box has its own category with links to view the pictures it contains. Here’s a structured outline for how this could work: ### App Structure for Home Item Boxes #### 1. **Main Interface** - **Header Section:** - Display the title of the app (e.g., "Home Item Organizer"). - **Categories (Boxes) Section:** - Create a list of buttons or clickable headers for each box (e.g., "Box 1," "Box 2," etc.). - Each button is linked to the corresponding collection of home items (pictures). #### 2. **Categories (Boxes)** - **Each Box Represents a Category:** - **Box 1**: Kitchen Items - **Box 2**: Living Room Decor - **Box 3**: Bedroom Essentials - **Box 4**: Garage Tools - And so on... #### 3. **Clickable Links to View Pictures** - **When a user taps on "Box 1"**: - The app navigates to a new screen that displays all the pictures of items in the Kitchen. - **Similar behavior for other boxes**: - Tapping on "Box 2" will navigate to images for the Living Room, "Box 3" for Bedroom items, etc. #### 4. **Image Display** - **Gallery Style View:** - Each box will present a gallery view of images. - Users can scroll through the images, tap on individual pictures for a larger view, or even zoom in. #### 5. **User Interactivity** - **Add New Boxes**: - Users can create a new box by choosing “Add Box,” entering a name, and linking it to a collection of images. - **Modify/Remove Boxes**: - Options to edit the box name or delete a box. - **Image Management**: - Users can upload, remove, or edit images associated with each box. #### 6. **Organizing Items within Boxes** - **Tagging and Notes**: - Option to add notes or tags to each image for better organization and to provide more details (e.g., purchase date, usage tips). #### 7. **Backup and Synchronization** - **Cloud Backup**: - Provide an option to back up images to cloud storage to prevent data loss. #### 8. **User Interface Considerations** - **Simple, Intuitive Design**: - Use a clean layout that makes navigation easy. - Ensure that buttons and images are large enough to tap on mobile devices easily. - **Responsive Design**: - Adapt to different screen sizes for a seamless experience on tablets and various smartphones. ### Example User Flow: 1. **User opens the app.** 2. **Sees a list of boxes (categories)**. 3. **Taps on "Box 1"**. 4. **Views all images in the Kitchen Items gallery**. 5. **Taps on an image to see it larger or add a note.** 6. **Returns to the main menu to select another box if desired.** ### Conclusion: The app structure you envision allows users to effectively manage pictures of home items categorized in specific boxes. Each box has its own link, enabling easy access to the images contained within it. This setup not only simplifies the organization of items but also enhances the user experience. By incorporating features for creating, editing, and managing boxes, the app can meet the needs of anyone looking to keep their home items organized visually.
  6. Hi, I want to use this code to make an Android app that will be simple to use on my phone. I would like to create, add, remove, and rename categories called "Box 1," "Box 2," and so on in Scratch. I would also like to have the ability to change the header link that leads to the pictures associated with that particular box-category. In order to make the app's interface more user-friendly for mobile devices, I want to make sure that the HTML content is backed up somewhere, such as at https://photos.app.goo.gl/, where I store the images. <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Dynamic Item Search List</title> <style> body { font-family: Arial, sans-serif; background-color: #f8f9fa; margin: 0; padding: 20px; color: #333; } h1 { text-align: center; color: #5a6268; } .search-container { display: flex; justify-content: center; align-items: center; margin-bottom: 20px; } input { width: calc(100% - 200px); padding: 10px; border: 1px solid #ced4da; border-radius: 4px 0 0 4px; outline: none; } button { padding: 10px 15px; border: 1px solid #007bff; background-color: #007bff; color: white; border-radius: 0 4px 4px 0; cursor: pointer; } button:hover { background-color: #0056b3; } ul { list-style-type: none; padding-left: 0; } .box { border: 1px solid #adb5bd; border-radius: 8px; margin: 10px 0; overflow: hidden; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); transition: background-color 0.3s; cursor: pointer; } .box:hover { background-color: #e9ecef; } .box-header { background-color: #007bff; color: white; padding: 15px; font-weight: bold; display: flex; justify-content: space-between; } .sub-list { display: none; padding: 10px 15px; background-color: #f8f9fa; } .sub-item { margin-left: 20px; padding: 5px 0; display: flex; justify-content: space-between; } .remove-item { cursor: pointer; color: red; margin-left: 10px; } .add-item { display: flex; justify-content: center; margin-top: 20px; } select { padding: 10px; margin-right: 10px; border-radius: 4px; border: 1px solid #ced4da; } .new-category-container { display: flex; justify-content: center; margin-top: 10px; } </style> </head> <body> <h1>Dynamic Item Search List</h1> <div class="search-container"> <input type="text" id="searchInput" placeholder="Search for items..." onkeyup="filterItems()"> <button onclick="clearSearch()">Clear</button> </div> <div class="add-item"> <input type="text" id="newItemsInput" placeholder="Add new items (comma separated)"> <select id="categorySelect" onchange="setSelectedCategory(this.value)"> <option value="" disabled selected>Select category</option> </select> <button onclick="addItems()">Add</button> </div> <div class="new-category-container"> <input type="text" id="newCategoryInput" placeholder="New category name"> <button onclick="addCategory()">Add Category</button> </div> <ul id="itemList"></ul> <script> const storageKey = 'dynamicItems'; // Key for localStorage let defaultCategories = JSON.parse(localStorage.getItem(storageKey)) || {}; // Load data from localStorage let currentCategories = Object.keys(defaultCategories); let selectedCategory = ""; // Initialize item list function initItemList() { const itemList = document.getElementById("itemList"); itemList.innerHTML = ""; for (const category in defaultCategories) { const uniqueItems = [...new Set(defaultCategories[category])]; // Ensure unique items uniqueItems.sort(); // Sort items const box = document.createElement("li"); box.className = "box"; const boxHeader = document.createElement("div"); boxHeader.className = "box-header"; boxHeader.innerHTML = `<a href="https://www.autoitscript.com/forum/topic/212740-dynamic-item-search-list" target="_blank" style="color: white;">${category}</a><span>▼</span>`; boxHeader.onclick = () => toggleBox(boxHeader); const subList = document.createElement("ul"); subList.className = "sub-list"; uniqueItems.forEach(item => { const subItem = document.createElement("li"); subItem.className = "sub-item"; subItem.innerHTML = `${item}<span class="remove-item" onclick="removeItem('${category}', '${item}')">✖</span>`; subList.appendChild(subItem); }); box.appendChild(boxHeader); box.appendChild(subList); itemList.appendChild(box); } } // Toggle visibility of sub-items function toggleBox(boxHeader) { const subList = boxHeader.nextElementSibling; const arrow = boxHeader.lastElementChild; if (subList.style.display === "block") { subList.style.display = "none"; arrow.innerHTML = "▼"; // Down arrow } else { subList.style.display = "block"; arrow.innerHTML = "▲"; // Up arrow } } // Add new items to selected category function addItems() { const input = document.getElementById("newItemsInput").value.trim(); if (input && selectedCategory) { const items = input.split(",").map(item => item.trim()).filter(item => item !== ''); items.forEach(item => { if (!defaultCategories[selectedCategory].includes(item)) { defaultCategories[selectedCategory].push(item); } }); document.getElementById("newItemsInput").value = ''; // Clear the input saveToLocalStorage(); // Save to localStorage initItemList(); // Re-initialize the item list } } // Add new category function addCategory() { const newCategory = document.getElementById("newCategoryInput").value.trim(); if (newCategory && !currentCategories.includes(newCategory)) { defaultCategories[newCategory] = []; currentCategories.push(newCategory); const option = document.createElement("option"); option.value = newCategory; option.textContent = newCategory; document.getElementById("categorySelect").appendChild(option); setSelectedCategory(newCategory); // Set the new category as selected document.getElementById("newCategoryInput").value = ''; // Clear the input saveToLocalStorage(); // Save changes } } // Set currently selected category function setSelectedCategory(category) { selectedCategory = category; } // Remove item from a category function removeItem(category, item) { defaultCategories[category] = defaultCategories[category].filter(i => i !== item); saveToLocalStorage(); // Save changes initItemList(); // Re-initialize the item list } // Save data to localStorage function saveToLocalStorage() { localStorage.setItem(storageKey, JSON.stringify(defaultCategories)); } // Filter items based on search input function filterItems() { const input = document.getElementById('searchInput').value.toLowerCase(); const boxes = document.getElementById('itemList').getElementsByClassName('box'); for (let i = 0; i < boxes.length; i++) { const subItems = boxes[i].getElementsByClassName('sub-item'); let boxContainsMatch = false; for (let j = 0; j < subItems.length; j++) { const item = subItems[j].textContent.toLowerCase(); if (item.includes(input)) { subItems[j].style.display = ''; // Show matched item boxContainsMatch = true; } else { subItems[j].style.display = 'none'; // Hide non-matched item } } // Show or hide the box based on sub-items visibility boxes[i].style.display = boxContainsMatch || input === '' ? '' : 'none'; } } // Clear search term function clearSearch() { document.getElementById('searchInput').value = ''; // Clear search input filterItems(); // Show all items } // Initialize the item list on page load initItemList(); </script> </body> </html>
  7. Step 1: Launch Microsoft Word and Capture the "Handle" Text Field Use AutoIt to launch Microsoft Word and capture the "Handle" text field. This will enable us to work with the text field as a centered standalone element. Step 2: Record and Center the Highlighted Read-Aloud Text While recording, center the highlighted read-aloud text by enabling magnification using the "win+" shortcut. This will allow us to focus on the text and create a clear video.
  8. The AI designed for shortcoming script generation is currently not performing quite well, prompting me to explore other ideas and options. I’m interested in converting the text field Handle (of Word Office) into a standalone active window. This would be to facilitate the creation of a specific video tailored for the child window holding the text as much as possible in the center and employing a method demonstrated here. Along with enabling magnification through the (win+ shortcut), it may present additional challenges, as the primary screen window monitors the Read-aloud text, resulting in a 'follow the typewriter effect.' The challenge lies in ensuring that all components operate in conjunction with a screen & audio recorder as cleanly as possible. To demonstrate a starting point, here is an AI-generated script. ; AutoIt Script for Word Document Creation and Interaction ; This script performs the following tasks: ; 1. Generate a block of text and save it to a Word document. ; 2. Open the Word document. ; 3. Set focus on the text field. ; 4. Use text-to-speech functionality to read the text aloud. ; 5. Prepare for window recording. #include <Word.au3> #include <MsgBoxConstants.au3> ; Function to create and save a Word document Func CreateAndSaveWordDoc() Local $oWord = _Word_Create() ; Create a new Word instance. Local $oDoc = _Word_DocAdd($oWord) ; Add a new document. ; Sample text to include in the document Local $sText = "This is a sample line one." & @CRLF & _ "Here is line two explaining something important." & @CRLF & _ "Line three introduces additional details about this task." & @CRLF & _ "The fourth line is here to ensure we have enough content." & @CRLF & _ "In line five, we'll elaborate on related concepts." & @CRLF & _ "Line six provides further clarification." & @CRLF & _ "On the seventh line, we summarize our findings." & @CRLF & _ "The eighth line gives a clear conclusion." & @CRLF & _ "Line nine might suggest what to consider next." & @CRLF & _ "Finally, line ten wraps up the information provided." ; Insert the text into the document _Word_DocWrite($oDoc, $sText) ; Save the document Local $sFilePath = @ScriptDir & "\example.docx" _Word_DocSaveAs($oDoc, $sFilePath) ; Open the document _Word_DocOpen($oWord, $sFilePath) ; Set focus on the text field WinActivate("example.docx - Word") ; Adjust window title if needed Sleep(500) ; Wait for half a second for the window to activate ; Read the document aloud using text-to-speech Local $oVoice = ObjCreate("SAPI.SpVoice") $oVoice.Speak($sText) ; Prepare for recording (this part is a placeholder) ; Further implementation required for capturing active window to AVI ; Close the Word application ; _Word_Close($oWord) EndFunc ;==>CreateAndSaveWordDoc ; Run the function CreateAndSaveWordDoc()
  9. This is the method that I would employ. For $x = 1 To $arrayTwo[0][0] If _ArraySearch($arrayOne, $arrayTwo[$x][1], 0, 0, 0, 0, 1, 1) * -1 > 0 Then MsgBox(0, "", "Not Found element " & $arrayTwo[$x][1] & " in $arrayOne") EndIf Next
  10. anyone know of a way to get suggested text "showing translations for" or, on the right, "Did you mean" <span class="mvqA2c" jsaction ...
  11. some sort of approach or plan Func IsArrayEmpty($array, $STR_NOCOUNT = Default) ; Default = False ; consider (0 row) an array element Return UBound(StringRegExp(StringStripWS(_ArrayToString($array, "|", ($STR_NOCOUNT ? 1 : Default)), 8), "[^|]+\|", 3)) EndFunc
  12. In order to see if it works, try using the right delimiter, such as ", " <- holds a space there. You can then refine the code by modifying it to something along the lines of "[" & $sDelim & "][" & $sDelim & "]" to achieve the desired outcome. (maybe maybe) then anyone interested in conducting their own experiments to discover a solution that fits their specific needs could use this example as a jumping-off point. This is not exactly breaking news, as we know
  13. apologies, but in order to try your hand at this function fairly , you must pass the correct arguments, especially the delimiter being used. like so,  _Deye_ArrayDelEmptyRows($aArray, Chr(34)) or _Deye_ArrayDelEmptyRows($aArray, '"')
  14. AspirinJunkie, This function relies on the user using the correct delimiter Chr(34)
  15. as a note: If you want faster execution, you may need to give up memory efficiency or make the code structure more complex. By carefully evaluating and prioritizing these trade-offs, it's crucial to thoroughly assess different strategies before implementing them. This involves carefully considering potential challenges, time constraints, organizing code, and ensuring compatibility with existing systems to address future issues smoothly. Func _Deye_ArrayDelEmptyRows(ByRef $aArray, $sDelim = Chr(32), $bUBound = False) Local $iArrayColumns = UBound($aArray, 2) If $iArrayColumns >= 1 Then Local $iCopyTo_Index = 0 For $i = 0 To UBound($aArray) - 1 For $j = 0 To $iArrayColumns - 1 ;~ If StringStripWS($aArray[$i][$j], 8) Then ExitLoop If $aArray[$i][$j] Then ExitLoop If $j = $iArrayColumns - 1 Then ContinueLoop 2 Next If $i <> $iCopyTo_Index Then For $j = 0 To $iArrayColumns - 1 $aArray[$iCopyTo_Index][$j] = $aArray[$i][$j] Next EndIf $iCopyTo_Index += 1 Next If UBound($aArray) > $iCopyTo_Index Then ReDim $aArray[$iCopyTo_Index][$iArrayColumns] If $bUBound Then _ArrayInsert($aArray, 0, UBound($aArray)) Return ($aArray) Else Return StringSplit(StringTrimLeft(StringRegExpReplace(StringRegExpReplace($sDelim & _ArrayToString($aArray, $sDelim), $sDelim & "[" & $sDelim & "]*[" & $sDelim & "]", $sDelim), $sDelim & "$", ""), 1), $sDelim, $bUBound ? "" : 3) EndIf EndFunc
  16. Would I need to recreate the image and use OCR (Optical Character Recognition) to maintain the text's general position if I wanted to downscale the image while keeping the text sharp? , then how would you go about doing so ,as we know on regular resize, the text gets smaller and blurred As illustrated in the small image, the text bleeds when zooming in. later i would try to remove marks-ups keeping only the text at the general position image.zip
  17. Not figure out yet , any help with this will be great Thank you #include <WinAPIShellEx.au3> #include <GDIPlus.au3> ShellExecute(ImageTOGreyscale("image.jpg")) Func ImageTOGreyscale($img) _GDIPlus_Startup() Local $hIA = _GDIPlus_ImageAttributesCreate() ;create an ImageAttribute object Local $tColorMatrix = _GDIPlus_ColorMatrixCreateGrayScale() ;create grayscale color matrix _GDIPlus_ImageAttributesSetColorMatrix($hIA, 4, True, $tColorMatrix, 1) ;set negative color matrix Local $hImage1 = _GDIPlus_ImageLoadFromFile(@ScriptFullPath & "\" & $img) $ext = StringRegExpReplace($img, "^.*\.", "") $file = StringRegExpReplace(@ScriptFullPath, "(^.*\\)(.*)", "\1") & "img_grey." & $ext ;~ ClipPut($file) ;~ MsgBox(0, '', $file) $sCLSID = _GDIPlus_EncodersGetCLSID($ext) MsgBox(0, 'creating img_grey.' & $ext, _GDIPlus_ImageSaveToFileEx($hImage1, $file, $sCLSID)) _GDIPlus_ImageAttributesDispose($hIA) _GDIPlus_ImageDispose($hImage1) _GDIPlus_Shutdown() Return $file EndFunc ;==>ImageTOGreyscale
  18. small illustration to cap #include <WinAPISysWin.au3> ;include directory #include <Misc.au3> #include <Array.au3> Local $hDLL = DllOpen("user32.dll") OnAutoItExitRegister("Terminate") HotKeySet("{ESC}", "Terminate") HotKeySet("!z", "Clip") ;Alt Z While 1 Sleep(10) WEnd Func Clip() If _IsPressed("10", $hDLL) Then ; Wait until key is released. While _IsPressed("12 ", $hDLL) Sleep(250) WEnd EndIf Sleep(250) Send("^c") $hWnd = WinGetHandle("") ;~ highlight + right click (highlighted verb_phrase to Put in effect) ;~ Before initiating key combo Please highlight a designated command to carry out--> ;~ _WinAPI_GetClassName($hWnd) = "SciTEWindow" ;~ _WinAPI_GetWindowText ( $hWnd ) ; _WinAPI_GetClientHeight ( $hWnd ) $clip = ClipGet() $ret = Execute($clip) MsgBox("", '', $ret) EndFunc Func Terminate() DllClose($hDLL) Exit EndFunc
  19. is there something in the way HotKeySet is forcing combo keys it seems when i keep the alt key down after the first combo which errors with a windows chime, the dog naps on the second HotKeySet("{ESC}", "Terminate") HotKeySet("!z", "Clip") ;Alt Z While 1 Sleep(10) WEnd Func Clip() Send("^c") Do Sleep(50) $clip = ClipGet() Until @error <> 4 Or @error <> 3 ConsoleWrite($clip & @LF) EndFunc Func Terminate() Exit EndFunc
  20. #include <Array.au3> Dim $aArray[][] = [["A", 0], ["B", 0], ["C", 0], ["D", 0], ["E", 1], ["F", 1]] _ArrayDisplay(_ArrPopToTop($aArray, "B|D|F")) _ArrayDisplay(_ArrPopToTop($aArray, "D|E")) _ArrayDisplay(_ArrPopToTop($aArray, "C")) Func _ArrPopToTop($a, $val = "", $index = 0) Local $asplit = StringSplit($val, "|", 3) _ArrayReverse($asplit) For $j = 0 To UBound($asplit) - 1 $x = _ArraySearch($a, $asplit[$j], "", "", "", 0) _ArrayInsert($a, $index, _ArrayExtract($a, $x, $x)) _ArrayDelete($a, $x + 1) Next Return $a EndFunc
  21. the objective is to highlight text, and when you change the keyboard to another language, the text is translated from the previous keboard setting language to the current keboard language. but it seems hard to get anything done. #include <Array.au3> #include <WinAPISys.au3> HotKeySet("{ESC}", "Terminate") Local $var = '' & 'Hex|Dec|Country' & @LF & '0004|4|zh-CHS' & @LF & '0401|1025|ar-SA' & @LF & '0402|1026|bg-BG' & @LF & '0403|1027|ca-ES' & @LF & '0404|1028|zh-TW' & @LF & '0405|1029|cs-CZ' & @LF & '0406|1030|da-DK' & @LF & '0407|1031|de-DE' & @LF & '0408|1032|el-GR' & @LF & '0409|1033|en-US' & @LF & '040A|1034|es-ES_tradnl' & @LF & '040B|1035|fi-FI' & @LF & '040C|1036|fr-FR' & @LF & '040D|1037|he-IL' & @LF & '040E|1038|hu-HU' & @LF & '040F|1039|is-IS' & @LF & '0410|1040|it-IT' & @LF & '0411|1041|ja-JP' & @LF & '0412|1042|ko-KR' & @LF & '0413|1043|nl-NL' & @LF & '0414|1044|nb-NO' & @LF & '0415|1045|pl-PL' & @LF & '0416|1046|pt-BR' & @LF & '0417|1047|rm-CH' & @LF & '0418|1048|ro-RO' & @LF & '0419|1049|ru-RU' & @LF & '041A|1050|hr-HR' & @LF & '041B|1051|sk-SK' & @LF & '041C|1052|sq-AL' & @LF & '041D|1053|sv-SE' & @LF & '041E|1054|th-TH' & @LF & '041F|1055|tr-TR' & @LF & '0420|1056|ur-PK' & @LF & '0421|1057|id-ID' & @LF & '0422|1058|uk-UA' & @LF & '0423|1059|be-BY' & @LF & '0424|1060|sl-SI' & @LF & '0425|1061|et-EE' & @LF & '0426|1062|lv-LV' & @LF & '0427|1063|lt-LT' & @LF & '0428|1064|tg-Cyr' & @LF & '0429|1065|fa-IR' & @LF & '042A|1066|vi-VN' & @LF & '042B|1067|hy-AM' & @LF & '042C|1068|az-Lat' & @LF & '042D|1069|eu-ES' & @LF & '042E|1070|hsb-DE' & @LF & '042F|1071|mk-MK' & @LF & '0432|1074|tn-ZA' & @LF & '0434|1076|xh-ZA' & @LF & '0435|1077|zu-ZA' & @LF & '0436|1078|af-ZA' & @LF & '0437|1079|ka-GE' & @LF & '0438|1080|fo-FO' & @LF & '0439|1081|hi-IN' & @LF & '043A|1082|mt-MT' & @LF & '043B|1083|se-NO' & @LF & '043e|1086|ms-MY' & @LF & '043F|1087|kk-KZ' & @LF & '0440|1088|ky-KG' & @LF & '0441|1089|sw-KE' & @LF & '0442|1090|tk-TM' & @LF & '0443|1091|uz-Lat' & @LF & '0444|1092|tt-RU' & @LF & '0445|1093|bn-IN' & @LF & '0446|1094|pa-IN' & @LF & '0447|1095|gu-IN' & @LF & '0448|1096|or-IN' & @LF & '0449|1097|ta-IN' & @LF & '044A|1098|te-IN' & @LF & '044B|1099|kn-IN' & @LF & '044C|1100|ml-IN' & @LF & '044D|1101|as-IN' & @LF & '044E|1102|mr-IN' & @LF & '044F|1103|sa-IN' & @LF & '0450|1104|mn-MN' & @LF & '0451|1105|bo-CN' & @LF & '0452|1106|cy-GB' & @LF & '0453|1107|km-KH' & @LF & '0454|1108|lo-LA' & @LF & '0456|1110|gl-ES' & @LF & '0457|1111|kok-IN' & @LF & '0459|1113|sd-Dev' & @LF & '045A|1114|syr-SY' & @LF & '045B|1115|si-LK' & @LF & '045C|1116|chr-Che' & @LF & '045D|1117|iu-Can' & @LF & '045E|1118|am-ET' & @LF & '0461|1121|ne-NP' & @LF & '0462|1122|fy-NL' & @LF & '0463|1123|ps-AF' & @LF & '0464|1124|fil-PH' & @LF & '0465|1125|dv-MV' & @LF & '0468|1128|ha-Lat' & @LF & '046A|1130|yo-NG' & @LF & '046B|1131|quz-BO' & @LF & '046C|1132|nso-ZA' & @LF & '046D|1133|ba-RU' & @LF & '046E|1134|lb-LU' & @LF & '046F|1135|kl-GL' & @LF & '0470|1136|ig-NG' & @LF & '0473|1139|ti-ET' & @LF & '0475|1141|haw-US' & @LF & '0478|1144|ii-CN' & @LF & '047A|1146|arn-CL' & @LF & '047C|1148|moh-CA' & @LF & '047E|1150|br-FR' & @LF & '0480|1152|ug-CN' & @LF & '0481|1153|mi-NZ' & @LF & '0482|1154|oc-FR' & @LF & '0483|1155|co-FR' & @LF & '0484|1156|gsw-FR' & @LF & '0485|1157|sah-RU' & @LF & '0486|1158|quc-Lat' & @LF & '0487|1159|rw-RW' & @LF & '0488|1160|wo-SN' & @LF & '048C|1164|prs-AF' & @LF & '0491|1169|gd-GB' & @LF & '0492|1170|ku-Ara' & @LF & '0801|2049|ar-IQ' & @LF & '0803|2051|ca-E' & @LF & '0804|2052|zh-CN' & @LF & '0807|2055|de-CH' & @LF & '0809|2057|en-GB' & @LF & '080A|2058|es-MX' & @LF & '080C|2060|fr-BE' & @LF & '0810|2064|it-CH' & @LF & '0813|2067|nl-BE' & @LF & '0814|2068|nn-NO' & @LF & '0816|2070|pt-PT' & @LF & '081A|2074|sr-Lat' & @LF & '081D|2077|sv-FI' & @LF & '0820|2080|ur-IN' & @LF & '082C|2092|az-Cyr' & @LF & '082E|2094|dsb-DE' & @LF & '0832|2098|tn-BW' & @LF & '083B|2107|se-SE' & @LF & '083C|2108|ga-IE' & @LF & '083E|2110|ms-BN' & @LF & '0843|2115|uz-Cyr' & @LF & '0845|2117|bn-BD' & @LF & '0846|2118|pa-Ara' & @LF & '0849|2121|ta-LK' & @LF & '0850|2128|mn-Mon' & @LF & '0859|2137|sd-Ara' & @LF & '085D|2141|iu-Lat' & @LF & '085F|2143|tzm-Lat' & @LF & '0867|2151|ff-Lat' & @LF & '086B|2155|quz-EC' & @LF & '0873|2163|ti-ER' & @LF & '0873|2163|ti-ER' & @LF & '0C01|3073|ar-EG' & @LF & '0C04|3076|zh-HK' & @LF & '0C07|3079|de-AT' _ & @LF & '0C09|3081|en-AU' & @LF & '0C0A|3082|es-ES' & @LF & '0C0C|3084|fr-CA' & @LF & '0C1A|3098|sr-Cyr' & @LF & '0C3B|3131|se-FI' & @LF & '0C6B|3179|quz-PE' & @LF & '1001|4097|ar-LY' & @LF & '1004|4100|zh-SG' & @LF & '1007|4103|de-LU' & @LF & '1009|4105|en-CA' & @LF & '100A|4106|es-GT' & @LF & '100C|4108|fr-CH' & @LF & '101A|4122|hr-BA' & @LF & '103B|4155|smj-NO' & @LF & '105F|4191|tzm-Tfn' & @LF & '1401|5121|ar-DZ' & @LF & '1404|5124|zh-MO' & @LF & '1407|5127|de-LI' & @LF & '1409|5129|en-NZ' & @LF & '140A|5130|es-CR' & @LF & '140C|5132|fr-LU' & @LF & '141A|5146|bs-Lat' & @LF & '143B|5179|smj-SE' & @LF & '1801|6145|ar-MA' & @LF & '1809|6153|en-IE' & @LF & '180A|6154|es-PA' & @LF & '180C|6156|fr-MC' & @LF & '181A|6170|sr-Lat' & @LF & '183B|6203|sma-NO' & @LF & '1C01|7169|ar-TN' & @LF & '1c09|7177|en-ZA' & @LF & '1C0A|7178|es-DO' & @LF & '1C1A|7194|sr-Cyr' & @LF & '1C3B|7227|sma-SE' & @LF & '2001|8193|ar-OM' & @LF & '2009|8201|en-JM' & @LF & '200A|8202|es-VE' & @LF & '201A|8218|bs-Cyr' & @LF & '203B|8251|sms-FI' & @LF & '2401|9217|ar-YE' & @LF & '2409|9225|en-029' & @LF & '240A|9226|es-CO' & @LF & '241A|9242|sr-Lat' & @LF & '243B|9275|smn-FI' & @LF & '2801|10241|ar-SY' & @LF & '2809|10249|en-BZ' & @LF & '280A|10250|es-PE' & @LF & '281A|10266|sr-Cyr' & @LF & '2C01|11265|ar-JO' & @LF & '2C09|11273|en-TT' & @LF & '2C0A|11274|es-AR' & @LF & '2C1A|11290|sr-Lat' & @LF & '3001|12289|ar-LB' & @LF & '3009|12297|en-ZW' & @LF & '300A|12298|es-EC' & @LF & '301A|12314|sr-Cyr' & @LF & '3401|13313|ar-KW' & @LF & '3409|13321|en-PH' & @LF & '340A|13322|es-CL' & @LF & '3801|14337|ar-AE' & @LF & '380A|14346|es-UY' & @LF & '3C01|15361|ar-BH' & @LF & '3C0A|15370|es-PY' & @LF & '4001|16385|ar-QA' & @LF & '4009|16393|en-IN' & @LF & '400A|16394|es-BO' & @LF & '4409|17417|en-MY' & @LF & '440A|17418|es-SV' & @LF & '4809|18441|en-SG' & @LF & '480A|18442|es-HN' & @LF & '4C0A|19466|es-NI' & @LF & '500A|20490|es-PR' $sCommand = 'StringRegExpReplace($arr[_ArraySearch($arr,StringRight(@KBLayout, 4))][2], "\-(.*)", "")' Local $arr[0][3] _ArrayAdd($arr, $var, 0, "|", @LF) HotKeySet("!z", "ClipMessage") ; goes to function ;~ HotKeySet("!+", "ClipMessage") ; desired way = fails While 1 Sleep(10) WEnd Func ClipMessage() ;~ use alt + shift intermittently (test starting the script with different keboard sets.) Local Static $KBLayout = Execute($sCommand) Local $KBLayoutNew = Execute($sCommand) ConsoleWrite($KBLayout & @LF) ConsoleWrite( $KBLayoutNew & @LF) EndFunc Func Terminate() Exit EndFunc
  22. Any ideas on how to get google translate's text to the ResponseText (perhaps with HTTP request from this example ) To find the "did you mean: "bugless"" as shown with this link example:
  23. 2 suggestions * debug highlighted (right click to ClipPut) if i highlight this example will give -> SciTEWindow onto the clipboard WinAPI_GetClassName(WinGetHandle("")) * Add right click (Paste clipboard within Quotation Marks) in SciTE for instance "SciTEWindow" or 'SciTEWindow'
  24. i need want to create a gdi gui from printscreen Send("{!PRINTSCREEN}") to allow using the mouse controls on the layered window not the actual active one which will react to mouse presses so the layered window should be placed actively above the original in the exact place on the screen if you have a good code for this that i can borrow TIa ShellExecute("calc.exe") Sleep(500) Send("!{PRINTSCREEN}") Send("#r") Sleep(500) Send("pbrush") Send("{ENTER}") Sleep(500) Send("^v")
  25. @Musashi, is it still working for you ?
×
×
  • Create New...