Well, I finally am in that office where i can test this script.
Same problem I had at home though…same message at the same place.
I put a folder of files to test. Inside that folder, I have a folder named mechanicals and a folder named temp. I choose the temp one after the second dialog message. But, I still get the following message??
Can’t get items 1 thru 10 pf “Macserver:babs:Student Projects and Files:Marketing_Dept:for Ji:10-pp-6:temp”.
Hello
This is just an attempt which I’m not sure will work but try it an keep it in the script anyway. First Item
Insert it right after the local statement in the Run handler.
set AppleScript's text item delimiters to ""
Second Item
In order for this script to work:
Use this as your initial path: “Macserver:babs:Student Projects and Files:Marketing_Dept:”
Then create a folder named “Outoor_TEST” or similar below that Marketing_Dept folder
Then create a folder named “Mechanicals” for instance below that “Outdoor_TEST” folder
Then create a folder named “2010” or for another year
Then copy or move the folder “Macserver:babs:Student Projects and Files:Marketing_Dept:for Ji:10-pp-6:”
into the 2010 folder
You should now have a structure like this: “Macserver:babs:Student Projects and Files:Marketing_Dept:Outoor_TEST:Mechanicals:2010:10-pp-6:”
The files in that folder must be named as you specified in your first posts.
You have to have the right number of folders in order to simulate the real structure of your file hierarchy as you specified in your first posts. For now we have also ruled out any encounters of “wrong” text item delimiters somewhere in the script.
For the file hierarchy you are working on is like Some_intial_path:Outdoor:mechanicals:2010:10-pp-1: and so on,
maybe with other folders than Outdoor and mechanicals and 2010 but the “job folder” will always be at this level?
I found 2 bugs which are now squashed, one which you never were able to see
I have changed the code in post #12
It was the Existing Folder property at the top of the script which hadn’t been updated, that caused the correct
folder to not be recognized as such.
You should still choose Macserver:babs:Student Projects and Files:Marketing_Dept as the initial path.
When you are going to actually use the code on the real server then we must edit the code to reflect the correct name of the Outdoor folder.
FYI. The second now squashed bug, which didn’t show up until now was a variable not declared as a local one in the stemName subroutine, I don’t really understand why it didn’t show up before. -The only reason I can see is that I have run the code through Script Debugger.
I have also added a temporary dialog at the end of the script while we are testing in order to be confident that the
script has done its job.
Here we may later on add the functionality of opening the first new file, - or all of them for that sake into Quark Express automagically
Ok-I compiled the new script…and added that line again:
set AppleScript’s text item delimiters to “”
when the first choose folder comes up (select the parent folder of folder Outdoor), I choose Outdoor_TEST
for the second folder request-select the folder which you will use as a template, no matter what I choose, Marketing_Dept, or Outdoor (which lives in Outdoor_TEST), or Mechanicals or any other folder, it still dosn’t want to get past that applescript error that says: "can’t get text items 1 thru 9) etc…
Weird…I think we were closer before…since this is the earlier error.
maybe I am not picking the right folder still for the second request?
Also, when you say "
You should still choose Macserver:babs:Student Projects and Files:Marketing_Dept as the initial path." Is that something I should be able to choose at some point in the script, or, do I need to put that somewhere in the script? maybe that is what I am doing wrong…
The code was being updated when you downloaded it.
I am now to update it with the AppleScript’s text item delimiters line so that you won’t have to do it again.
The correct folder to choose as the initial folder would be the parent folder of Outdoor_TEST which would be Macserver:babs:Student Projects and Files:Marketing_Dept. I’m sorry for your inconvenience please try again.
OK-I took the new script…FYI-I did have to add the word set before the added line (set AppleScript’s text item deliminator)…then it compiled…
I did choose the Marketing_Dept folder which is the parent to Outdoor_TEST, and that goes fine, it’s the second folder it keeps asking me for, that template one, that doesn’t seem to like any folder I choose.
And please, this is all a learning process for me, I am not under any gun here, so I have all the patience in the world for this…I cannot tell you how much I appreciate all your time and effort…so please, no apologies, I know this is a process, and this is a tough one to try and conquer…so thanks…I’m sure we (OK, you) will figure it out
Hello
It should really have liked the folder: Macserver:babs:Student Projects and Files:Marketing_Dept:Outdoor_TEST:Mechanicals:2010:10-pp-6 or any folder below, but it should then choose the 10-pp-6 folder for you.
Could you please enter any error message if any when you choose this folder?
I’ll come back to you tomorrow and we will continue until we have sorted this out.
Glad to hear that.
Please show me the odd numbers tomorrow.
And you can experiment a bit as well with having the front most Finder window open in some folder below the inital path (the path including “marketing”) you should then be asked to specify a folder to use from that path.
Or If you had some document open in some app (f.ex a picture open in Preview ) from within any folder beneath that initial path then you’ll be asked to use the folder that picture is in as a template folder for a new job.
The original folder is called: 10-PP-6 and should have created a folder that would add one more to the last number, so the folder should have been named 10-PP-7. What it created, was a folder named 10-PP-02
For the files inside the folder: the originals were named: 10-PP-6#1 and 10-PP-6#2 - the new files created in the new folder should have been named 10-PP-7#1 and 10-PP-7#1, but right now, are keeping the same name.
So, that’s the challenge here
Whenever you get a chance let me know if you come up with anything…
thanks
babs
The first thing we are dealing with here, is that I have written the code as it would be used during Production and not as it would be used during testing. The script - and I! both live in the assumption that job numbers are always subsequent: You start with job nr 01 and continues up to 06 for instance. so that normally there would have been
interspersed folder from 01 to 06 and the new folder would have been given the new name 07
If your job numbers aren’t strictly subsequent please tell me.
In order to gain some progress what testing concerns I recommend that you delete the 06 folder and replace with with an 01 folder.
Then we shall see if the files are named correctly or not. Edit: I have retested the script, and it seems to me like the reason for the errant behavior regarding giving the file new names might that we don’t have enough rights at the moment.
If my guess is right there should now be displayed an error message (several times) during the rename of files process.
I hope you will supply me with the error codes during the day.
A few seconds after this post i will update the code.
I am sorry…I sent you a message, but I guess it didn’t go to you? I thought I posted something like this earlier…I don’t know what happened… ;-(
I cannot seem to get any of your private emails…I can read them, but when I log in here, they don’t exist?
I think at one time I had 2 logins…anyway., I am sorry you didn’t get my earlier email/post…
here is what was happening…
1-the numbers will NOT be sequential as you asked…they are pick ups of other jobs and they use different lettering systems. The only thing that is consistent is the hyphens…It will always be something like this:
A number(s) (2 or 12) then a hyphen(-), then some letter(s) ( PP or M), then a hyphen(-) and then the number(s) (6 or 12).
10-PP-12
It is getting 1 added to the last number regardless of the rest of the name that we need to change when it makes that new folder.
For the files inside the folder, it is trickier, because after the number changes, we need to add 1 to these as well but they have this at the end of each name: #1 or #2, so, it’s not really the last number in this case.
10-PP-12#1
10-PP-12#2
Right now, your new script does compile and run successfully, no errors as you anticipated. It still makes the new folder and still makes it 02 at the end and it does duplicate the files inside, but keeps the names the same.
Again, so sorry, I thought I posted this earlier…On the days I am teaching on site, I very few breaks …thanks for your patience!!!
babs
I have read your post, and will be back later with an update when I have adjusted the script to cope with real situation, not what I have anticipated.
I’m not totally sure what is going wrong when numbering the files, so I will instrument the script with some tests
which writes to a log file, which then will be opened in TextEdit It would be great if you post the contents of that file.
I have now done some changes to the code, there is however one problem remaining, and that is why I can’t rename the files in the folder, I have some ideas why it is so, but I am not totally sure.
I hope to find that out by having you running this new code and reporting back to me the error messages that hopefully showed up.
Important Question:
Knowing this might never happen but still:
What if you use say 10-pp-56 for one job, and you then elect to use the same job again as a template for a new job?
Do you agree with me that it then would be natural to allocate the next higher number, for instance 58 in place of 57 which is already taken?
You couldn’t answer when I sat here and asked, so I took that for a yes… If you have any scruples with that: don’t hesitate to tell me, and I’ll change it.
What if the date turn in to january 2011?
Say you had this 10-PP-87 folder which you wanted to use as a template for the New Years first job.
Would you find it natural to give it the number 11-PP-1 or 11-PP-88
-I have guessed you would go for 1.
I have done the following with the code in order to have it work properly for you:
It will now create a folder properly with the next higher consecutive job number.
If that next higher number is already taken, then it will find the first higher number that is free.
I do not put a leading zero in front of a folder number not containing two digits.
The code look lousier than every, but I don’t see the point of rearranging it before we are confident that it
does what it is supposed to do.
I have now instrumented the code in the post above in order to find out what really goes wrong with the renaming of files.
Just one thought that struck me, and that is that I have presumed all along the way that the files in the folders follows the naming conventions of the
folder that is:
if the folder was named 10-PP-87
then the files in that folder would be given names like 10-PP-87#1 and so forth.
Can you confirim that it is so?
Run the code even if my presumptions is wrong, then at least we get verified that the logger could works, ( it really should) on your machine.
The logger should hopefull make textEdit open a window with somthing like this in it
when you have run the script:
About to rename files in the folder.
Found files in the folder
Found a QXD file in the folder IN in the folder :08-Z-PP-6#1.txt
Renamed the file :08-Z-PP-6#1.txt to : 10-Z-PP-2#1.txt
Found a QXD file in the folder IN in the folder :08-Z-PP-6#2.txt
Renamed the file :08-Z-PP-6#2.txt to : 10-Z-PP-2#2.txt
Found a QXD file in the folder IN in the folder :08-Z-PP-6#3.txt
Renamed the file :08-Z-PP-6#3.txt to : 10-Z-PP-2#3.txt
Found a QXD file in the folder IN in the folder :08-Z-PP-6#4.txt
Renamed the file :08-Z-PP-6#4.txt to : 10-Z-PP-2#4.txt
Found a QXD file in the folder IN in the folder :08-Z-PP-6#5.txt
Renamed the file :08-Z-PP-6#5.txt to : 10-Z-PP-2#5.txt
OK, I think I might know what the problem is based on the message in text edit:
maybe they are not being seen as .qxd and we have to find away to let the script know that they are? This way it changes the 6 to a 7 like it did the folder name.
so, regarding your question:
That is correct, so when the new folder is created, it would be named 10-PP-88 and the files would be renamed 10-PP-88#1 and so forth. Sometimes there may be just a few, sometimes it can go as high as 50 files in that folder.
Take a look when you can and let me know if that makes sense
thanks!!
babs
OK-Yes, that line of code is within a very large run handler…here is where it resides in that area…
When I select a quark file in that folder and run the script in number 18, it returns nothing…I ran the script with a few other files, like a pdf and it returned pdf, a jpg and it returned jpg etc…but for some reason, it doesn’t know what these files are???