mibuso.com

Microsoft Business Solutions online community
It is currently Thu Jun 20, 2013 6:45 am

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 28 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: Mon Nov 07, 2005 4:57 pm 
Offline

Joined: Fri Feb 28, 2003 5:53 pm
Posts: 276
Location: Dordrecht
Country: Netherlands (nl)
Its a shame, vbscripting does not allow API calls :cry: ](*,)

_________________
In a world without Borders or Fences, who needs Windows and Gates?


Top
 Profile E-mail  
 
 Post subject:
PostPosted: Tue Oct 17, 2006 2:21 pm 
Offline
MVP Microsoft Dynamics NAV
NAV TechDays 2013 attendee

Joined: Tue Jul 19, 2005 4:49 pm
Posts: 3891
Location: Olst
Country: Netherlands (nl)
This is a great solution. =D>

I've used it today and added the files to it.


Code: Select all
CREATE(FileSystemObject);
Folder := FileSystemObject.GetFolder('C:\Edi');
Folders := Folder.SubFolders();
CREATE(DictionaryFolders);
CREATE(DictionaryFiles);

CREATE(ScriptControl);
ScriptControl.Language := 'VBScript';

ScriptControl.AddObject('FoldersByName', Folders);
ScriptControl.AddObject('FoldersById', DictionaryFolders);

CrLf := ' ';
CrLf[1] := 13;
Script := 'dim f1' + CrLf +
          'For Each f1 in FoldersByName' + CrLf +
          ' FoldersById.Add (FoldersById.Count + 1), f1' + CrLf +
          'Next' + CrLf;

ScriptControl.ExecuteStatement(Script);

CLEAR(ScriptControl);

FOR i := 1 TO DictionaryFolders.Count() DO BEGIN
  Folder2 := DictionaryFolders.Item(i);
 
  Files := Folder2.Files;
 
  CREATE(ScriptControl);
  ScriptControl.Language := 'VBScript';

  ScriptControl.AddObject('FilesByName', Files);
  ScriptControl.AddObject('FilesById', DictionaryFiles);
  CrLf := ' ';
  CrLf[1] := 13;
  Script := 'dim f1' + CrLf +
            'For Each f1 in FilesByName' + CrLf +
            ' FilesById.Add (FilesById.Count + 1), f1' + CrLf +
            'Next' + CrLf;

  ScriptControl.ExecuteStatement(Script);

  CLEAR(ScriptControl);

  MESSAGE(Folder2.Name);
  MESSAGE(FORMAT(Files.Count));
 
  FOR n := 1 TO DictionaryFiles.Count DO BEGIN
    Fle := DictionaryFiles.Item(n);
    MESSAGE(Fle.Name);
  END;
END;


Variables:

Code: Select all
Name   DataType   Subtype   Length
FileSystemObject   Automation   'Windows Script Host Object Model'.FileSystemObject   
Folder   Automation   'Windows Script Host Object Model'.Folder   
Folder2   Automation   'Windows Script Host Object Model'.Folder   
Folders   Automation   'Windows Script Host Object Model'.Folders   
Fle   Automation   'Windows Script Host Object Model'.File   
Files   Automation   'Windows Script Host Object Model'.Files   
DictionaryFolders   Automation   'Microsoft Scripting Runtime'.Dictionary   
DictionaryFiles   Automation   'Microsoft Scripting Runtime'.Dictionary   
ScriptControl   Automation   'Microsoft Script Control 1.0'.ScriptControl   
Script   Text      250
CrLf   Text      2
i   Integer      
n   Integer      


I'll send it to the downloads also. :mrgreen:

_________________
Mark Brummel | Freelance Dynamics NAV (Navision) Developer
Author of the book : Microsoft Dynamics NAV 2009 Application Design

MY BLOG : http://www.brummelds.com


Top
 Profile E-mail WWW  
 
 Post subject:
PostPosted: Tue Oct 17, 2006 9:20 pm 
Offline
Moderator
MVP Microsoft Dynamics NAV
NAV TechDays 2013 attendee

Joined: Wed Jul 02, 2003 10:13 am
Posts: 7526
Location: Milan
Country: Italy (it)
Mark Brummel wrote:
I'll send it to the downloads also. :mrgreen:

I think it might already be somewhere. This is code I already used and I found it on Mibuso.
But I am not sure where it is.




Found it : It was a reply to a problem I had.... :oops: I need to install some more memory in my head! :mrgreen:
This is the link: http://www.mibuso.com/forum/viewtopic.php?t=7855

Maybe you can post some code that is usable for all kind of problems in the tips&tricks

_________________
Regards,Alain Krikilion
Use the SEARCH,Luke! || No PM,please use the forum. || May the <SOLVED>-attribute be in your title! || Read Forum Rules before making a posting


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 26, 2006 7:49 pm 
Offline

Joined: Mon Nov 07, 2005 8:55 pm
Posts: 43
Location: Los Angeles
Country: United States (us)
krikri
i had the same problem as well it turned out that i was getting the message for trying to "get" a non existing folder.

i hope this solves ur problem

_________________
Saro


Top
 Profile E-mail  
 
 Post subject:
PostPosted: Tue Aug 26, 2008 7:36 am 
Offline
Moderator
MVP Microsoft Dynamics NAV
NAV TechDays 2013 attendee

Joined: Wed Jul 02, 2003 10:13 am
Posts: 7526
Location: Milan
Country: Italy (it)
[Topic moved from Navision forum to Navision Tips & Tricks forum]

_________________
Regards,Alain Krikilion
Use the SEARCH,Luke! || No PM,please use the forum. || May the <SOLVED>-attribute be in your title! || Read Forum Rules before making a posting


Top
 Profile  
 
 Post subject: Re: Windows Script Host Object Model Folders and Files
PostPosted: Wed Jun 16, 2010 6:08 pm 
Offline
NAV TechDays 2013 attendee

Joined: Fri Sep 05, 2003 11:06 am
Posts: 706
Location: Bremen
Country: Germany (de)
I tried this out today, works fine for the classic client, but the same object when run with the RTC shows only a error message that the assembly dll file cannot be compiled due to invalid parameters.

_________________
Kai Kowalewski


Top
 Profile  
 
 Post subject: Re: Windows Script Host Object Model Folders and Files
PostPosted: Thu Sep 08, 2011 4:32 pm 
Offline

Joined: Mon Dec 20, 2010 10:25 am
Posts: 531
Location: Bergamo
Country: Italy (it)
Kowa wrote:
I tried this out today, works fine for the classic client, but the same object when run with the RTC shows only a error message that the assembly dll file cannot be compiled due to invalid parameters.


