Jump to content

Leaderboard

Popular Content

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

  1. Scenario: Editing .lnk shortcuts with the Windows dialog is very frustrating due to the small input boxes and non-resizable small dialog window. Very often you need to create a link with a long path and many arguments which becomes hard to see and make edits. Solution: LNKEditorGUI is a resizable and easy to use creator and editor of LNK Windows Shortcut files. This GUI uses built-in AutoIt functions FileGetShortcut() and FileCreateShortcut() to read and write .lnk files. A nice and big (and resizable) GUI is presented with which the user can easily edit and create LNK shortcuts with. A command line argument is accepted and the GUI will automatically open the first file passed to it as an argument allowing for easy association on the right-click menu (see .lnk file right-click context menu registry association example below). Download: LNKEditorGUI.zip Screenshot: Reg Script Use a Registry Script such as following to create a right-click menu entry for LnkEditorGUI for .lnk files. Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\lnkfile\shell\LNKEditorGUI] @="LNK&EditorGUI" [HKEY_CLASSES_ROOT\lnkfile\shell\LNKEditorGUI\command] @="\"C:\\Program Files\\LNKEditorGUI.exe\" \"%1\"" LNKEditorGUI.au3 Code: #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <ComboConstants.au3> #include <GuiStatusBar.au3> #include <Timers.au3> #include <Array.au3> Opt("GUIOnEventMode", 1) Global Const $CmbWinstateNorm = @SW_SHOWNORMAL & " - Normal Window" Global Const $CmbWinstateMin = @SW_SHOWMINNOACTIVE & " - Minimized" Global Const $CmbWinstateMax = @SW_SHOWMAXIMIZED & " - Maximized" #region - GUI $GUI = GUICreate("LNKEditorGUI - Windows Shortcut LNK File Editor", 800, 640, -1, -1, BitOr($GUI_SS_DEFAULT_GUI,$WS_MAXIMIZEBOX,$WS_SIZEBOX ), $WS_EX_ACCEPTFILES) GUISetOnEvent($GUI_EVENT_CLOSE, '_exit') GUISetOnEvent($GUI_EVENT_DROPPED, "On_Drop_InFilename") GUISetFont(10) $Status = _GUICtrlStatusBar_Create($GUI) GUICtrlCreateLabel("File:", 4, 6, 36, 24) $inFilename = GUICtrlCreateInput("", 36, 4, 672, 24) GUICtrlSetState(-1, $GUI_DROPACCEPTED) $btBrowseForFile = GUICtrlCreateButton("Browse...", 712, 4, 84, 24) GUICtrlSetOnEvent(-1, '_btBrowseForFile') $btOpenFile = GUICtrlCreateButton("Load LNK File", 20, 32, 370, 28) GUICtrlSetOnEvent(-1, '_btOpenFile') GUICtrlSetResizing($btOpenFile, $GUI_DOCKLEFT) $btSaveFile = GUICtrlCreateButton("Save LNK File", 410, 34, 370, 28) GUICtrlSetOnEvent(-1, '_btSaveFile') GUICtrlSetResizing($btSaveFile, $GUI_DOCKRIGHT) GUICtrlCreateLabel("Target EXE", 4, 80, 172, 24) $inTargetEXE = GUICtrlCreateInput("", 4, 104, 792, 24) GUICtrlSetState(-1, $GUI_DROPACCEPTED) GUICtrlCreateLabel("Target Arguments", 4, 148, 172, 24) $editTargetArgs = GUICtrlCreateEdit("", 4, 172, 792, 96, $ES_MULTILINE) GUICtrlSetState(-1, $GUI_DROPACCEPTED) GUICtrlCreateLabel("Working Dir", 4, 288, 172, 24) $inWorkingDir = GUICtrlCreateInput("", 4, 312, 792, 24) GUICtrlSetState(-1, $GUI_DROPACCEPTED) GUICtrlCreateLabel("Window State", 4, 356, 172, 24) $cmbWindowState = GUICtrlCreateCombo("", 4, 380, 792, 24, $CBS_DROPDOWNLIST) GUICtrlSetData(-1, $CmbWinstateNorm & "|" & $CmbWinstateMin & "|" & $CmbWinstateMax, $CmbWinstateNorm) ; add other item snd set a new default GUICtrlCreateLabel("Icon File", 4, 424, 172, 24) $inIconFile = GUICtrlCreateInput("", 4, 448, 650, 24) GUICtrlSetState(-1, $GUI_DROPACCEPTED) GUICtrlCreateLabel("Icon Index", 680, 424, 172, 24) $inIconIndex = GUICtrlCreateInput("", 674, 448, 112, 24) GUICtrlCreateLabel("Comment", 4, 492, 172, 24) $editComment = GUICtrlCreateEdit("", 4, 516, 792, 96, $ES_MULTILINE) GUICtrlSetState(-1, $GUI_DROPACCEPTED) GUISetState(@SW_SHOW, $GUI) #endregion - GUI If $CmdLine[0] > 0 Then ;MsgBox(0,0,$CmdLine[1]) GUICtrlSetData($inFilename, $CmdLine[1]) _btOpenFile() EndIf While 1 Sleep(100) WEnd ;--------------------------------------------------------------- Func StatusBarNotify($msg) _GUICtrlStatusBar_SetText($Status, $msg) _Timer_SetTimer($GUI, 5000, "_ClearStatusBar") EndFunc ;--------------------------------------------------------------- Func _ClearStatusBar($hWnd, $msg, $iIDTimer, $dwTime) #forceref $hWnd, $msg, $iIDTimer, $dwTime _GUICtrlStatusBar_SetText($Status, "") _Timer_KillTimer($hWnd, $iIDTimer) EndFunc ;--------------------------------------------------------------- Func _btBrowseForFile() Local $var = FileSaveDialog("Choose a LNK File Name", "D:\", "LNK Shortcuts (*.lnk)", 2) ; option 2 = dialog remains until valid path/file selected If @error Then ;MsgBox(4096, "", "No File(s) chosen") Else $var = StringReplace($var, "|", @CRLF) GUICtrlSetData($inFilename, $var) EndIf EndFunc ;--------------------------------------------------------------- Func On_Drop_InFilename() If ( (@GUI_DropId = $inFilename) OR (@GUI_DropId = $inTargetEXE) ) Then GUICtrlSetData(@GUI_DropId, @GUI_DragFile) EndIf If ( (@GUI_DropId = $inFilename) AND (@GUI_DragFile <> "") ) Then OpenFile(@GUI_DragFile) EndIf EndFunc ;--------------------------------------------------------------- Func _btOpenFile() Local $filename = GUICtrlRead($inFilename) If $filename = "" Then ;_btBrowseForFile() ;$filename = GUICtrlRead($inFilename) StatusBarNotify("ERROR: Trying to open file but no file specified.") MsgBox(0,"ERROR","Trying to open file but no file specified.") Else OpenFile($filename) EndIf EndFunc ;--------------------------------------------------------------- Func OpenFile($filename) Local $lnkArray = FileGetShortcut($filename) If Not @error Then ;_ArrayDisplay($lnkArray) Else StatusBarNotify("ERROR: Unable to open file.") MsgBox(0,"ERROR","Unable to open file, please check the file name.") Return EndIf GUICtrlSetData($inTargetEXE, $lnkArray[0]) GUICtrlSetData($editTargetArgs, $lnkArray[2]) GUICtrlSetData($inWorkingDir, $lnkArray[1]) GUICtrlSetData($inIconFile, $lnkArray[4]) GUICtrlSetData($inIconIndex, $lnkArray[5]) GUICtrlSetData($editComment, $lnkArray[3]) If($lnkArray[6] = @SW_SHOWNORMAL) Then GUICtrlSetData($cmbWindowState, $CmbWinstateNorm) ElseIf($lnkArray[6] = @SW_SHOWMINNOACTIVE) Then GUICtrlSetData($cmbWindowState, $CmbWinstateMin) ElseIf($lnkArray[6] = @SW_SHOWMAXIMIZED) Then GUICtrlSetData($cmbWindowState, $CmbWinstateMax) EndIf StatusBarNotify("Successfully loaded file: " & $filename) EndFunc ;--------------------------------------------------------------- Func _btSaveFile() $filename = GUICtrlRead($inFilename) If $filename = "" Then StatusBarNotify("ERROR: Trying to save but no file name specified.") MsgBox(0,"ERROR","Trying to save but no file name specified.") Return EndIf Local $WinStateToWrite Switch GuiCtrlRead($cmbWindowState) Case $CmbWinstateNorm $WinStateToWrite = @SW_SHOWNORMAL Case $CmbWinstateMin $WinStateToWrite = @SW_SHOWMINNOACTIVE Case $CmbWinstateMax $WinStateToWrite = @SW_SHOWMAXIMIZED Case Else $WinStateToWrite = @SW_SHOWNORMAL EndSwitch $saveResult = FileCreateShortcut(GuiCtrlRead($inTargetEXE), $filename, GuiCtrlRead($inWorkingDir), GuiCtrlRead($editTargetArgs), GuiCtrlRead($editComment), GuiCtrlRead($inIconFile), "", GuiCtrlRead($inIconIndex), $WinStateToWrite) If($saveResult) Then StatusBarNotify("Successfully saved file to: " & $filename) Else StatusBarNotify("ERROR: Unable to save file, please check the file name and values.") MsgBox(0,"ERROR","Unable to save file, please check the file name and values.") EndIf EndFunc ;--------------------------------------------------------------- Func _exit() Exit EndFunc ;---------------------------------------------------------------
    1 point
  2. Hi all, This is really a nice project for autoit. This gui designer is really awesome. What makes it different is, that this program will manipulate a gui from code and manipulate code from gui. Ofcourse koda will do it but not this much efficiently. In koda, we need to copy the gui region to change the gui again. But in this program, if we need to change an already designed gui, we can simply open the file within this program and do our changes. The code will be changed without any problem. That's good feature. But the main problem of this program is that this is not have some essential good ide features like automatic indentation, automatic brace insertion, automatic end keyword filling. The author of this program is not in online since 2014 september. But he/she published the source code in this post. So if somebody come to ‌renovate this program, then it will be a very big help to autoit and all newcomers. Some features we need to make is; 1. Add more fonts to this program. Now, it have few fonts. 2. Add more clarity to the property section. 3. Add automatic code completion. 4. Add an option to crate projects and temporary files. (temp files are for quick testing) This is the link.
    1 point
  3. Use StringSplit with the newline character as the delimiter. That will give you an array of lines. Loop through it.
    1 point
  4. kjuenke, Did you notice that the first post in this thread dates from over 7 years ago and that the OP has not been online since then? Please do not necro-post like this again - just open a new thread and link to the old one if it is absolutely necessary for understanding the problem. We ask you to do this for two main reasons: The language advances and the functionality might well be included in core or UDF code by nowThe changes in language syntax mean that it is likely that code from more than a couple of years ago may well not run under the current release interpreter without significant modification.M23
    1 point
  5. mLipok

    Au3Info.exe close button

    Please stick to one thread. Edit: Threads now merged
    1 point
  6. JohnOne

    Au3Info.exe close button

    Because It's not a button, or any other class of window. I'm not 100% on it but I believe it's just a drawing on the actual main window.
    1 point
  7. Why do you need them? There are already functions that do what they do, like WinClose() or WinMinimize()
    1 point
  8. _GUICtrlEdit_SetCueBanner()
    1 point
×
×
  • Create New...