Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/15/2024 in all areas

  1. Thanks for having a look and making a much cleaner and time saving version! Sadly it can't be used on conjunction with the GUI generators, but maybe that's just part of the limitation with the auto generated stuff and using both simply isn't an option.
    1 point
  2. #Region (=== GUI generated by argumentum 0.0.0.1 ===) Global $hGUI Global $Radio_1, $Radio_2, $Radio_3, $Group_1 Local $PosX Local $PosY_add = 25 Local $PosY_counter = 0 Local $PosY_Start = 85 ;------------------------------------------------------ ; Title...........: _guiCreate ; Description.....: Create the main GUI ;------------------------------------------------------ _guiCreate("MyGUI", 400, 350) Func _guiCreate($sTitle, $iWidth, $iHeight, $iLeft = -1, $iTop = -1) $hGUI = GUICreate($sTitle, $iWidth, $iHeight, $iLeft, $iTop) Local $idTemp For $n = 1 To 3 $idTemp = GUICtrlCreateRadio("Radio " & String($PosY_counter + 1), 160, $PosY_Start + $PosY_add * $PosY_counter, 91, 20) Assign("Radio_" & $PosY_counter + 1, $idTemp) $PosY_counter += 1 Next $Group_1 = GUICtrlCreateGroup("Group 1", 115, 55, 151, 151) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState() EndFunc ;==>_guiCreate #EndRegion (=== GUI generated by argumentum 0.0.0.1 ===) While 1 Switch GUIGetMsg() Case -3 GUIDelete() Exit Case $Radio_1 MsgBox(0, "", "$Radio_1", 1, $hGUI) Case $Radio_2 MsgBox(0, "", "$Radio_2", 1, $hGUI) Case $Radio_3 MsgBox(0, "", "$Radio_3", 1, $hGUI) EndSwitch WEnd I don't use anything other than my wish. No code generator.
    1 point
  3. donnyh13

    Understanding libraries

    Since those are built in AutoIt Libraries they are located in the install directory of AuotIt, for me it is: "C:\Program Files (x86)\AutoIt3\Include" , and if you have Scite editor installed, you can click on one of them so that your cursor is blinking in it, and press the button combo Alt+i to open the include, so you can see each of the functions inside, and how they work, but the better bet, perhaps, would be to look at the help file for each function used in the script, which you can easily open by placing your caret in the function name in question, and pressing F1 to open the help file for the function. Or just press F1 and use the built in search. As for adding Webdriver, you would do something like: #include "Path to WebDriverUDF\Webdriver udf File.au3" More info about #Include (also found in the AutoIt help file): https://www.autoitscript.com/autoit3/docs/keywords/include.htm
    1 point
  4. Here is a new version of the script, which outputs the translated text to an Edit control. Although the preceding version displayed the output in a MessageBox (and in Scite Console if run from Scite); it seems better to output the translated text to an Edit control. Advantages are : * If it's a very long text, then the MessageBox will not display it entirely (and its 'Ok' button won't show) * We can't copy-paste the translated text from a MessageBox (if we want to keep it) Here is an example of output in the Edit control, in its original GUI size (900 x 600) . The Gui can be maximized & resized. The Edit control can have its text wrapped or not (an eventual selection will be preserved when switching from Wrap to No Wrap) . Native scrollbars should work nicely in both cases (wrap / no wrap) . This example is the translation from a part of the AutoIt german introduction found in this webpage, copied to clipboard, then translated in english with the script below : #include "Json.au3" ; (by @AspirinJunkie) #include <GUIConstantsEx.au3> #include <GUIEdit.au3> #include <StringConstants.au3> #include <WindowsConstants.au3> Opt("MustDeclareVars", 1) ;0=no, 1=require pre-declaration Global $g_hGUI, $g_idEdit, $g_iGui_W = 900, $g_iGui_H = 600 ;======================== Local $sLangFROM = "auto" Local $sLangTO = "en" ; <===== change this line for the language of the translated text ;======================== Local $sInput, $sClipGet = StringToBinary(ClipGet(), $SB_UTF8) ; for example ะป (russian) becomes 0xD0BB For $i = 3 To StringLen($sClipGet) Step 2 ; start at 3 to bypass "0x" $sInput &= "%" & StringMid($sClipGet, $i, 2) Next Local $sTranslated = _GoogleAPITranslate($sInput, $sLangFROM, $sLangTO) If Not @compiled Then ConsoleWrite("ORIGINAL: " & BinaryToString($sClipGet, $SB_ANSI) & @crlf) ; in case of accented characters in Scite console. ConsoleWrite("----------------------------------------------------------------------------------------------------------------" & @crlf) ConsoleWrite(BinaryToString(StringToBinary($sTranslated, $SB_UTF8), $SB_ANSI) & @crlf) EndIf ; MsgBox(262144, "Clipboard translated From " & $sLangFROM & " To " & $sLangTO, $sTranslated) ; $MB_TOPMOST = 262144 _OutputInGui($sTranslated, $sLangFROM, $sLangTO) ;============================================== Func _GoogleAPITranslate($sMytext, $sFrom, $sTo) Local $sUrl, $oHTTP, $sResponse, $JSONData, $sOutput = "", $aData $sUrl = "https://translate.googleapis.com/translate_a/single?client=gtx&sl=" & $sFrom & "&tl=" & $sTo & "&dt=t&q=" & $sMytext $oHTTP = ObjCreate("Microsoft.XMLHTTP") $oHTTP.Open("POST", $sUrl, False) $oHTTP.Send() $sResponse = $oHTTP.ResponseText $JSONData = _JSON_Parse($sResponse) If VarGetType($JSONData) = 'Array' Then $aData = $JSONData[0] If VarGetType($aData) = 'Array' Then For $i = 0 To UBound($aData) -1 $sOutput &= ($aData[$i])[0] Next EndIf EndIf Return $sOutput EndFunc ;==>_GoogleAPITranslate ;=============================================================== Func _OutputInGui(Const ByRef $sTranslated, $sLangFROM, $sLangTO) $g_hGUI = GUICreate("Clipboard translated From " & $sLangFROM & " To " & $sLangTO, $g_iGui_W, $g_iGui_H, -1, -1, $WS_OVERLAPPEDWINDOW) _EditRecreate($sTranslated, True) ; True = word wrap (keep it True here, to match with the initial checked Menu item "Word Wrap") ; Menu Format Local $idFormatMenu = GUICtrlCreateMenu("F&ormat") ; Create the Format menu. Underline o when Alt is pressed. Local $idFormatMenu_WordWrap = GUICtrlCreateMenuItem("&Word Wrap" &@TAB& "", $idFormatMenu) ; Create the "Word Wrap" menu item. Underline W when Alt is pressed. GUICtrlSetState(-1, $GUI_CHECKED) GUISetState(@SW_SHOW, $g_hGUI) _GUICtrlEdit_SetSel($g_idEdit, -1, 0) ; deselects only when placed AFTER GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $idFormatMenu_WordWrap _WordWrap($sTranslated, $idFormatMenu_WordWrap) EndSwitch WEnd EndFunc ;==>_OutputInGui ;============================================================== Func _WordWrap(Const ByRef $sTranslated, $idFormatMenu_WordWrap) If BitAND(GUICtrlRead($idFormatMenu_WordWrap), $GUI_CHECKED) = $GUI_CHECKED Then ; turn off Word Wrap _EditRecreate($sTranslated, False) ; False = no Word Wrap GUICtrlSetState($idFormatMenu_WordWrap, $GUI_UNCHECKED) ; uncheck Word Wrap Else ; turn on Word Wrap _EditRecreate($sTranslated, True) ; True = Word Wrap GUICtrlSetState($idFormatMenu_WordWrap, $GUI_CHECKED) ; turn on Word Wrap and show checked EndIf EndFunc ;==>_WordWrap ;====================================================== Func _EditRecreate(Const ByRef $sTranslated, $bWordWrap) Local $idEdit_Old = $g_idEdit ; 0 at first passage If $idEdit_Old Then Local $aPos = ControlGetPos($g_hGUI, "", $idEdit_Old) Else ; 1st passage Local $aPos[4] = [20, 20, $g_iGui_W - 40, $g_iGui_H - 60] EndIf $g_idEdit = GUICtrlCreateEdit("", $aPos[0], $aPos[1], $aPos[2], $aPos[3], ($bWordWrap _ ? BitOr($ES_WANTRETURN, $WS_VSCROLL, $ES_AUTOVSCROLL) _ : -1)) ; control ID ; GUICtrlSetFont(-1, 10, 400, 0, "Courier New") ; change default font GUICtrlSetFont(-1, 11, 400, 0, "Lucida Console") ; seems better than Courier New If $idEdit_Old Then _GUICtrlEdit_SetText($g_idEdit, GUICtrlRead($idEdit_Old)) Local $aSel = _GUICtrlEdit_GetSel($idEdit_Old) GUICtrlDelete($idEdit_Old) _GUICtrlEdit_SetSel($g_idEdit, $aSel[0], $aSel[1]) Else ; 1st passage _GUICtrlEdit_SetText($g_idEdit, $sTranslated) EndIf EndFunc ;==>_EditRecreate If you want the output to be displayed first in MessageBox, then in Edit control (really ?) then uncomment the MessageBox line in the script : ; MsgBox(262144, "Clipboard translated From " & $sLangFROM & " To " & $sLangTO, $sTranslated) ; $MB_TOPMOST = 262144 _OutputInGui($sTranslated, $sLangFROM, $sLangTO) Happy translations ! * Update May 15, 2024 : changed Font in Edit control (Lucida Console seems better than Courier New) Next update should indicate which language Google used for translation, when we indicated "auto" as Language From. Maybe they will be other updates as I got some ideas
    1 point
  5. @Melba23 & @Nine Deleting the menu control seems to do the job. It will position to the very left of the GUI all existing menuitem(s) control(s) . Does this work for you ? #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> $Form1 = GUICreate("Form1", 615, 437, 192, 124) $mDummymenu = GUICtrlCreateMenu("this menu control will be deleted") $menu1 = GUICtrlCreateMenuItem("click me", -1) $menu2 = GUICtrlCreateMenuItem("click me again", -1) GUICtrlDelete($mDummymenu) ; <====================== GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $menu1 MsgBox($MB_TOPMOST ,'yes!', 'it works') Case $menu2 MsgBox($MB_TOPMOST,'yes!', 'it works again') EndSwitch WEnd
    1 point
  6. I don't know if you are like me, but I am always searching for that specific code I wrote over the years, but cannot find it. It was way too exhausting to look at 1k+ scripts. And Windows Explorer is not the best tool to do such exploration. So I made this little script that save me tons of time. Hope you will find it useful too. You can adjust default search folders and type of files you want to search for, but you can also change it at runtime. To use multiple filters separate them with ";" Let me know if you have any suggestion to enhance the tool. Version 2023-12-27 * Code revision : 3.3.16.1 now required Version 2023-05-10 * Sets children flag on first drawn list Version 2021-04-06 * Context menu modified to allow clipping file name and line content Version 2020-11-21 * Allows only 1 running instance of the script * Added right-click support on Tray to exit script Version 2020-06-29 * Added Copy File Name to context menu (helps to copy include files names) Version 2020-04-22 * Added icons to main buttons * Added informative box to describe progress and results of a search * Increased robustness of the GUI * Open Button enabled only under the right conditions * Added Tooltip on filter field to describe how to enter multiple criteria * Forced a minimum Window size Version 2020-04-18 * Added support of Context Menu in Tree View * Added support of Tray * Minimizes on Tray Version 2020-04-12 * Added DPI awareness * Added Enter Key functionality to start a search Version 2020-04-09 * Changed base size of the GUI to make it wider * Made the window resizable * Added Reset button * Shown busy cursor more appropriately * Corrected bug of first line displayed Thanks all for your input. SearchContent.au3
    1 point
×
×
  • Create New...