Sign in to follow this  
Followers 0
ileandros

_ArrayDisplay

10 posts in this topic

Hi,

I have this function:

Func TimeDate()
For $i = 1 To $aList[0]
 $sdate = FileGetTime($sRoot & "\" & $aList[$i], 0, 1)
 $ydate = StringMid($sdate,1,4)
 $mdate = StringMid($sdate,5,2)
 $ddate = StringMid($sdate,7,2)
 $htime = StringMid($sdate,9,2)
 $mtime = StringMid($sdate,11,2)
 $stime = StringMid($sdate,13,2)
    MsgBox(0, "Folder date", $sRoot & "\" & $aList[$i] & @CRLF & @CRLF & "Date: " & $ydate&"/"&$mdate&"/"&$ddate & @CRLF & @CRLF & "Time: " & $htime&":"&$mdate&":"&$stime)
Next
EndFunc

How can i display this msgbox in an Array???

I am getting the date of some files in the desktop and i want to display the date and time into an ArrayDisplay.

But i got no idea how to do it. I tried but it will take me like 3 day to find it out.

Any ideas??

P.s. I want to display all the files at once not one by one. I managed o display them one by one in arrays but it is the same as msgbox thats why i want to display them all at one.


I feel nothing.It feels great.

Share this post


Link to post
Share on other sites



Hi,

I have this function:

Func TimeDate()
For $i = 1 To $aList[0]
$sdate = FileGetTime($sRoot & "" & $aList[$i], 0, 1)
$ydate = StringMid($sdate,1,4)
$mdate = StringMid($sdate,5,2)
$ddate = StringMid($sdate,7,2)
$htime = StringMid($sdate,9,2)
$mtime = StringMid($sdate,11,2)
$stime = StringMid($sdate,13,2)
MsgBox(0, "Folder date", $sRoot & "" & $aList[$i] & @CRLF & @CRLF & "Date: " & $ydate&"/"&$mdate&"/"&$ddate & @CRLF & @CRLF & "Time: " & $htime&":"&$mdate&":"&$stime)
Next
EndFunc

How can i display this msgbox in an Array???

I am getting the date of some files in the desktop and i want to display the date and time into an ArrayDisplay.

But i got no idea how to do it. I tried but it will take me like 3 day to find it out.

Any ideas??

P.s. I want to display all the files at once not one by one. I managed o display them one by one in arrays but it is the same as msgbox thats why i want to display them all at one.

Post this code, and will probably become obvious to you as you do so.

If not someone will help you with the code you pose.


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

I changed it a bit. Here it is:

#include <File.au3>
#include <Array.au3>
$sRoot = @DesktopDir
Global $aList = _FileListToArray(@DesktopDir, "*", 2)
TimeDate()
Func TimeDate()
 Global $date[1]
 Global $time[3]
For $i = 1 To $aList[0]
 $sdate = FileGetTime($sRoot & "" & $aList[$i], 0, 1)
 $date[0] = StringMid($sdate,1,4) &"/"& StringMid($sdate,5,2) &"/"& StringMid($sdate,7,2)
 $time = StringMid($sdate,9,2) &":"& StringMid($sdate,11,2) &":"& StringMid($sdate,13,2)
 _ArrayDisplay($date)
Next
EndFunc

I feel nothing.It feels great.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I made a few minor changes for you.

I reused your existing array to display the dates.

If you needed to retain the filenames as well (very likely) then I've left a minor change or two for you to make.

#include <File.au3>
#include <Array.au3>

Global $aList = TimeDate(@DesktopDir)
_ArrayDisplay($aList)

Func TimeDate($sDir)
    Local $aIn = _FileListToArray($sDir, "*", 2)
    Local $aOut[$aIn[0] + 1][3] = [[$aIn[0]]]
    For $i = 1 To $aOut[0][0]
        $aOut[$i][0] = $aIn[$i]
        $aDT = FileGetTime($sDir & "" & $aIn[$i], 0)
        $aOut[$i][1] = $aDT[0] & "/" & $aDT[1] & "/" & $aDT[2]
        $aOut[$i][2] = $aDT[3] & ":" & $aDT[4] & ":" & $aDT[5]
    Next
    Return $aOut
EndFunc

edit: modified code

Edited by Spiff59

Share this post


Link to post
Share on other sites

Ok thanks. I made some small changes.

Is it possible to make the ArrayDisplay show at the first colone the names of the files ($sRoot), at the second colone the date and at the third colone the time??? Can i add name at the colones?

And most important can i work with these arrays??? Like delete chosen file from the ArrayDisplay or copy etc???


I feel nothing.It feels great.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

For the first part of your question, the Header column names, check out the last option Parameter in _ArrayDisplay ($sheader). You would separate the column names with a "|". You can also work with the arrays as long as you're in the function still, check out putting an _ArrayDelete(item number you want to delete) before your _ArrayDisplay.

Edited by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Spiff59

Good Shot my friend!

JLogan3o13 you got me wrong at the last part of the questions. I dont want to delete arrays from the ArrayDisplay list. I am asking if i can work on these array. Like i already said, delete some files, copy others etc. (FileDelete...) I got a gui and i want to add a button to delete these files.

I know other ways to do it for example if i display them in a list i know how to work on them but i am asking if i can work on them from the ArrayDisplay command.


I feel nothing.It feels great.

Share this post


Link to post
Share on other sites

If you are asking if you can perform actions on a gui that you are currently using to display

your array via the _ArrayDisplay() function, then the answer is no, it is currently blocking

your script from advancing.

I imagine you could from another script mind.


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Solved

Edited by ileandros

I feel nothing.It feels great.

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Solved

Edited by ileandros

I feel nothing.It feels great.

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