HELP !!! "The variable bundleData is not defined"

ADD
ADD
MODIFICATION of this post down at the end…
ADD
ADD

Hello Guys,

PLEASE HELP,

“I need geniuses”

Sorry about this… I’m not the expert at applescript… Just a “Advanced BEGGINNER” LOL… :slight_smile: I’m trying to keep smiling here…

I build this app with a college, but my college is in illness and won’t be back for a will…
The app at the end is a “GEM”

This app has been working very well since the last 3 years I Think.
But some of us got a new mac with the “OSX Yosemite” and Kaplunk…
It’s jammed… :frowning:
I was able to fix a few problems with no problem, but… :mad:

I’m stuck with the message error of “The variable bundleData is not defined”

I have no clue how to fix this…
I tried I think at leess 6 or 7 forums, but no luck…

This would be too long too copy the script, so it’s link to a shared dropbox… For the application and a pdf sample. So you can see the input and output.

https://www.dropbox.com/sh/4atrg74hcn397sn/AADTDY_gebQtK3GTE9VJ2t1Aa?dl=0

We have this script that we put a specifically build PDFs in a folder “[XYZ]” and drop that folder on the script.
and the script does the next action…

It takes the PDF (composed of 5 pages) and splits its in 3 sets of inner folders.
Folder 1 : Named “PDF originaux” in witch the app moves the originals pdf inside
Folder 2 : Named “PDF Pages” in witch the app splits the PDF LAST 4 pages in pdf format with title “[name on pdf]-page2.pdf” and “[name on pdf]-page3.pdf” and so forth… is result of 4 pdf files
Folder 3 : Named “Fichiers JPG” in witch the app exports the LAST 4 pages of the pdf separately in JPG format with title “[name of pdf]_B” and “_L”… and so forth, you will see in the sample.

You’ll see it the folder sample

Thank you ALL in advance for your HELP…
I’ll be very gracefull for your kindness of your knowledge

Thank’s again

P.S. Sorry for the French

Joel

Model: MacBook Pro (Retina, 15-inch, Mid 2014)
AppleScript: Version 2.7 (176) AppleScript 2.4
Browser: Safari 537.78.2
Operating System: Mac OS X (10.10)

MORE INFO

I was able to draw down to where it’s named…
It’s at the :


			set theCommand to "sips -M " & (quoted form of sRGBProfilePath) & " " & renderingIntent & " -s dpiHeight " & theDPI & " " & " -s dpiWidth " & theDPI & " -s format " & finalFileFormat & " -s formatOptions " & (item 5 of bundleData) & " -s copyright " & (quoted form of theCopyright) & " " & " " & " --resampleHeightWidth " & (item 4 of bundleData) & " " & (item 3 of bundleData) & " " & (quoted form of thePDFPath) & " --out '" & theDestinationPath & PDFnameOnly & (item 2 of bundleData) & "'"

This is where the script stops and tell me “The variable bundleData is not defined”

Thank’s again

Hi,

the code contains this portion


			repeat with i from 1 to number of items in bundleFormats
				if item i of bundleFormats contains PDFnameEnding then
					set bundleData to item i of bundleFormats
				end if
			end repeat


the repeat loop checks if the variable PDFnameEnding has the values “page2.pdf”, “page3.pdf”, “page4.pdf” or “page5.pdf”.
If there is no match then the variable bundleData will never be set.

Hello Stefan

Thanks for that but that part works OK…

And just a thought… The App works in OSX 10.9 and under very well !!!
But Not in Yosemite, that’s what I don’t understand… Any suggestion ?

It’s after that, where theComande runs…

this part is where it’s jam’ssss



set theCommand to "sips -M " & (quoted form of sRGBProfilePath) & " " & renderingIntent & " -s dpiHeight " & theDPI & " " & " -s dpiWidth " & theDPI & " -s format " & finalFileFormat & " -s formatOptions " & (item 5 of bundleData) & " -s copyright " & (quoted form of theCopyright) & " " & " " & " --resampleHeightWidth " & (item 4 of bundleData) & " " & (item 3 of bundleData) & " " & (quoted form of thePDFPath) & " --out '" & theDestinationPath & PDFnameOnly & (item 2 of bundleData) & "'"

			do shell script theCommand


Any suggestion ???

Thank’s again to anybody who can help me !!!

La réponse de Stefan était claire.
Je vais essayer de la reprendre en français.

