• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Can I ask for help on this, please?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Can I ask for help on this, please?


  • Subject: Can I ask for help on this, please?
  • From: Brian Christmas <email@hidden>
  • Date: Sun, 06 Mar 2016 08:05:07 +1100

G’day scripters

I’ve got an ASObjC Xcode project, that uses several separate scripts because of the overall size.

I’m trying to pass a number variable from one script to another via .dat files.

In my main script, I’m setting the Property (which is bound to a stepper), like so

property maxBarcodeCharacters : 40 as number # I’ve tried just as ’40’


I’m then creating a .dat file (shown with extras removed) so…


set temp to { my maxBarcodeCharacters} # I’ve tried ‘as number’, which errors, & ‘} as list'

set theFileName to ((path to desktop) & "Mail Manager Item Printer Variables.dat" as text)
set p to 4
tell application "System Events"
try
set fRef to (open for access file theFileName with write permission)
set eof fRef to 0
write "" to fRef with replacing
write temp to fRef
close access fRef
on error
try
close access fRef
end try
end try
end tell



Then, I’m opening the second script, and reading the file, like so…


property maxBarcodeCharacters : 40 as number # I’ve tried just as ’40’


set theFileName to ((path to desktop) & "Mail Manager Item Printer Variables.dat" as text)
try
tell application "Finder" to set temp to read file (theFileName) as list
set {my maxBarcodeCharacters} to temp 


However, when I come to use  the property in a handler, I get an error, and the property acts like it does not exist. I’ve checked and double checked the whole of the actual write and read list, and they’re in order, and have the same number of entries.


set theNewString to my resetTheFileName(The_String1, maxBarcodeCharacters)


on resetTheFileName(theText, tempMaxLength)
local tempLength, tempMaxLength, theWords
try
set p to 0
try
tell current application to say tempMaxLength # this does not work
end try
try
tell current application
activate
display dialog tempMaxLength # This does not display, even with an 'as text' added.
end tell
end try
set p to 1
copy theText to theWords
set p to 2
set tempLength to (count of theWords)
set p to 2.1
if tempLength > tempMaxLength then set theWords to (items 1 through tempMaxLength of theWords) as text
set p to 3
set theModulusCharacter to my setUpTextCount(theWords)
set p to 4
set theNewFileBarcode to (character id 209) & theWords & (character id theModulusCharacter) & (character id 211) as text
set p to 5
return theNewFileBarcode
on error errmsg
set my didItPrint to false
tell current application
activate
display dialog "Error in resetTheFileName " & errmsg & " p = " & p as text giving up after 10
end tell
set theWords to "Error in Barcode setting"
set theModulusCharacter to my setUpTextCount(theWords)
set p to 4
set theNewFileBarcode to (character id 209) & theWords & (character id theModulusCharacter) & (character id 211) as text
return theNewFileBarcode
end try
end resetTheFileName


The error I get is…

Error in resetTheFileName Can’t make «class ocid» id «data optr000000003728000000000000» of application "Finder" into type number. p = 2.1

I’ve tried every permutation I can think of, with no success. There’s obviously something going on I simply don’t understand.

Can someone fill me in on where I’m going wrong, please?

Regards

Santa

P.S. Here’s the full list in case it makes any difference…

set temp to {my holdingFolder as text, my preFlightpdfList, my mailReadyToSend, my runForOz, my presentEmailsJobTally, my reCycleFlag, my ftpPrintFlag, my actualPrintableJobsCounter, my errorMessage, my printTheFollowThroughSheet, my sayEveryErrorMessage as boolean, my mailBoxProcessName, my theCoverPagePrinter as text, my theLargePagePrinter as text, my attachmentbarCodeDateTimeName, my onlyPrintIndAndQuark, my saveftpFiles, my TheVoice, my rtfdPapersize as text, my largePapersize as text, my mailManagerDesktopFolderPath, my didItPrint, my voiceSetter as text, my existsQuarkFlag, my existsAcrobatFlag, my existsIllustratorFlag, my existsInDesignFlag, my existsGraphicConverterFlag, my existsWordFlag, my existsExcelFlag, my theSender, my dailyServerFolder, my extensionsToIgnore, my theYear, my theMonth, my theDays, my extraExtensionsToBypass, my ignoreGraphicConverterCount, my theFontToUse, my includeCompressedExcelSpreadSheet, my maxBarcodeCharacters, my printGCToA4Test, my barcodeSize}

And what, you ask, was the beginning of it all?
And it is this......
Existence that multiplied itself
For sheer delight of being
And plunged with numberless trillions of forms
So that it might
find
itself
innumerably

Sri Aurobindo



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
applescriptobjc-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Fwd: Can I ask for help on this, please?
      • From: Brian Christmas <email@hidden>
  • Next by Date: Fwd: Can I ask for help on this, please?
  • Next by thread: Fwd: Can I ask for help on this, please?
  • Index(es):
    • Date
    • Thread