I have the same problem... :(

_________________
~Rik~
It works as expected... More or Less...


Top
 Profile E-mail  
 
 Post subject: Re: Windows Script Host Object Model Folders and Files
PostPosted: Fri Sep 09, 2011 9:16 am 
Offline
Moderator
MVP Microsoft Dynamics NAV
NAV TechDays 2013 attendee

Joined: Wed Jul 02, 2003 10:13 am
Posts: 7526
Location: Milan
Country: Italy (it)
Just a wild guess:Try to experiment with the parameters of the CREATE-command. With the introduction of RTC, it got some boolean parameters.

_________________
Regards,Alain Krikilion
Use the SEARCH,Luke! || No PM,please use the forum. || May the <SOLVED>-attribute be in your title! || Read Forum Rules before making a posting


Top
 Profile  
 
 Post subject: Re: Windows Script Host Object Model Folders and Files
PostPosted: Fri Sep 09, 2011 9:20 am 
Offline

Joined: Mon Dec 20, 2010 10:25 am
Posts: 531
Location: Bergamo
Country: Italy (it)
kriki wrote:
Just a wild guess:Try to experiment with the parameters of the CREATE-command. With the introduction of RTC, it got some boolean parameters.

Hi kriki, unfortunately I've already tried setting parameters for creating on client and for new server but no luck...

_________________
~Rik~
It works as expected... More or Less...


Top
 Profile E-mail  
 
 Post subject: Re: Windows Script Host Object Model Folders and Files
PostPosted: Fri Sep 09, 2011 6:07 pm 
Offline
Moderator
MVP Microsoft Dynamics NAV
NAV TechDays 2013 attendee

Joined: Wed Jul 02, 2003 10:13 am
Posts: 7526
Location: Milan
Country: Italy (it)
If you are using 2009R2, search for a .NET alternative.

_________________
Regards,Alain Krikilion
Use the SEARCH,Luke! || No PM,please use the forum. || May the <SOLVED>-attribute be in your title! || Read Forum Rules before making a posting


Top
 Profile  
 
 Post subject: Re: Windows Script Host Object Model Folders and Files
PostPosted: Fri Sep 09, 2011 6:10 pm 
Offline

Joined: Mon Dec 20, 2010 10:25 am
Posts: 531
Location: Bergamo
Country: Italy (it)
kriki wrote:
If you are using 2009R2, search for a .NET alternative.

Thx for suggestion... I'll let you know If I find something.

_________________
~Rik~
It works as expected... More or Less...


Top
 Profile E-mail  
 
 Post subject: Re: Windows Script Host Object Model Folders and Files
PostPosted: Mon Nov 28, 2011 4:48 pm 
Offline

Joined: Mon Dec 20, 2010 10:25 am
Posts: 531
Location: Bergamo
Country: Italy (it)
kriki wrote:
If you are using 2009R2, search for a .NET alternative.

I found this link very usefull, it solved my problems:
http://blogs.msdn.com/b/nav/archive/201 ... 09-r2.aspx

_________________
~Rik~
It works as expected... More or Less...


Top
 Profile E-mail  
 
 Post subject: Use Microsoft Shell Controls And Automation to list Files an
PostPosted: Wed Mar 14, 2012 5:16 pm 
Offline

Joined: Fri Oct 28, 2011 2:57 pm
Posts: 3
Country: Ukraine (ua)
Code: Select all
DataType   Name   Subtype   Length
Automation   MS_Shell   'Microsoft Shell Controls And Automation'.Shell   
Automation   MS_Folder   'Microsoft Shell Controls And Automation'.Folder3   
Automation   MS_FolderItems   'Microsoft Shell Controls And Automation'.FolderItems3   
Automation   MS_FolderItem   'Microsoft Shell Controls And Automation'.FolderItem

CREATE(MS_Shell, TRUE);
MS_Folder := MS_Shell.BrowseForFolder(0, 'Select The Folder', 0);
IF NOT ISCLEAR( MS_Folder ) THEN
  SelectedFolder := FORMAT(MS_Folder.Self.Path);

IF SelectedFolder = '' THEN EXIT;

MS_FolderItems := MS_Folder.Items;

IF NOT ISCLEAR( MS_FolderItems ) THEN
  FOR I := 1 TO MS_FolderItems.Count DO BEGIN
    MS_FolderItem := MS_FolderItems.Item(I);
    IF NOT ISCLEAR( MS_FolderItem ) THEN BEGIN
      MESSAGE(MS_FolderItem.Path);
      MESSAGE(MS_FolderItem.Name);
      MESSAGE(MS_FolderItem.Type);
      MESSAGE('%1', MS_FolderItem.IsFolder);
      CLEAR( MS_FolderItem );
    END;
  END;

CLEAR( MS_FolderItem );
CLEAR( MS_FolderItems );
CLEAR( MS_Folder );
CLEAR( MS_Shell );   


Top
 Profile E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 28 posts ]  Go to page Previous  1, 2

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum


Search for:
Jump to: