Jump to content

Need som help with FileSelectFolder


Recommended Posts

Hi, you can winmove to move that window to where you want, and you can use a udf like melba23's, that allows you to set the coordinates directly.

EDIT: on second thought, i think fileselectfolder stops the script, like winwait or msgbox, so winmove wouldn't be able to move the window, unless it's running in a loop outside of the function where select folder is.

Edited by careca
Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to post
Share on other sites
  • Moderators

careca,

As that function is blocking, how do you intend to move it from within the script? There is a way, but it is not that simple.

Borje,

As you might expect, I second the vote for my UDF.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to post
Share on other sites

Yeah, it blocks either way. :\

Maybe with AdlibRegister and checking for the window, and move it if exists..

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to post
Share on other sites
  • Moderators

Borje,

You cannot WinMove the FileSelectFolder dialog from within your script - at least not without getting into some very complicated /AutoIt3ExecuteScript stuff, which I would not recommend.

As both of us suggested, if you really want a controllable dialog in terms of position and size then take a look at my UDF - that is one of the reasons I wrote it!

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to post
Share on other sites

I had the impression your udf had a folder select like the regular one, instead of treeview.

TBH im not a big fan of treeview, is there something like the OP wants, that allows selection,

with the "normal" icon view, and window position customizable?

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to post
Share on other sites

This works for me
Based on a script from funkey (initially used to manage a msgbox)

#include <GUIConstantsEx.au3>
#include <WinAPI.au3>

Global $fsfX = 800
Global $fsfY = 200
Global $hHookFsF


$gui = GuiCreate("test", 200, 100)
$btn = GuiCtrlCreateButton("test", 50, 30, 50, 25)
GuiSetState()

While 1
   $msg = GuiGetMsg()
   Switch $msg
     Case $GUI_EVENT_CLOSE
         Exit
     Case $btn
         $sFileSelectFolder = _FileSelectFolder("test", "")
         If $sFileSelectFolder = "" Then
            MsgBox(0, "", "No folder was selected.")
         Else
            MsgBox(0, "", "You chose the following folder:" & @CRLF & $sFileSelectFolder)
         EndIf
   EndSwitch
Wend


Func _FileSelectFolder($dialog, $rootdir, $flag = 0, $initdir = "", $hwnd = 0)
   Local $hProcFsF = DllCallbackRegister("CbtHookProcFsF", "int", "int;int;int")
   Local $TIDFsF = _WinAPI_GetCurrentThreadId()
   $hHookFsF = _WinAPI_SetWindowsHookEx($WH_CBT, DllCallbackGetPtr($hProcFsF), 0, $TIDFsF)
   Local $iRet = FileSelectFolder($dialog, $rootdir, $flag, $initdir, $hwnd)
   _WinAPI_UnhookWindowsHookEx($hHookFsF)
   DllCallbackFree($hProcFsF)
   Return $iRet 
EndFunc

Func CbtHookProcFsF($nCode, $wParam, $lParam)
   Local $RET = 0
    If $nCode < 0 Then
        $RET = _WinAPI_CallNextHookEx($hHookFsF, $nCode, $wParam, $lParam)
        Return $RET
    EndIf
    Switch $nCode
        Case 5   ;5=HCBT_ACTIVATE
           If $wParam <> $gui Then _WinAPI_SetWindowPos($wParam, $HWND_TOP, $fsfX, $fsfY, _ 
            _WinAPI_GetWindowWidth($wParam), _WinAPI_GetWindowHeight($wParam), $SWP_NOZORDER)
    EndSwitch
    Return
EndFunc   ;==>CbtHookProcFsF

 

Edited by mikell
Link to post
Share on other sites

@Mikell
Looks like you made a typo.
$hHookFsF is use in function CbtHookProcFsF but not declared. It's declared in _FileSelectFolder as Local but needs to be Global. 

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Link to post
Share on other sites

I made a kind of a workaround, just for fun.

First part is a compiled exe that accepts parameters, called right before the fileselectfolder, and timeouts after 3 secs.

Local $begin = TimerInit()
Local $dif
Do
    $dif = TimerDiff($begin)
    If WinExists($CmdLine[1]) Then
    WinMove($CmdLine[1],$CmdLine[2], $CmdLine[3], $CmdLine[4], $CmdLine[5], $CmdLine[6])
    EndIf
    Sleep(100)
Until $dif >= 3000

Second is the script, that passes parameters, title, text, coordinates, size.

$Title = 'SelectTest'
$Text = '""'
$X = 500
$Y = 500
$XSize = 800
$YSize = 400
Go()
Func Go()
    ShellExecute('MoveDlg.exe', $Title&' '&$Text&' '&$X&' '&$Y&' '&$XSize&' '&$YSize)
    Local $Select = FileSelectFolder('SelectTest', '', 0, '')
    Exit
EndFunc

While 1
    Sleep(100)
WEnd

So if the user has the compiled script somewhere and calls it this way, with these parameters,

the window gets re-positioned and re-sized as desired.

To ignore the re-size its just a matter of replacing the number with '""' double quotes, inside quotes, can't have spaces.

:)

Edited by careca
Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to post
Share on other sites
  • Moderators

careca,

That is essentially the /AutoIt3ExecuteScript method I mentioned - you need to run something outside the main script, either compiled or as another script.

mikell,

Very clever.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...