Le problème que vous rencontrez frappe dans la boucle :

	repeat with i from 1 to number of items in pdfToConvert
			set thePDFFileToConvert to item i of pdfToConvert as alias
			set PDFFileNameAndExt to name of thePDFFileToConvert
			set oldDelim to AppleScript's text item delimiters
			set AppleScript's text item delimiters to "-"
			set PDFnameOnly to text item 1 of PDFFileNameAndExt
			set PDFnameEnding to text item 2 of PDFFileNameAndExt
			set AppleScript's text item delimiters to oldDelim
			-- Check what kind of banner ad it is a get the associated data
			set bundleData to false # ADDED
			repeat with i from 1 to number of items in bundleFormats
				if item i of bundleFormats contains PDFnameEnding then
					set bundleData to item i of bundleFormats
				end if
			end repeat
			if class of bundleData is boolean then # ADDED
				set aWarning to "Le fichier " & thePDFFileToConvert & " n'est pas conforme aux spécifications" # ADDED
				say aWarning # ADDED
				tell application "SystemUIServer" to display dialog aWarning # ADDED
				error number -128 # ADDED
			end if # ADDED
			-- Prepare the conversion
			set thePDFPath to POSIX path of thePDFFileToConvert
			set sRGBProfilePath to POSIX path of sRGBProfile
			set theDestinationPath to POSIX path of theSourceFolder
			set theCopyright to "©" & year of (current date) & " TC ¢ Media"
			set theCommand to "sips -M " & (quoted form of sRGBProfilePath) & " " & renderingIntent & " -s dpiHeight " & theDPI & " " & " -s dpiWidth " & theDPI & " -s format " & finalFileFormat & " -s formatOptions " & (item 5 of bundleData) & " -s copyright " & (quoted form of theCopyright) & " " & " " & " --resampleHeightWidth " & (item 4 of bundleData) & " " & (item 3 of bundleData) & " " & (quoted form of thePDFPath) & " --out '" & theDestinationPath & PDFnameOnly & (item 2 of bundleData) & "'"
			do shell script theCommand
		end repeat

J’ai ajouté sept instructions.
Lorsque vous exécutez l’original, la boucle courte :


repeat with i from 1 to number of items in bundleFormats
	if item i of bundleFormats contains PDFnameEnding then
		set bundleData to item i of bundleFormats
	end if
end repeat

ne trouvant pas de fichier doté des spécifications définies dans bundleFormats se termine sans avoir défini la variable bundleData et bien entendu l’e code sips avorte.
Avec le code modifié, lors du traitement du même fichier, le script vous indiquera précisément sur quel fichier il bute.

Ne travaillant pas avec inDesign et encore moins avec le workflow Automator employé, je ne peux être plus précis.
Je pense que lorsque vous aurez vu le message affiché par le script modifié, vous pourrez comprendre ce qui fait problème.

Yvan KOENIG (VALLAURIS, France) dimanche 31 mai 2015 10:01:07

Hy Yvan

Thanks for the info… But I’m still stuck…

What I don’t understand, is that I brought the app at home last night, in witch I have 10.10.3 at home.
And the App Runs fine… With no problem !!! I don’t get this… Why ?

Back At work :

(I place a screenshot-1 in the dropbox of the result and the folder to see where it’s at)
https://www.dropbox.com/sh/4atrg74hcn397sn/AADTDY_gebQtK3GTE9VJ2t1Aa?dl=0

Now it’s stop at this info with your new (ADDED) lines :

The pdf are split with the right names in the folders.

I’m starting to be a bit lost with all of this. But I try to stay optimist that I’ll get there one day…

Any one help me with this Problem ? The Dropbox links is this good with the app and all the samples files.

Still Thanks for anyone help !!!

I apologize but, with the given link, I don’t get anything resembling a screenshot.
I tried to apply the automator process embedded in bundleiser to a folder containing pdfs but I got this error message :

error “2015-06-01 15:33:20.473 automator[32067:2302780] -[AMApplicationRegistry loadDefinitionAtURL:]: No application name for definition at URL file:///Library/Automator/Office.definition/
2015-06-01 15:33:20.473 automator[32067:2302780] -[AMApplicationRegistry _loadDefinitionsAtURLS:]: Failed to load definition at URL file:///Library/Automator/Office.definition/
2015-06-01 15:33:20.572 Automator Runner[32068:2302806] -[AMApplicationRegistry loadDefinitionAtURL:]: No application name for definition at URL file:///Library/Automator/Office.definition/
2015-06-01 15:33:20.572 Automator Runner[32068:2302806] -[AMApplicationRegistry _loadDefinitionsAtURLS:]: Failed to load definition at URL file:///Library/Automator/Office.definition/
Automator n’a pas pu exécuter le processus car une ou plusieurs actions n’ont pas été chargées.” number 255

Double clicking the workflow returned the warning : L’action « PDF to Images » n’a pas pu se charger car elle est introuvable. Essayez de réinstaller l’action.

So, I have no idea of what are the created filenames resembling to.

May you post the name of the file which was reported in the display dialog ?

My understanding of the code let me think that the files are supposed to be named :

“page2.pdf-_L.jpg”
“page3.pdf-_B.jpg”
“page4.pdf-_M.jpg”
“page5.pdf-_S.jpg”

The fact that the script edited according to my proposal display a dialog means that there is no file with one of these names in the treated folder.

I’m a bit puzzled because an instruction preceding the offending code is :
set itemsToDelete to escapedPath & “*-page1.pdf” which let me think that the file names are built the reverse way :
_X.jpg-page1.pdf

Yvan KOENIG (VALLAURIS, France) lundi 1 juin 2015 16:10:21

Hi everyone…

Sorry for my absence, I was on sick leave for a while…

But I found the problem… Problem Solved…

It’s was the first pdf, that wasn’t deleted properly, the “page1.pdf-.jpg”
It’s in the unix command, and the user had a back slash in the name "" with cause all the problem in the first place.
Once that was fix, everything went well and the rest is ok… BUT…

And I figure out that the new system 10.10.3 does not inclue all the “automator action” from the previous version of OS.

But Still thank you to all for the support and help.

And Sorry again for my absence…

Thank you

Thanks for the feedback.

Yvan KOENIG running Yosemite 10.10.4 (VALLAURIS, France) lundi 13 juillet 2015 16:55:18