' August 18 2011 File properties, Copyrighted by J. van Zijl aka Slowdown ' correction on August 23, wrong use of user,owner,group and other properties. ' If you like/use the code or part of the code please send me an e-mail ' Q7Basic for Windows? 7/Vista/XP ALPHA 22-June-2011 (32 bit) ' Also tested on OpenSuse 32 and 64 bit. ' You can find me on, ' http://www.q7basic.org/forum/index.php and ' http://www.kbasic.com/forum/index.php ' j.vanzijl@quicknet.nl Outlet SelectFileButton As QPushButton Outlet SelectDirectory As QPushButton Outlet EndProgram As QPushButton Outlet OperatingSystem As QLabel Outlet BaseName As QLabel Outlet Extension As QLabel Outlet NameAndPath As QLabel Outlet FileNameLab As QLabel Outlet FilePathLab As QLabel Outlet FileSizeBytes As QLabel Outlet DoesExist As QLabel Outlet DateTimeCreatedlab As QLabel Outlet DateTimeReadlab As QLabel Outlet DateTimeUpdatedlab As QLabel Outlet FileOwner As QLabel Outlet BelongsToGroup As QLabel Outlet IsFileHiddenlab As QLabel Outlet IsFileFilelab As QLabel Outlet IsFileDirectorylab As QLabel Outlet FileIsRelativelab As QLabel Outlet FileIsSymlinklab As QLabel Outlet ExeUserLab As QLabel Outlet ExeOwnerLab As QLabel Outlet ExeGroupLab As QLabel Outlet ExeOtherLab As QLabel Outlet ReadUserLab As QLabel Outlet ReadOwnerLab As QLabel Outlet ReadGroupLab As QLabel Outlet ReadOtherLab As QLabel Outlet WriteUserLab As QLabel Outlet WriteOwnerLab As QLabel Outlet WriteGroupLab As QLabel Outlet WriteOtherLab As QLabel Outlet WithNativeSeperators As QLabel Outlet WithoutNativeSeperators As QLabel Outlet SymLinkTarget As QLabel Dim SelectedFile As String Event Init() PresentOS() End Event Signal on_SelectDirectory_clicked(Checked As Boolean) SelectedFile = OpenFileDialog.GetDirectory2("Select directory", "//") NameAndPath.Text = SelectedFile DisplayProperties(SelectedFile) End Signal Signal on_SelectFileButton_clicked(Checked As Boolean) SelectedFile = OpenFileDialog.GetFile2("Select file", "//", "") NameAndPath.Text = SelectedFile DisplayProperties(SelectedFile) End Signal Sub DisplayProperties(MyFileName As String) Dim AllProperties As List Dim Counter As Int64 ExeUserLab.Text = "No." ExeOwnerLab.Text = "No." ExeGroupLab.Text = "No." ExeOtherLab.Text = "No." ReadUserLab.Text = "No." ReadOwnerLab.Text = "No." ReadGroupLab.Text = "No." ReadOtherLab.Text = "No." WriteUserLab.Text = "No." WriteOwnerLab.Text = "No." WriteGroupLab.Text = "No." WriteOtherLab.Text = "No." AllProperties = MyFileProperties.FileProperties(MyFileName) For Counter = 0 To AllProperties.Length - 1 Select Counter Case 0 BaseName.Text = AllProperties.Object(Counter) Case 1 Extension.Text = AllProperties.Object(Counter) Case 2 FileNameLab.Text = AllProperties.Object(Counter) Case 3 FilePathLab.Text = AllProperties.Object(Counter) Case 4 FileSizeBytes.Text = String(AllProperties.Object(Counter)) Case 5 If AllProperties.Object(Counter) = 0 Then DoesExist.Text = "No" Else DoesExist.Text = "Yes" End If Case 6 DateTimeCreatedlab.Text = AllProperties.Object(Counter) Case 7 DateTimeUpdatedlab.Text = AllProperties.Object(Counter) Case 8 DateTimeReadlab.Text = AllProperties.Object(Counter) Case 9 FileOwner.Text = AllProperties.Object(Counter) If Len(FileOwner.Text) < 1 Then FileOwner.Text = "N.A." End If Case 10 BelongsToGroup.Text = AllProperties.Object(Counter) If Len(BelongsToGroup.Text) < 1 Then BelongsToGroup.Text = "N.A." End If Case 11 IsFileHiddenlab.Text = "No" If AllProperties.Object(Counter) = 1 Then IsFileHiddenlab.Text = "Yes" End If Case 12 IsFileFilelab.Text = "No" If AllProperties.Object(Counter) = 1 Then IsFileFilelab.Text = "Yes" End If Case 13 IsFileDirectorylab.Text = "No" If AllProperties.Object(Counter) = 1 Then IsFileDirectorylab.Text = "Yes" End If Case 14 FileIsRelativelab.Text = "No" If AllProperties.Object(Counter) = 1 Then FileIsRelativelab.Text = "Yes" End If Case 15 FileIsSymlinklab.Text = "No" If AllProperties.Object(Counter) = 1 Then FileIsSymlinklab.Text = "Yes" End If Case 16 WithNativeSeperators.Text = AllProperties.Object(Counter) Case 17 WithoutNativeSeperators.Text = AllProperties.Object(Counter) Case 18 SymLinkTarget.Text = "File is not a symlink, no target known." If Len(AllProperties.Object(Counter)) > 0 Then SymLinkTarget.Text = AllProperties.Object(Counter) End If Case 19 If AllProperties.Object(Counter) = 1 Then ReadUserLab.Text = "Yes." End If Case 20 If AllProperties.Object(Counter) = 1 Then ReadOwnerLab.Text = "Yes." End If Case 21 If AllProperties.Object(Counter) = 1 Then ReadGroupLab.Text = "Yes." End If Case 22 If AllProperties.Object(Counter) = 1 Then ReadOtherLab.Text = "Yes." End If Case 23 If AllProperties.Object(Counter) = 1 Then WriteUserLab.Text = "Yes." End If Case 24 If AllProperties.Object(Counter) = 1 Then WriteOwnerLab.Text = "Yes." End If Case 25 If AllProperties.Object(Counter) = 1 Then WriteGroupLab.Text = "Yes." End If Case 26 If AllProperties.Object(Counter) = 1 Then WriteOtherLab.Text = "Yes." End If Case 27 If AllProperties.Object(Counter) = 1 Then ExeUserLab.Text = "Yes." End If Case 28 If AllProperties.Object(Counter) = 1 Then ExeOwnerLab.Text = "Yes." End If Case 29 If AllProperties.Object(Counter) = 1 Then ExeGroupLab.Text = "Yes." End If Case 30 If AllProperties.Object(Counter) = 1 Then ExeOtherLab.Text = "Yes." End If End Select Next MsgBox(AllProperties) End Sub Sub PresentOS() Dim OSName As String = "Windows" If OS.IsMac = True Then OSName = "OSX" End If If OS.IsLinux = True Then OSName = "Linux" End If OperatingSystem.Text = OSName End Sub Signal on_EndProgram_clicked(Checked As Boolean) Application.Quit End Signal