Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Move Files with dates for names
#1
Ok...I work at a radio station.
Every Sunday I do the same things over and over again. I have been having really good luck automating my entire shift with quickmacros. It's pretty sweet to go in, hit my trigger, and then kick back and get to important stuff like making mixed tapes for my girlfriend.

In my macro I need to move five files from a folder to the desktop and then run a program that will process their format and put them into another folder. From there I pick the files up with the automation program. The network is nice enough to name the files by the date they need to air.

I've gotten the macro built up to spit out the variables for the next five days with a systemdatepicker32 dialog. Is there anyway to use a user defined variable to grab the right files?

I know I could move all of these files to the desktop by using ren "c:\a\b\*.*" "c:\desktop\" kind of deal.

The first part of the code does what i need it to:

Code:
Copy      Help
int iMonth iDay iYear di
if(!ShowDialog("date_picker" &date_picker)) ret
di=-1
rep 5
,SYSTEMTIME- t_st1
,DATE d.fromsystemtime(t_st1)
,di+1
,d=d+di
,SYSTEMTIME mon
,d.tosystemtime(mon)
,iMonth = mon.wMonth
,iDay = mon.wDay
,iYear = mon.wYear
,ren "C:\Documents and Settings\thevig\Desktop\program\*(iMonth)-(iDay)-(iYear).txt" "C:\Documents and Settings\thevig\Desktop"

It would just be the last line that I need to know what to do....I don't know how to input the variables into the ren command.

Also, how do I get wDay and wMonth to format with a "0" if they are <10?
I wrote this for one part of my code that needs the variables keyed in not pasted. It works fine there...but the file names will have a zero, and I have a feeling this is going to be a problem.

Code:
Copy      Help
SYSTEMTIME- t_st1 MonMonth MonDay MonYear
DATE d.fromsystemtime(t_st1)
SYSTEMTIME mon
d.tosystemtime(mon)

int iMonth iDay iYear
str sMonth sDay sYear

sMonth = mon.wMonth
iMonth = mon.wMonth
if iMonth < 10
,key 0
,key (sMonth)
else key (sMonth)
sDay = mon.wDay
iDay = mon.wDay
if iDay < 10
,key 0
,key (sDay)
else key (sDay)
sYear = mon.wYear
key (sYear)


Well...That's about everything except for the dialog...so here that is:
Code:
Copy      Help
;/Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
def DTM_FIRST 0x1000
def DTM_GETSYSTEMTIME (DTM_FIRST + 1)
def DTM_SETSYSTEMTIME (DTM_FIRST + 2)

if(!ShowDialog("date_picker" &date_picker 0)) ret

;BEGIN DIALOG
;0 "" 0xA0BEE 0x40008 0 0 172 76 "New Student Form"
;3 SysDateTimePick32 0x54000000 0x204 12 18 90 12 "StartDate"
;6 Static 0x50000000 0xA0 114 18 48 12 "Start Date"
;1 Button 0x54030001 0x0 108 36 48 14 "OK"
;END DIALOG
;DIALOG EDITOR: "" 0x2020105 "*" "" ""


ret
;messages
SYSTEMTIME- t_st1
sel message
,case WM_INITDIALOG
,DT_Init(hDlg lParam)
,ret 1
,case WM_DESTROY DT_DeleteData(hDlg)
,case WM_COMMAND goto messages2
ret
;messages2
int ctrlid=wParam&0xFFFF; message=wParam>>16
sel wParam
,case IDOK
,DT_Ok hDlg
,SendMessage(id(3 hDlg) DTM_GETSYSTEMTIME 0 &t_st1)
,case IDCANCEL DT_Cancel hDlg
ret 1

Thanks.
#2
str.format is a very useful function. You can use the Text dialog to create the code.

Code:
Copy      Help
str sf.format("$desktop$\program\*(%02i)-(%02i)-(%02i).txt" iMonth iDay iYear)
;out sf
ren sf "$desktop$"
#3
Thanks.

I'll give it a try.


Forum Jump:


Users browsing this thread: 1 Guest(s)