Sign in to follow this  
Followers 0
Achilles

Browsing

7 posts in this topic

Hello... I want to be able to look for a folder instead of a file when I browse. I find it impossible to click on "OK" on a folder. I need it to do this because for a program I'm writing it needs to open a folder so that it can edit the files inside. (However, the files are always going to be changing (in name/ammount) so I can't just preset how to change them.) The program I have know can browse for a file and then once you select one it will show it in an input box. Then I tried adding on a part that would send backspace until it finds a \ (because it's going to be using 'run' and if you send delete until you hit a \ it will open a folder instead of a file).

Any help would be greatly appreciated and if you don't understand what I mean just say so and I'll try to edit to make it more clear or add some of the script.

Piano_Man


My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites



Welcome to the forums!

It sounds like you're looking for FileSelectFolder.


[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Share this post


Link to post
Share on other sites

Welcome to the forums!

It sounds like you're looking for FileSelectFolder.

Will that let me search for a folder though? From what I see FileSelectFolder just lets you open a specific folder. I need someway to open any folder.

Thanks, Piano_Man


My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites

Will that let me search for a folder though? From what I see FileSelectFolder just lets you open a specific folder. I need someway to open any folder.

Your question is a little vague... FileSelectFolder works similarly to FileOpenDialog in that it allows the user to browse to a folder at run-time.

Hello... I want to be able to look for a folder instead of a file when I browse. I find it impossible to click on "OK" on a folder. I need it to do this because for a program I'm writing it needs to open a folder so that it can edit the files inside. (However, the files are always going to be changing (in name/ammount) so I can't just preset how to change them.) The program I have know can browse for a file and then once you select one it will show it in an input box. Then I tried adding on a part that would send backspace until it finds a \ (because it's going to be using 'run' and if you send delete until you hit a \ it will open a folder instead of a file).

When I first read this, it sounded like you wanted to use FileOpenDialog to select a file, then strip out the filename to get your folder path.

Please post the code you have so far.

Searching and Browsing are two different things, and I'm not sure which you're trying to accomplish.


[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Share this post


Link to post
Share on other sites

Your question is a little vague... FileSelectFolder works similarly to FileOpenDialog in that it allows the user to browse to a folder at run-time.

When I first read this, it sounded like you wanted to use FileOpenDialog to select a file, then strip out the filename to get your folder path.

Please post the code you have so far.

Searching and Browsing are two different things, and I'm not sure which you're trying to accomplish.

Ok.. sorry if I was vague. The way I have it know it opens up a box that lets you browse through all you computer's hardrive so you can choose the file you want it to open. The way I want it is that I should be able to select the folder because that's what I want it to open when it sends the data in to 'run'. (If you have iTunes, click on file, "add folder to library" and that's what I'm looking for)

#include <GUIConstants.au3>
GUICreate("How many photos?", 220, 220, -1, -1)
GuiCtrlCreateLabel("Insert how many pictures you want resized" & @CRLF & "and then insert the percentage of the new" & @CRLF & "picture compared to the old picture. You " &@CRLF& "can also chose where the program should " &@CRLF& "to find the pictures.", 5, 5, 220, 70 )
$numpic = GuiCtrlCreateInput("", 20, 110, 25, 20)
GuiCtrlCreateLabel("Pictures", 50, 113)
$percent = GuiCtrlCreateInput("50", 20, 140, 25, 20)
GuiCtrlCreateLabel("% scaled", 50, 144)
$exit = GuiCtrlCreateButton("Exit", 10, 180, 60, 20)
$ok = GuiCtrlCreateButton("OK", 150, 180, 60, 20)

Global $sFilename = @SystemDir & "\shell32.dll"; Default file is "shell32.dll"
$hFile = GUICtrlCreateEdit($sFilename, 5,  80, 210, 16, $ES_READONLY, $WS_EX_STATICEDGE)
$hFileSel = GUICtrlCreateButton("Browse", 150,  110, 60, 20)
Global $iStartIndex = 0, $iCntRow, $iCntCol, $iCurIndex
GUISetState(@SW_Show)

While 1
    $Msg = GUIGetMsg()
   ; Code below will check if the file is dropped (or selected)
    $sCurFilename = GUICtrlRead($hFile) 
    If $sCurFilename <> $sFilename Then
        $iStartIndex = 0
        $sFilename = $sCurFilename
    Endif
   ; Main "Select" statement that handles other events
    Select
        Case $Msg = $hFileSel
            $sTmpFile = FileOpenDialog("Select file:", "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}", "All folders (*.*)")
            If @error Then ContinueLoop
            GUICtrlSetData($hFile, $sTmpFile); GUI will be updated at next iteration
        Case $Msg = $GUI_EVENT_CLOSE
            Exit
    EndSelect
Wend
GUISetState(@SW_Show)

$count = 1

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $exit
            Exit
    Endselect
    If $msg = $ok then
            OpenMyPics()
            Do
                ResizePicture()
                $count = $count + 1
            Until $count > GUICtrlRead($Numpic)
            Exit
        Endif
Wend

    Func OpenMyPics()
        Send("#r")
        Sleep(500)
        Send("C:\Documents and Settings\test\My Documents\My Pictures\Resizing"); this part should ;change to the folder that was selected
        Send("{enter}")
        Send("{down}")
        Send("{up}")
    EndFunc
    
    Func ResizePicture()
        Send("{enter}")
        Sleep(1200) 
        Send("{alt}")
        Send("!is")
        Sleep(600)
        Send(GuiCtrlRead($Percent))
        Sleep(100)
        Send("{tab}")
        Send(GuiCtrlRead($Percent))
        Sleep(100)
        Send("{enter}")
        Sleep(500)
        Send("!fs")
        Send("{enter}")
        Sleep(100)
        Send("!fx")
        Sleep(500)
        Send("{down}")
    Endfunc

P.S. Thanks to YDY (Lazycat) for the stuff I have already... I learned some stuff off your "enumicons"

Any help would be appreciated once again, Piano_Man


My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites

Hey,

As Skruge said it sounds like FileSelectFolder is what your after.

$folderpath = FileSelectFolder("Choose a folder.", "")

im guessing you would replace your $sTmpFile var with that.

Cheers

Share this post


Link to post
Share on other sites

Hey,

As Skruge said it sounds like FileSelectFolder is what your after.

$folderpath = FileSelectFolder("Choose a folder.", "")

im guessing you would replace your $sTmpFile var with that.

Cheers

Ok, that worked. Sorry, I'm still learning how to use this stuff. Thanks for the help Skruge and fu2m8,

Piano_man


My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
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
Sign in to follow this  
Followers 0