Page 1 of 1 1
Topic Options
#181111 - 2007-10-04 12:04 AM GUIDialog UDF does not appear to return UNC path ?
MACE Offline
Starting to like KiXtart

Registered: 2004-09-07
Posts: 150
Loc: Manchester UK
The GUIdialog allows me to browse and locate a file using \\compname\shares but does not appear to be returning the string.
Debugs shows exit 1 is happening:- if not len($GUIDialog) exit 1 endif

It is crucial I get a unc path, can anyone help ?
Is there a .net equivalent ?

 Code:
Dim $L
  $L=GUIDialog("LOCATE 'PlayList.xml' file",$PADS,16386)
  If @error=0 and left($L,12)='PlayList.xml'
   if exist($L)
    $source=$L
   Else
    Quit
   Endif
  Endif


;FUNCTION	GUIDialog()
;
;AUTHOR	Lonkero
;
;ACTION		GUI for selecting folder/file/computer/printer...
;
;SYNTAX	GUIDialog(TITLE,[ROOT][,MODE])
;
;PARAMETERS
;		TITLE
;		 - Title to show in dialog
;		ROOT
;		 - Optional. Specifies the root of the Browse dialog box.
;		 The user cannot browse higher in the architecture than this folder.
;		 If this value is not specified, the root of the Browse dialog box is the desktop.
;		MODE
;		 - Optional. Changes the mode to show in dialog:
;		2	= Do not include network folders below the domain level in the dialog box's tree view control.
;		16	= Include an edit control in the browse dialog box that allows the user to type the name of an item.
;		4096	= Only return computers. If the user selects anything other than a computer, the OK button is grayed.
;		8192	= Only return printers. If the user selects anything other than a printer, the OK button is grayed.
;		16384	= The browse dialog box will display files as well as folders.
;
;RETURNS
;		the full path to folder, or error if user pressed cancel.
;
;DEPENDENCIES   Minimum operating systems: Windows 2000, Windows ME
;
;CODE
function GUIDialog($_title, optional $_root, optional $_mode)
 dim $
 $=createobject("shell.application")
 $GUIDialog=$.BrowseForFolder(0,$_title,0+$_mode,$_root).self.path
 if not len($GUIDialog) exit 1 endif
endfunction

Top
#181128 - 2007-10-04 09:37 PM Re: GUIDialog UDF does not appear to return UNC path ? [Re: MACE]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Browsing the network and selecting the Rolling Stones folder on the iTunes Music share on computer Voyager gives me "\\Voyager\iTunes Music\The Rolling Stones" (without the quotes) as a return value. I made one little change to the mode you use. I took of 2 and used 16384 instead of 16386. I also left out the $pads var. I guess this variable is getting filled earlier in the script. What does it hold? Does it actually contain what it should?

 Code:
Break on

$folder = GUIdialog("LOCATE 'PlayList.xml' file",,16384)
If @error
	"user pressed cancel"
Else
	?$folder
EndIf

Sleep 5

Function GUIDialog($_title, optional $_root, optional $_mode)
 Dim $
 $=CreateObject("shell.application")
 $GUIDialog=$.BrowseForFolder(0,$_title,0+$_mode,$_root).self.path
 If NOT Len($GUIDialog) Exit 1 EndIf
EndFunction
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#181131 - 2007-10-05 12:45 AM Re: GUIDialog UDF does not appear to return UNC path ? [Re: Mart]
MACE Offline
Starting to like KiXtart

Registered: 2004-09-07
Posts: 150
Loc: Manchester UK
I am trying to select a file in this case, not a folder.
Works fine with Folders but can't get it to return the path if a file is selected.

Top
#181135 - 2007-10-05 01:14 AM Re: GUIDialog UDF does not appear to return UNC path ? [Re: MACE]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
The file thing's been broken for a long time and Jooel won't fix it.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#181137 - 2007-10-05 02:30 AM Re: GUIDialog UDF does not appear to return UNC path ? [Re: Les]
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
If this is a KF application, you can use the built in windows Open File dialog.
_________________________
Today is the tomorrow you worried about yesterday.

Top
#181142 - 2007-10-05 03:07 AM Re: GUIDialog UDF does not appear to return UNC path ? [Re: Gargoyle]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
AFAIK GUIDialog() uses the built-in windows Open File dialog.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#181261 - 2007-10-08 01:07 AM Re: GUIDialog UDF does not appear to return UNC path ? [Re: Les]
MACE Offline
Starting to like KiXtart

Registered: 2004-09-07
Posts: 150
Loc: Manchester UK
Frankly I don't mind what I use as long as I can select a file and capture its path...

Someone point me to an alternative PLEASE. (Forms or .Net!)

Top
#181263 - 2007-10-08 02:05 AM Re: GUIDialog UDF does not appear to return UNC path ? [Re: MACE]
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
From some of my .Net forms
 Code:
$OF = $system.OpenFileDialog()
$OF.DefaultExt = "sav"
$OF.Filter = "Saved Prefs(*.sav)|*.sav"
$OF.InitialDirectory = $DefaultPath
$OF.Title = "Save Preferences"
$OF.AddExtension = "True"
$OF.RestoreDirectory = "True"
;Read the saved file and fill out the arrays accordingly
If $OF.ShowDialog = 1
	$Path = $OF.Filename
_________________________
Today is the tomorrow you worried about yesterday.

Top
#181265 - 2007-10-08 07:09 AM Re: GUIDialog UDF does not appear to return UNC path ? [Re: MACE]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: CA
Ninotech Path Copy 4.0

Not a scripting tool but actually a nice shell enhancement for copying various path types to the clipboard.

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 685 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.108 seconds in which 0.063 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org