Jump to content

Enhanced Icons V1.1 + V2 by smashly + another version by corgano!


Mat
 Share

Recommended Posts

Why, yes. That would work, BUT, not everyone uses firefox. I spent a few hours on google trying to find the PATH th the defult web browser with no luck, so the idea was abandoned. If you can tell me which key holds the defult Browsers path, then please tell me.

*edit: If I could redundant grammar then please redundant grammar...*

I could always make one. I have lots off free time...

@autoitexe

That could be very usefull, you could write an entire script to the regestry! It would only work for people with autoit though

Hi,

I've updated my code with an examples selection ComboBox containing 4 (hopefully) working examples.

1 of the examples is an icon with links to AutoIt forum..

It gets the browser path from the registry, so it doesn't matter if you use IE or Firefox.

Cheers

Link to comment
Share on other sites

  • Replies 52
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

... I am yet to try, but I think you can run a compiled script with /executeline "msgBox (0, ""test"",""test"")" as a command line... That would mean anyone could use it so long as they had the program installed.

To get the default browser, read what the default one for pening a html file is! You need to read the default value of ".html", and then read the command for that.

$temp = RegRead ("HKEY_CLASSES_ROOT\.html", "")
$temp = RegRead ("HKEY_CLASSES_ROOT\" & $temp & "\shell\open\command", "")
If StringLeft ($temp, 1) = """" Then
   $temp = StringTrimLeft ($temp, 1)
   $temp = StringRegExpReplace ($temp, """.*", "")
Else
   $temp = StringRegExpReplace ($temp, "(\S*).*", "\1")
   $temp = FileGetLongName ($temp)
EndIf
MsgBox (0, "done", "default web browser is: " & @CRLF & @CRLF & $temp)

or you could do it through rundll.dll...

Run ("%WinDir%\System32\Rundll32.exe Url,FileProtocolHandler www.example.com")

hmm.. have I seen that before? Honestly now - it works. I have been using it for months without fail.

nice work btw corgano! Its coming along well. I am going through the tutorial now...

Mat

Link to comment
Share on other sites

... I am yet to try, but I think you can run a compiled script with /executeline "msgBox (0, ""test"",""test"")" as a command line... That would mean anyone could use it so long as they had the program installed.

To get the default browser, read what the default one for pening a html file is! You need to read the default value of ".html", and then read the command for that.

$temp = RegRead ("HKEY_CLASSES_ROOT\.html", "")
$temp = RegRead ("HKEY_CLASSES_ROOT\" & $temp & "\shell\open\command", "")
If StringLeft ($temp, 1) = """" Then
   $temp = StringTrimLeft ($temp, 1)
   $temp = StringRegExpReplace ($temp, """.*", "")
Else
   $temp = StringRegExpReplace ($temp, "(\S*).*", "\1")
   $temp = FileGetLongName ($temp)
EndIf
MsgBox (0, "done", "default web browser is: " & @CRLF & @CRLF & $temp)

or you could do it through rundll.dll...

Run ("%WinDir%\System32\Rundll32.exe Url,FileProtocolHandler www.example.com")

hmm.. have I seen that before? Honestly now - it works. I have been using it for months without fail.

nice work btw corgano! Its coming along well. I am going through the tutorial now...

Mat

Hi, the rundll32.exe method is tidier, nice..

Updated my script/post again using the method you said for the combobox example.

Cheers

Link to comment
Share on other sites

:D

Looking at your new one now smashly, its very nice!!! definitely a huge improvement on mine!

The wizard for commands is going to be very good. It already is! I am busy trying to sort out the /executeline part... but it shall be done soon! The folder, file, executable and url parts are doing well.

MDiesel

Link to comment
Share on other sites

The command line wizard is now up and running!! woop. It works better than I anticipated, and is a simple and small function that returns the command line so can easily be used in both your scripts (and mine, if I ever update it). It is so easy I couldn't believe it worked! Current tabs:

Input: Simple input of personalised command line. needs to be there doesn't it?

Executable ; find the exe, enter the params.

File: this is the very nice bit! Enter the file path, and it has a combo to show the context menu entries for it. e.g., c:\test.au3 has a combo on mine of:

>>>> (default program) << generic option available for all filetypes.

>>>> run

>>>> compile

>>>> debug << last 2 are

>>>> upload << my functions!

Website: url input / mailto (untested, but *should* work)

Folder: With options for view type, and folder select dialog

"advanced" aka autoit! may need a bit more in the way of tutorials for non autoiters.

The code:

; wizard

MsgBox (0, "Wizard complete.", _wizard ())

Func _Wizard ()
   Local $sCmdLine = "", $sFil_Cur = ""
   $hWizUI = GUICreate ("Create command line.", 500, 90)
      $hTab = GUICtrlCreateTab (2, 2, 496, 20)
         GUICtrlCreateTabItem ("Input...")
            GUICtrlCreateLabel ("Command Line:", 2, 24, 80, 20)
            $hInp_Inp = GUICtrlCreateInput ("", 84, 24, 390, 20)
         GUICtrlCreateTabItem ("Executable")
            GUICtrlCreateLabel (".exe file path:", 2, 24, 80, 20)
               $hExe_Inp = GUICtrlCreateInput ("", 84, 24, 390, 20)
               $hExe_Btn = GUICtrlCreateButton ("...", 474, 24, 20, 20)
            GUICtrlCreateLabel ("* Arguments:", 2, 46, 80, 20)
               $hExe_Par = GUICtrlCreateInput ("", 84, 46, 410, 20)
         GUICtrlCreateTabItem ("File")
            GUICtrlCreateLabel (" file path:", 2, 24, 80, 20)
               $hFil_Inp = GUICtrlCreateInput ("", 84, 24, 390, 20)
               $hFil_Btn = GUICtrlCreateButton ("...", 474, 24, 20, 20)
               $hFil_Lst = GUICtrlCreateCombo ("", 2, 46, 100, 20, 0x0003)
            GUICtrlCreateLabel ("* Additional params:", 108, 48, 105, 20)
               $hFil_Add = GUICtrlCreateInput ("", 206, 46, 285, 20)
         GUICtrlCreateTabItem ("Web site")
            $hWeb_Rad = GUICtrlCreateRadio ("URL:", 2, 24, 60, 20)
               GUICtrlSetState (-1, 1)
               $hWeb_Url = GUICtrlCreateInput ("http:\\", 64, 24, 430, 20)
            GUICtrlCreateRadio ("Mailto:", 2, 46, 60, 20)
               $hWeb_Mto = GUICtrlCreateInput ("", 64, 46, 430, 20)
         GUICtrlCreateTabItem ("Folder")
            GUICtrlCreateLabel ("Folder directory:", 2, 24, 80, 20)
               $hFol_Inp = GUICtrlCreateInput ("", 84, 24, 390, 20)
               $hFol_Btn = GUICtrlCreateButton ("...", 474, 24, 20, 20)
               $hFol_Lst = GUICtrlCreateCombo ("", 2, 46, 100, 20, 0x0003)
                  GUICtrlSetData (-1, "Normal View")
                  GUICtrlSetData (-1, "Explorer View")
            GUICtrlCreateLabel ("* Additional params:", 108, 48, 105, 20)
               $hFol_Add = GUICtrlCreateInput ("", 206, 46, 285, 20)
         GUICtrlCreateTabItem ("Advanced")
            GUICtrlCreateLabel ("Execute Line:", 2, 24, 80, 20)
               $hAdv_Inp = GUICtrlCreateInput ("", 84, 24, 410, 20)
            $hAdv_Rad = GUICtrlCreateRadio ("Errors to STD stream. *", 2, 46, 130, 20)
      GUICtrlCreateTabItem ("")
      GUICtrlCreateLabel ("* = optional.", 2, 68, 80, 20)
      $hDlg_tst = GUICtrlCreateButton ("Test run", 252, 68, 80, 20)
      $hDlg_can = GUICtrlCreateButton ("Cancel", 334, 68, 80, 20)
      $hDlg_don = GUICtrlCreateButton ("Finished", 416, 68, 80, 20)
   GUISetState ()
   While 1
      $msg = GUIGetMsg ()
      Switch $msg
         Case -3, $hDlg_can
            GUIDelete ($hWizUI)
            Return SetError (1, 0, "")
         Case $hDlg_Don, $hDlg_tst
            Switch ControlCommand ($hWizUI, "", $hTab, "CurrentTab", "")
               Case 1 ; Input...
                  $sCmdLine = GUICtrlRead ($hInp_Inp)
               Case 2 ; executable
                  $sCmdLine = """" & GUICtrlRead ($hExe_Inp) & """ " & GUICtrlRead ($hExe_Par)
               Case 3 ; file
                  $cur = GUICtrlRead ($hFil_Lst)
                  If $cur = "" Then
                     $sCmdLine = """" & GUICtrlRead ($hFil_Inp) & """"
                  ElseIf $cur = "(default Program)" Then
                     $sCmdLine = "%WinDir%\System32\Rundll32.exe Url,FileProtocolHandler " & FileGetShortName (GUICtrlRead ($hFil_Inp))
                  Else
                     $cur = RegRead ("HKCR\" & $temp & "\shell\" & $cur & "\Command", "")
                     $pos = StringInStr ($cur, "%1")
                     If $Pos <> 0 Then
                        $quote = ""
                        If StringMid ($cur, $pos - 1, 1) <> """" Then $quote = """"
                        $sCmdLine = StringReplace (StringReplace ( _
                           $cur, "%1", $quote & GUICtrlRead ($hFil_Inp) & $quote), "%*", "") & GUICtrlRead ($hFil_Add)
                        If $msg = $hDlg_don Then ExitLoop
                        Run ($sCmdLine)
                        ContinueLoop
                     EndIf
                     If StringLeft ($cur, 1) = """" Then
                        $cur = StringTrimLeft ($cur, 1)
                        $cur = StringRegExpReplace ($cur, """.*", "")
                     Else
                        $cur = StringRegExpReplace ($cur, "(\S*).*", "\1")
                        $cur = FileGetLongName ($cur)
                     EndIf
                     $sCmdLine = """" & $cur & """ """ & GUICtrlRead ($hFil_Inp) & """ " & GUICtrlRead ($hFil_Add)
                  EndIf
               Case 4 ; web site
                  If BitAnd (GUICtrlRead ($hWeb_Rad), 1) Then
                     $sCmdLine = "%WinDir%\System32\Rundll32.exe Url,FileProtocolHandler " & GUICtrlRead ($hWeb_Url)
                  Else
                     $sCmdLine = "%WinDir%\System32\Rundll32.exe Url,FileProtocolHandler Mailto:" & GUICtrlRead ($hWeb_Mto)
                  EndIf
               Case 5 ; folder
                  $view = "/n"
                  If GUICtrlRead ($hFol_Lst) = "Explorer View" Then $view = "/e"
                  $sCmdLine = "explorer.exe " & $view & " """ & GUICtrlRead ($hFol_Inp) & """ " & GUICtrlRead ($hFol_Add)
               Case 6 ; advanced
                  $sErr = ""
                  If BitAnd (GUICtrlRead ($hAdv_Rad), 1) Then $sErr = "/ErrorStdOut"
                  $sCmdLine = """" & @AutoitExe & """ " & $sErr & " /AutoIt3ExecuteLine """ & _
                     StringReplace (GUICtrlRead ($hAdv_Inp), """", """""") & """"
            EndSwitch
            If $msg = $hDlg_don Then ExitLoop
            Run ($sCmdLine)
         Case $hExe_Btn
            $sFile = FileOpenDialog ("Open exe...", @WorkingDir, "Executables (*.exe)|All Files (*.*)", 3, "*.exe", $hWizUI)
            If @Error Then ContinueLoop
            GUICtrlSetData ($hExe_Inp, $sFile)
         Case $hFil_Btn
            $sFile = FileOpenDialog ("Open File...", @WorkingDir, "All Files (*.*)", 3, "", $hWizUI)
            If @Error Then ContinueLoop
            GUICtrlSetData ($hFil_Inp, $sFile)
         Case $hFol_Btn
            $sFile = FileSelectFolder ("Select Folder...", "", 7, @WorkingDir, $hWizUI)
            If @Error Then ContinueLoop
            GUICtrlSetData ($hFol_Inp, $sFile)
      EndSwitch
      If $sFil_cur = GUICtrlRead ($hFil_Inp) Then ContinueLoop
      $sFil_cur = GUICtrlRead ($hFil_Inp)
      GUICtrlSetData ($hFil_Lst, "")
      If Not FileExists ($sFil_Cur) Then ContinueLoop
      $temp = RegRead ("HKCR\." & StringRegExpReplace ($sFil_Cur, ".*\.", ""), "")
      If @Error Then ContinueLoop
      $i = 0
      GUICtrlSetData ($hFil_Lst, "(default Program)")
      While 1
         $i += 1
         RegEnumKey ("HKCR\" & $temp & "\shell\", $i)
         If @Error <> 0 Then ExitLoop
         GUICtrlSetData ($hFil_Lst, RegEnumKey ("HKCR\" & $temp & "\shell\", $i))
      WEnd
   WEnd
   GUIDelete ($hWizUI)
   Return $sCmdLine
EndFunc ; ==> _Wizard
Link to comment
Share on other sites

Sweet! Now i am gonna do what I do best....

Re-Do the GUI!

Using RunDLL would be a much better way for webpages. (i have SciTE set for .HTML files)

Edited by corgano

0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Link to comment
Share on other sites

The command line wizard is now up and running!! woop. It works better than I anticipated, and is a simple and small function that returns the command line so can easily be used in both your scripts (and mine, if I ever update it). It is so easy I couldn't believe it worked! Current tabs:

Input: Simple input of personalised command line. needs to be there doesn't it?

Executable ; find the exe, enter the params.

File: this is the very nice bit! Enter the file path, and it has a combo to show the context menu entries for it. e.g., c:\test.au3 has a combo on mine of:

>>>> (default program) << generic option available for all filetypes.

>>>> run

>>>> compile

>>>> debug << last 2 are

>>>> upload << my functions!

Website: url input / mailto (untested, but *should* work)

Folder: With options for view type, and folder select dialog

"advanced" aka autoit! may need a bit more in the way of tutorials for non autoiters.

The code:

; wizard

MsgBox (0, "Wizard complete.", _wizard ())

Func _Wizard ()
   Local $sCmdLine = "", $sFil_Cur = ""
   $hWizUI = GUICreate ("Create command line.", 500, 90)
      $hTab = GUICtrlCreateTab (2, 2, 496, 20)
         GUICtrlCreateTabItem ("Input...")
            GUICtrlCreateLabel ("Command Line:", 2, 24, 80, 20)
            $hInp_Inp = GUICtrlCreateInput ("", 84, 24, 390, 20)
         GUICtrlCreateTabItem ("Executable")
            GUICtrlCreateLabel (".exe file path:", 2, 24, 80, 20)
               $hExe_Inp = GUICtrlCreateInput ("", 84, 24, 390, 20)
               $hExe_Btn = GUICtrlCreateButton ("...", 474, 24, 20, 20)
            GUICtrlCreateLabel ("* Arguments:", 2, 46, 80, 20)
               $hExe_Par = GUICtrlCreateInput ("", 84, 46, 410, 20)
         GUICtrlCreateTabItem ("File")
            GUICtrlCreateLabel (" file path:", 2, 24, 80, 20)
               $hFil_Inp = GUICtrlCreateInput ("", 84, 24, 390, 20)
               $hFil_Btn = GUICtrlCreateButton ("...", 474, 24, 20, 20)
               $hFil_Lst = GUICtrlCreateCombo ("", 2, 46, 100, 20, 0x0003)
            GUICtrlCreateLabel ("* Additional params:", 108, 48, 105, 20)
               $hFil_Add = GUICtrlCreateInput ("", 206, 46, 285, 20)
         GUICtrlCreateTabItem ("Web site")
            $hWeb_Rad = GUICtrlCreateRadio ("URL:", 2, 24, 60, 20)
               GUICtrlSetState (-1, 1)
               $hWeb_Url = GUICtrlCreateInput ("http:\\", 64, 24, 430, 20)
            GUICtrlCreateRadio ("Mailto:", 2, 46, 60, 20)
               $hWeb_Mto = GUICtrlCreateInput ("", 64, 46, 430, 20)
         GUICtrlCreateTabItem ("Folder")
            GUICtrlCreateLabel ("Folder directory:", 2, 24, 80, 20)
               $hFol_Inp = GUICtrlCreateInput ("", 84, 24, 390, 20)
               $hFol_Btn = GUICtrlCreateButton ("...", 474, 24, 20, 20)
               $hFol_Lst = GUICtrlCreateCombo ("", 2, 46, 100, 20, 0x0003)
                  GUICtrlSetData (-1, "Normal View")
                  GUICtrlSetData (-1, "Explorer View")
            GUICtrlCreateLabel ("* Additional params:", 108, 48, 105, 20)
               $hFol_Add = GUICtrlCreateInput ("", 206, 46, 285, 20)
         GUICtrlCreateTabItem ("Advanced")
            GUICtrlCreateLabel ("Execute Line:", 2, 24, 80, 20)
               $hAdv_Inp = GUICtrlCreateInput ("", 84, 24, 410, 20)
            $hAdv_Rad = GUICtrlCreateRadio ("Errors to STD stream. *", 2, 46, 130, 20)
      GUICtrlCreateTabItem ("")
      GUICtrlCreateLabel ("* = optional.", 2, 68, 80, 20)
      $hDlg_tst = GUICtrlCreateButton ("Test run", 252, 68, 80, 20)
      $hDlg_can = GUICtrlCreateButton ("Cancel", 334, 68, 80, 20)
      $hDlg_don = GUICtrlCreateButton ("Finished", 416, 68, 80, 20)
   GUISetState ()
   While 1
      $msg = GUIGetMsg ()
      Switch $msg
         Case -3, $hDlg_can
            GUIDelete ($hWizUI)
            Return SetError (1, 0, "")
         Case $hDlg_Don, $hDlg_tst
            Switch ControlCommand ($hWizUI, "", $hTab, "CurrentTab", "")
               Case 1 ; Input...
                  $sCmdLine = GUICtrlRead ($hInp_Inp)
               Case 2 ; executable
                  $sCmdLine = """" & GUICtrlRead ($hExe_Inp) & """ " & GUICtrlRead ($hExe_Par)
               Case 3 ; file
                  $cur = GUICtrlRead ($hFil_Lst)
                  If $cur = "" Then
                     $sCmdLine = """" & GUICtrlRead ($hFil_Inp) & """"
                  ElseIf $cur = "(default Program)" Then
                     $sCmdLine = "%WinDir%\System32\Rundll32.exe Url,FileProtocolHandler " & FileGetShortName (GUICtrlRead ($hFil_Inp))
                  Else
                     $cur = RegRead ("HKCR\" & $temp & "\shell\" & $cur & "\Command", "")
                     $pos = StringInStr ($cur, "%1")
                     If $Pos <> 0 Then
                        $quote = ""
                        If StringMid ($cur, $pos - 1, 1) <> """" Then $quote = """"
                        $sCmdLine = StringReplace (StringReplace ( _
                           $cur, "%1", $quote & GUICtrlRead ($hFil_Inp) & $quote), "%*", "") & GUICtrlRead ($hFil_Add)
                        If $msg = $hDlg_don Then ExitLoop
                        Run ($sCmdLine)
                        ContinueLoop
                     EndIf
                     If StringLeft ($cur, 1) = """" Then
                        $cur = StringTrimLeft ($cur, 1)
                        $cur = StringRegExpReplace ($cur, """.*", "")
                     Else
                        $cur = StringRegExpReplace ($cur, "(\S*).*", "\1")
                        $cur = FileGetLongName ($cur)
                     EndIf
                     $sCmdLine = """" & $cur & """ """ & GUICtrlRead ($hFil_Inp) & """ " & GUICtrlRead ($hFil_Add)
                  EndIf
               Case 4 ; web site
                  If BitAnd (GUICtrlRead ($hWeb_Rad), 1) Then
                     $sCmdLine = "%WinDir%\System32\Rundll32.exe Url,FileProtocolHandler " & GUICtrlRead ($hWeb_Url)
                  Else
                     $sCmdLine = "%WinDir%\System32\Rundll32.exe Url,FileProtocolHandler Mailto:" & GUICtrlRead ($hWeb_Mto)
                  EndIf
               Case 5 ; folder
                  $view = "/n"
                  If GUICtrlRead ($hFol_Lst) = "Explorer View" Then $view = "/e"
                  $sCmdLine = "explorer.exe " & $view & " """ & GUICtrlRead ($hFol_Inp) & """ " & GUICtrlRead ($hFol_Add)
               Case 6 ; advanced
                  $sErr = ""
                  If BitAnd (GUICtrlRead ($hAdv_Rad), 1) Then $sErr = "/ErrorStdOut"
                  $sCmdLine = """" & @AutoitExe & """ " & $sErr & " /AutoIt3ExecuteLine """ & _
                     StringReplace (GUICtrlRead ($hAdv_Inp), """", """""") & """"
            EndSwitch
            If $msg = $hDlg_don Then ExitLoop
            Run ($sCmdLine)
         Case $hExe_Btn
            $sFile = FileOpenDialog ("Open exe...", @WorkingDir, "Executables (*.exe)|All Files (*.*)", 3, "*.exe", $hWizUI)
            If @Error Then ContinueLoop
            GUICtrlSetData ($hExe_Inp, $sFile)
         Case $hFil_Btn
            $sFile = FileOpenDialog ("Open File...", @WorkingDir, "All Files (*.*)", 3, "", $hWizUI)
            If @Error Then ContinueLoop
            GUICtrlSetData ($hFil_Inp, $sFile)
         Case $hFol_Btn
            $sFile = FileSelectFolder ("Select Folder...", "", 7, @WorkingDir, $hWizUI)
            If @Error Then ContinueLoop
            GUICtrlSetData ($hFol_Inp, $sFile)
      EndSwitch
      If $sFil_cur = GUICtrlRead ($hFil_Inp) Then ContinueLoop
      $sFil_cur = GUICtrlRead ($hFil_Inp)
      GUICtrlSetData ($hFil_Lst, "")
      If Not FileExists ($sFil_Cur) Then ContinueLoop
      $temp = RegRead ("HKCR\." & StringRegExpReplace ($sFil_Cur, ".*\.", ""), "")
      If @Error Then ContinueLoop
      $i = 0
      GUICtrlSetData ($hFil_Lst, "(default Program)")
      While 1
         $i += 1
         RegEnumKey ("HKCR\" & $temp & "\shell\", $i)
         If @Error <> 0 Then ExitLoop
         GUICtrlSetData ($hFil_Lst, RegEnumKey ("HKCR\" & $temp & "\shell\", $i))
      WEnd
   WEnd
   GUIDelete ($hWizUI)
   Return $sCmdLine
EndFunc ; ==> _Wizard

Hi, I like the idea of the wizard, Neato :D

I'd like to see it implemented in your script so i can get a better grasp of it in action.

I've updated my code/post again..

I turned the Examples into Presets that a user can load/delete/save their own presets to.

Changed and added a few other bits and pieces, mainly to make it easier for a user to quickly whip up enhanced desktop icons with minimal fuss.

Cheers

Link to comment
Share on other sites

:D

its pretty simple:

; wizard

GUICreate ("Example")
$hCmdLine = GUICtrlCreateInput ("", 2, 2, 80, 20)
   $hStartWiz = GUICtrlCreateButton ("...", 82, 2, 20, 20)
   $hTest = GUICtrlCreateButton ("Run!!", 2, 24, 80, 20)
GUISetState ()

While 1
   Switch GUIGetMsg ()
      Case -3
         Exit
      Case $hStartWiz
         GUICtrlSetData ($hCmdLine, _Wizard ())
      Case $hTest
         Run (GUICtrlRead ($hCmdLine))
   EndSwitch
WEnd

Func _Wizard ()
   Local $sCmdLine = "", $sFil_Cur = ""
   $hWizUI = GUICreate ("Create command line.", 500, 90)
      $hTab = GUICtrlCreateTab (2, 2, 496, 20)
         GUICtrlCreateTabItem ("Input...")
            GUICtrlCreateLabel ("Command Line:", 2, 24, 80, 20)
            $hInp_Inp = GUICtrlCreateInput ("", 84, 24, 390, 20)
         GUICtrlCreateTabItem ("Executable")
            GUICtrlCreateLabel (".exe file path:", 2, 24, 80, 20)
               $hExe_Inp = GUICtrlCreateInput ("", 84, 24, 390, 20)
               $hExe_Btn = GUICtrlCreateButton ("...", 474, 24, 20, 20)
            GUICtrlCreateLabel ("* Arguments:", 2, 46, 80, 20)
               $hExe_Par = GUICtrlCreateInput ("", 84, 46, 410, 20)
         GUICtrlCreateTabItem ("File")
            GUICtrlCreateLabel (" file path:", 2, 24, 80, 20)
               $hFil_Inp = GUICtrlCreateInput ("", 84, 24, 390, 20)
               $hFil_Btn = GUICtrlCreateButton ("...", 474, 24, 20, 20)
               $hFil_Lst = GUICtrlCreateCombo ("", 2, 46, 100, 20, 0x0003)
            GUICtrlCreateLabel ("* Additional params:", 108, 48, 105, 20)
               $hFil_Add = GUICtrlCreateInput ("", 206, 46, 285, 20)
         GUICtrlCreateTabItem ("Web site")
            $hWeb_Rad = GUICtrlCreateRadio ("URL:", 2, 24, 60, 20)
               GUICtrlSetState (-1, 1)
               $hWeb_Url = GUICtrlCreateInput ("http:\\", 64, 24, 430, 20)
            GUICtrlCreateRadio ("Mailto:", 2, 46, 60, 20)
               $hWeb_Mto = GUICtrlCreateInput ("", 64, 46, 430, 20)
         GUICtrlCreateTabItem ("Folder")
            GUICtrlCreateLabel ("Folder directory:", 2, 24, 80, 20)
               $hFol_Inp = GUICtrlCreateInput ("", 84, 24, 390, 20)
               $hFol_Btn = GUICtrlCreateButton ("...", 474, 24, 20, 20)
               $hFol_Lst = GUICtrlCreateCombo ("", 2, 46, 100, 20, 0x0003)
                  GUICtrlSetData (-1, "Normal View")
                  GUICtrlSetData (-1, "Explorer View")
            GUICtrlCreateLabel ("* Additional params:", 108, 48, 105, 20)
               $hFol_Add = GUICtrlCreateInput ("", 206, 46, 285, 20)
         GUICtrlCreateTabItem ("Advanced")
            GUICtrlCreateLabel ("Execute Line:", 2, 24, 80, 20)
               $hAdv_Inp = GUICtrlCreateInput ("", 84, 24, 410, 20)
            $hAdv_Rad = GUICtrlCreateRadio ("Errors to STD stream. *", 2, 46, 130, 20)
      GUICtrlCreateTabItem ("")
      GUICtrlCreateLabel ("* = optional.", 2, 68, 80, 20)
      $hDlg_tst = GUICtrlCreateButton ("Test run", 252, 68, 80, 20)
      $hDlg_can = GUICtrlCreateButton ("Cancel", 334, 68, 80, 20)
      $hDlg_don = GUICtrlCreateButton ("Finished", 416, 68, 80, 20)
   GUISetState ()
   While 1
      $msg = GUIGetMsg ()
      Switch $msg
         Case -3, $hDlg_can
            GUIDelete ($hWizUI)
            Return SetError (1, 0, "")
         Case $hDlg_Don, $hDlg_tst
            Switch ControlCommand ($hWizUI, "", $hTab, "CurrentTab", "")
               Case 1 ; Input...
                  $sCmdLine = GUICtrlRead ($hInp_Inp)
               Case 2 ; executable
                  $sCmdLine = """" & GUICtrlRead ($hExe_Inp) & """ " & GUICtrlRead ($hExe_Par)
               Case 3 ; file
                  $cur = GUICtrlRead ($hFil_Lst)
                  If $cur = "" Then
                     $sCmdLine = """" & GUICtrlRead ($hFil_Inp) & """"
                  ElseIf $cur = "(default Program)" Then
                     $sCmdLine = "%WinDir%\System32\Rundll32.exe Url,FileProtocolHandler " & FileGetShortName (GUICtrlRead ($hFil_Inp))
                  Else
                     $cur = RegRead ("HKCR\" & $temp & "\shell\" & $cur & "\Command", "")
                     $pos = StringInStr ($cur, "%1")
                     If $Pos <> 0 Then
                        $quote = ""
                        If StringMid ($cur, $pos - 1, 1) <> """" Then $quote = """"
                        $sCmdLine = StringReplace (StringReplace ( _
                           $cur, "%1", $quote & GUICtrlRead ($hFil_Inp) & $quote), "%*", "") & GUICtrlRead ($hFil_Add)
                        If $msg = $hDlg_don Then ExitLoop
                        Run ($sCmdLine)
                        ContinueLoop
                     EndIf
                     If StringLeft ($cur, 1) = """" Then
                        $cur = StringTrimLeft ($cur, 1)
                        $cur = StringRegExpReplace ($cur, """.*", "")
                     Else
                        $cur = StringRegExpReplace ($cur, "(\S*).*", "\1")
                        $cur = FileGetLongName ($cur)
                     EndIf
                     $sCmdLine = """" & $cur & """ """ & GUICtrlRead ($hFil_Inp) & """ " & GUICtrlRead ($hFil_Add)
                  EndIf
               Case 4 ; web site
                  If BitAnd (GUICtrlRead ($hWeb_Rad), 1) Then
                     $sCmdLine = "%WinDir%\System32\Rundll32.exe Url,FileProtocolHandler " & GUICtrlRead ($hWeb_Url)
                  Else
                     $sCmdLine = "%WinDir%\System32\Rundll32.exe Url,FileProtocolHandler Mailto:" & GUICtrlRead ($hWeb_Mto)
                  EndIf
               Case 5 ; folder
                  $view = "/n"
                  If GUICtrlRead ($hFol_Lst) = "Explorer View" Then $view = "/e"
                  $sCmdLine = "explorer.exe " & $view & " """ & GUICtrlRead ($hFol_Inp) & """ " & GUICtrlRead ($hFol_Add)
               Case 6 ; advanced
                  $sErr = ""
                  If BitAnd (GUICtrlRead ($hAdv_Rad), 1) Then $sErr = "/ErrorStdOut"
                  $sCmdLine = """" & @AutoitExe & """ " & $sErr & " /AutoIt3ExecuteLine """ & _
                     StringReplace (GUICtrlRead ($hAdv_Inp), """", """""") & """"
            EndSwitch
            If $msg = $hDlg_don Then ExitLoop
            Run ($sCmdLine)
         Case $hExe_Btn
            $sFile = FileOpenDialog ("Open exe...", @WorkingDir, "Executables (*.exe)|All Files (*.*)", 3, "*.exe", $hWizUI)
            If @Error Then ContinueLoop
            GUICtrlSetData ($hExe_Inp, $sFile)
         Case $hFil_Btn
            $sFile = FileOpenDialog ("Open File...", @WorkingDir, "All Files (*.*)", 3, "", $hWizUI)
            If @Error Then ContinueLoop
            GUICtrlSetData ($hFil_Inp, $sFile)
         Case $hFol_Btn
            $sFile = FileSelectFolder ("Select Folder...", "", 7, @WorkingDir, $hWizUI)
            If @Error Then ContinueLoop
            GUICtrlSetData ($hFol_Inp, $sFile)
      EndSwitch
      If $sFil_cur = GUICtrlRead ($hFil_Inp) Then ContinueLoop
      $sFil_cur = GUICtrlRead ($hFil_Inp)
      GUICtrlSetData ($hFil_Lst, "")
      If Not FileExists ($sFil_Cur) Then ContinueLoop
      $temp = RegRead ("HKCR\." & StringRegExpReplace ($sFil_Cur, ".*\.", ""), "")
      If @Error Then ContinueLoop
      $i = 0
      GUICtrlSetData ($hFil_Lst, "(default Program)")
      While 1
         $i += 1
         RegEnumKey ("HKCR\" & $temp & "\shell\", $i)
         If @Error <> 0 Then ExitLoop
         GUICtrlSetData ($hFil_Lst, RegEnumKey ("HKCR\" & $temp & "\shell\", $i))
      WEnd
   WEnd
   GUIDelete ($hWizUI)
   Return $sCmdLine
EndFunc ; ==> _Wizard
I like the way it turned out... Particularly the file part, that context menu detection worked out!

Mat

Link to comment
Share on other sites

Bad news

My HDD died, so my computer has offically been downgraded to a "do nothing mechine".

When I get a new HDD I will finish my program, the last version should be fully functional if anyone wants to use it.

0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Link to comment
Share on other sites

H,

I'm close to getting Mat's Wizard implemented to my script, but it'll be a little different once I get it working correctly..

I working on a drop down box for my in place edit, so a user can select the type of switch/param they want inserted into the command while they in place edit.

Updated my original code post again:

Got rid of a few buttons.

Added context menus instead.

Drag Edit item up and down in the listview to get em the way you want.

Cheers

Link to comment
Share on other sites

  • 4 months later...

Matt, Smashly,

This app looks to do like 95% of what I need. The only problem is i'm a total noob and can barely understand the programming here.

I have a command line based file extractor app that has lots of confusing parameters, and can operate on many different kinds of files (file extensions)

What I am trying to do, is create a simple GUI that has checkboxes for the various parameters, and dialogs to set the path to the file for it to work on.

Once all these things are set up, this command string is generated and then passed on to a windows (run) command window to execute.

So this is supposed to generate a command line string based on parameters (command line switches) of some exectutable. I'm not clear on where this "compiled" string is placed when the script executes, and how exactly to pass the string to the run command to then execute the program. (I think mat's final version post shows the script dialog and then the results of which get passed to the "shell" window for execution but I cant seem to get it to work).

Sorry for being an idiot, in advance.

Edited by SliFallen
Link to comment
Share on other sites

Firstly, sorry for not noticing this earlier, it would appear the forum (which usually tells me when a thread I replied to is changed) cuts off the older threads. My last example is probably no exactly what you want, as it is a much more generic dialog, and to create a dialog specific to the command line exe of which you speak we will need to know what it is.

Luckily for you there is not a lot of programming involved in what you are trying to do... thanks to a wonderful tool called "Koda" which willl allow you to make a complex User Interface using a simple designer. After that it is a question of reading the controls, for which there are plenty of examples.

Good luck

Mat

Link to comment
Share on other sites

  • 4 months later...

Good news everyone! I have released a new version, with a better GUI and everything! It now supports any file using a helper script. Here is link to thread

0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...