rename function does not work as executable

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

worldwide
Junior Coder
Posts: 31
Joined: Mon Jul 09, 2007 11:34 am

rename function does not work as executable

Post by worldwide » Wed Jul 25, 2007 10:59 am

Hello,

im trying to rename a file, this works if i just do it with MS, but the time i compile it as a exe-file it does not work ?????

I cecked here the forum but it seems that im the only one who is having this problem, or not ?

Best

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Wed Jul 25, 2007 11:40 am

There's no difference in the way compiled scripts are executed compared to how non compiled scripts are executed. I have no problem with RenameFile in an EXE.

Do you have the correct version of the compiler? Compile this script, run it and tell us what the message says:

MessageModal>MSCHED_VER

If I recall RenameFile is a recent addition, so if your compiler is out of date it will do nothing.

What happens if you do this instead:

Let>MF_RENAME=1
MoveFile>source,dest
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

worldwide
Junior Coder
Posts: 31
Joined: Mon Jul 09, 2007 11:34 am

Post by worldwide » Wed Jul 25, 2007 11:52 am

MessageModal>MSCHED_VER : 9.0.047

And thats also what i tried :

Let>MF_RENAME=1
Let>oldfile=C:\directory\XREF.DAT
Let>newfile2=C:\XREF.DAT
MoveFile>oldfile,newfile2
MessageModal>newfile2

If i run this within MS it does work, if i make an exe it does not work :-(

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Wed Jul 25, 2007 12:27 pm

That's not a rename, it's a move. So you should be using:

Let>oldfile=C:\directory\XREF.DAT
Let>newlocation=C:\
MoveFile>oldfile,newlocation
MessageModal>newfile2

Does c:\xref.dat already exist?

Which operating system are you running? Are you a regular user or an administrator? Only admins should have permission to create files in the c:\ root directory.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

worldwide
Junior Coder
Posts: 31
Joined: Mon Jul 09, 2007 11:34 am

Post by worldwide » Wed Jul 25, 2007 1:02 pm

Yes your right, sorry.

I checked your code and it works.
Theres no file at C:

Im running windows2000 SP4 and im adminstrator.


Am i missing here something ? Or do i something wrong ?

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Wed Jul 25, 2007 1:13 pm

worldwide wrote:Yes your right, sorry.

I checked your code and it works.
Great
Am i missing here something ? Or do i something wrong ?
Wait a minute - it works or it doesn't work? Which is it?
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

worldwide
Junior Coder
Posts: 31
Joined: Mon Jul 09, 2007 11:34 am

Post by worldwide » Wed Jul 25, 2007 1:24 pm

Yes it works, the code you wrote.

I just asked also myself if i did something wrong in my previous program i wrote earlier, thats what i ment....sorry i didnt want to get confused overhere

smile

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Wed Jul 25, 2007 1:26 pm

Yes, you said you were doing a rename, but you actually wanted to move a file to a different location.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

worldwide
Junior Coder
Posts: 31
Joined: Mon Jul 09, 2007 11:34 am

Post by worldwide » Wed Jul 25, 2007 1:31 pm

:D Ok, ill start again :-)

Heres my code, this one is only working as MS, the time ill make an exe-file from it it doesnt work :
---------------------
---------------------

Let>oldfile=C:\directory\XREF.DAT
ReadLn>oldfile,3,text
MidStr>text,69,11,show
Let>rest=show
MessageModal>show
Position>\,rest,1,start
Let>start=start+1
Length>rest,lf
MidStr>rest,start,lf,temp
Position>.,temp,1,end
Let>end=end-1
MidStr>temp,1,end,midPart
Let>newfile=%midPart%
Let>newfile2=C:\directory\XREF_1_%newfile%.DAT
RenameFile>oldfile,newfile2

------------------------
------------------------

best

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Wed Jul 25, 2007 1:36 pm

Send a copy of XREF.DAT so that we can attempt to debug.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

worldwide
Junior Coder
Posts: 31
Joined: Mon Jul 09, 2007 11:34 am

Post by worldwide » Wed Jul 25, 2007 1:43 pm

sorry i sended a PM, where can i send that file to ?

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Wed Jul 25, 2007 1:44 pm

Surely it's a text file? Can't you paste it here? If you'd rather, send it to support AT mjtnet.com
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

worldwide
Junior Coder
Posts: 31
Joined: Mon Jul 09, 2007 11:34 am

Post by worldwide » Wed Jul 25, 2007 1:45 pm

,,,Patient Record,,,,,,,,,,,,,,,Corneal Statistics,,,,,,,,,,,,,,,Fourier Index Standard,,,,,,,Eccentricity,
File REF.,Last Name,First Name,Exam#,ID,Date&Time,Eye,Filename,SimK1,SimK1 Ang.,SimK2,SimK2 Ang.,MinK,MinK Ang.,CYL,ACP,SRI,SAI,CEI,SDP,DSI,OSI,CSI,KCI,IAI,AA,EDP,EDD,3mm Spherical Equ.,3mm Reg. Astig.,3mm Reg. Astig. Axis,3mm Asymmetry,3mm Asymmetry Axis,3mm Higher order irregularity,6mm Spherical Equ.,6mm Reg. Astig.,6mm Reg. Astig. Axis,6mm Asymmetry,6mm Asymmetry Axis,6mm Higher order irregularity,Es,Em
1,XXXXXXX,XXXXXXXXX,1,,11.05.1999 11:41:52,OD,C:\xxxxx\xxx\xxxxxxxx\I019705.TMS,52.99,77,48.76,167,48.73,169,4.23,49.35,1.75,2.61,0.85,4.10,12.45,9.74,4.07,1.00,0.67,0.63,3.72,4.19,51.51,2.41,77.26,2.56,212.27,0.53,49.43,1.60,77.09,4.04,218.08,0.51, 0.72, 0.95

This is what in the file is, so just normal txt

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Wed Jul 25, 2007 1:50 pm

Ok, your script works perfectly for me, whether compiled or not. Does the same thing as an EXE as it does in script. Which is what I would expect since the interpretor is identical.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

worldwide
Junior Coder
Posts: 31
Joined: Mon Jul 09, 2007 11:34 am

Post by worldwide » Wed Jul 25, 2007 1:53 pm

well i have no clue now.
It works if its not compiled.

I have to check it out again tomorrow, as far as i checked it today the movefile works, copyfile i dont know, renamefile does not work....
Ill do some testings tomorrow

ill post my results then..... hope i find a way.....

Thanx for your support buy the way !!! Hope ill can count on it also tomorrow ;-)

c.u. im now going home :-)

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts