Re: Formatting question
Re: Formatting question
- Subject: Re: Formatting question
- From: "Stockly, Ed" <email@hidden>
- Date: Fri, 20 Apr 2007 14:03:14 -0700
- Thread-topic: Formatting question
Title: Re: Formatting question
> I would use the Satimage OSAX for numeric formatting like this. If I
> couldn't ensure that was installed everywhere it needed to be, then
> I'd probably call out to the shell:
>
> set DNGnumber to do shell script "printf DNGd " & DNGnumber
>
There really is no reason to go to an OSAX, much less a shell script, for such a simple operation.
Here's a version that is plain vanilla applescript and would save dozens of nano-seconds compared to using an OSAX or a shell script....
set userPrompt to "Enter your DNG Kit number" & return
repeat
set userChoice to display dialog userPrompt default answer "" buttons {"Next", " Cancel "} default button 1 giving up after 30
if the button returned of userChoice is " Cancel " then return
try
set DNGnumber to the text returned of the userChoice as integer
exit repeat
on error
set userPrompt to "You must enter a number" & return & return & "Enter your DNG Kit number" & return
end try
end repeat
display dialog "DNGnumber is " & DNGnumber
if DNGnumber is less than 10 then
set DNGnumber to "DNG00" & DNGnumber
else if DNGnumber is less than 100 then
set DNGnumber to "DNG0" & DNGnumber
else
set DNGnumber to "DNG" & DNGnumber
end if
display dialog DNGnumber
HTH,
ES
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden