Re: Time::Local problem
On 30 Aug 2004, at 8:15 PM, David Ledger wrote: Can anyone explain the following? (the difference in commands is the year spec.) [EMAIL PROTECTED]: perl -e 'use Time::Local;print ( (localtime(timelocal(0, 0, 0, 1, 1, 55)))[6], \n);' 2 [EMAIL PROTECTED]: perl -e 'use Time::Local;print ( (localtime(timelocal(0, 0, 0, 1, 1, 54)))[6], \n);' Cannot handle date (0, 0, 0, 1, 1, 2054) at -e line 1 [EMAIL PROTECTED]: All years I've tried 55 are Ok; all years I've tried 54 fail. As Sherm has pointed out, it's due to the two-digit year wrap around. (Remember the so-called Millennium bug? That's what you're perpetuating in the above code) Your best bet for anything to do with dates and times is to use the DateTime modules. They work on all platforms and comprehensively handle any date and time you can throw at it (right up to $MAXINT-12-31). They handle localization and know all current and historic DST rules back to 1972. Cheers! Rick Measham (disclaimer: I have developed some of the DateTime modules) Senior Developer PrintSupply - Print Procurement Supply Management 18 Greenaway Street VIC 3105 Tel: (03) 9850 3255 Fx: (03) 9850 3277 http://www.printsupply.com.au/
Re: Time::Local problem
On 31 Aug 2004, at 12:09 PM, Sherm Pendley wrote: Great - so now our ancestors have to deal with the Y4G bug? ;-) LOL .. no .. unless you continue to abbreviate. The dates will range from 1-01-01 to 1-12-31 and 2004 will mean 2004 not 12004. Cheers! Rick (They're your decedents by the way, your ancestors have stopped counting) Senior Developer PrintSupply - Print Procurement Supply Management 18 Greenaway Street VIC 3105 Tel: (03) 9850 3255 Fx: (03) 9850 3277 http://www.printsupply.com.au/
Re: Mac::Glue finder physical size
On 31 Aug 2004, at 12:12 PM, Paul McCann wrote: You need to add a -get after the prop(). Strangely enough I saw this by googling on Mac::Glue physical_size, and the only thing whacked (modulo close relatives) was your post of 18th March, containing the vital get. So you want... LOL .. thanks Paul! Senior Developer PrintSupply - Print Procurement Supply Management 18 Greenaway Street VIC 3105 Tel: (03) 9850 3255 Fx: (03) 9850 3277 http://www.printsupply.com.au/
Re: PDF::API
Nelius, This post belongs on the [EMAIL PROTECTED] list rather than the Mac OS-X Perl list. I've cross posted it there and would suggest that you subscribe to that list for all your PDF::API2 help. It's an active and helpful list. You need to be calling the methods on objects and not on their class. Once you open the PDF, you need to add the page to it rather than just adding a page to ... a class. The following code (from my head so it could be wrong) demonstrates how you'd do it: my $pdf = PDF::API2-open( $path_to_pdf ); # Open a PDF my $page = $pdf-page( $pdf-pages ); # Add a page at the end $page-do_something() # Do stuff to the page If there's any PDF::API2ers reading this, feel free to correct my code. Cheers! Rick On 15 Jun 2004, at 7:08 AM, Nelius Bresnan wrote: I'm a Perl novice using the PDF::API package to add stuff to the end of a PDF file. I've RTFMed, I've googled this and I even tried emailing the author but I'm totally stuck. I want to use the method PDF::API2::PDF::Page-add($str). At first I tried PDF::API2-page($index). This inserts-and-returns a new page at $index and it works fine. However an attempt to use $page-add($str) gets the error message: Can't locate object method add via package PDF::API2::Page So it seems that the scalar returned by PDF::API2-page is not the same kind of object that PDF::API2::PDF::Page-add is supposed to be called on. This surprised me - I expected both 'page' objects to be the same type. But I checked and there is a file /Library/Perl/5.8.1/PDF/API2/Page.pm and also a file /Library/Perl/5.8.1/PDF/API2/pdf/Page.pm so it would appear there are in fact two different kind of page objects. And AFAICT I need the other one. So I tried to create a scalar of type PDF::API2::PDF::Page using its constructor. But to create that I need an object of type PDF::API2::PDF::Pages to base it on. The constructor for Pages is PDF::API2::PDF::Pages-new($pdfs,$parent). But the explanation (http://cpan.uwinnipeg.ca/htdocs/PDF-API2/PDF/API2/PDF/Pages.html) of the parameters needed for $pdfs and $parent aren't explicit enough for a Perl novice like myself. It says that $parent should point at the file context if we're trying to create a root node. And I think thats what I need to do to add pages onto the end of the PDF file. I know enough Perl to know that contexts are very important in Perl. So I looked it up in three different manuals but none of them make any reference to a file context. So I'm assuming that context isn't being using in the canonical sense here and that the author simply means a file pointer of some kind. So I've supplied the $pdf scalar that was returned from PDF::API2-open('aPDFfile.pdf'). The pod says that $pdfs is the file object (or objects) in which to create the new Pages object. I'm not sure precisely what it means by that but I think its that this is the file that it'll output to. I want it to output to the same file so I've provided the same $pdf value again. So my attempted construction of a 'pages' object looks like this: my $pages = PDF::API2::PDF::Pages-new($pdf, $pdf); when I run it it craps out giving the message: Can't locate object method new_obj via package PDF::API2 at /Library/Perl/5.8.1/PDF/API2/PDF/Pages.pm line 68. I had a look at the line in question and its pretty hairy stuff. I think its doing something about creating a file outputstream or something like that. It's expecting that there will be a pointer to an object in $_ and I think its the wrong kind of object and consequently it can't find the method. But I'm (way) out of my depth. I think my problem is that my providing the wrong parameters to PDF::API2::PDF::Pages-new. But I just can't understand what I should be giving it. The POD comments are too vague for me. I don't get what I should be providing to it. thank you. Nelius Bresnan. Senior Developer PrintSupply - Print Procurement Supply Management 18 Greenaway Street VIC 3105 Tel: (03) 9850 3255 Fx: (03) 9850 3277 http://www.printsupply.com.au/
Re: CPAN Question
G'day Timothy, You're missing the perl headers. These are installed when you install the developers tools (which came with your OS or are available freely from Apple's website) I can't remember which package in particular you need, if you can't work it out and don't want to just install everything off the disk, I'm sure someone else will chip in shortly with exactly which package it is. Cheers! Rick Measham On 28 May 2004, at 11:55 AM, Timothy Bailey wrote: I've been playing around with CPAN, to get some modules installed. Unfortunately, something seems to be not working. Perhaps it was because I tried to install LWP before its dependencies. Or it could be that the CPAN update failed. But anyway, the make section is failing. Any ideas how I can fix it? Here is an excerpt: Error: Unable to locate installed Perl libraries or Perl source code. It is recommended that you install perl in a standard location before building extensions. Some precompiled versions of perl do not contain these header files, so you cannot build extensions. In such a case, please build and install your perl from a fresh perl distribution. It usually solves this kind of problem. (You get this message, because MakeMaker could not find /System/Library/Perl/darwin/CORE/perl.h) That particular file does not seem to exist. So maybe there's some setting I need to change. And make returns status 512 often. Whatever that means. ;) -- Tim Bailey |\/ Of all tyrannies, a tyranny exercised for the [EMAIL PROTECTED]|\/ good of its victims may be the most oppressive. [EMAIL PROTECTED] | It may be better to live under robber barons http://www.moonrise.org than under omnipotent moral busybodies. --'--,--@ The robber baron's cruelty may sometimes sleep, his cupidity may at some point be satiated; but those who torment us for our own good will torment us without end, for they do so with the approval of their own conscience. -- C.S. Lewis Senior Developer PrintSupply - Print Procurement Supply Management 18 Greenaway Street VIC 3105 Tel: (03) 9850 3255 Fx: (03) 9850 3277 http://www.printsupply.com.au/
Re: seperate file
On 30 Apr 2004, at 12:20 AM, zunsheng Jiao wrote: Hi all, I'm new on perl. I need to separate a huge file to small files. It has three columns. If first column is a number , use this number as a file name (i. e., 260.dat and 300.dat for following sample), and then writing column 2 and columns 3 to this file. Following is a sample such file: 26005000 205300 405500 806000 1005500 300 05100 205200 405500 805600 1005800 Please help. John If your data is tab delimited the following will work. If not the split line needs to be changed depending on how your data is arranged. # Go through each line of the data foreach $line(DATA) { # Split the line at whitespace my ($file, $col1, $col2) = split(/\s+/,$line); # If there's something in the $file column, it's a new file if ($file) { # close the current file (but don't die if there is none) eval{ close(FILE) }; # open the new file or die if we can't open(FILE, /Users/rickm/Desktop/test/$file.dat) or die(I can't open $file.dat: $!); } # Write the data to the file print FILE $col1 . \t . $col2 . \n; } # close the latest file: eval{ close(FILE) }; __DATA__ 260 0 5000 205300 405500 806000 1005500 300 05100 205200 405500 805600 1005800 Senior Developer PrintSupply - Print Procurement Supply Management 18 Greenaway Street VIC 3105 Tel: (03) 9850 3255 Fx: (03) 9850 3277 http://www.printsupply.com.au/
Mac::Glue and OmniGraffle
1. Product plug (sorry Merlyn) - OmniGraffle is by far the best development-planning tool I've ever seen. Love it. 2. I'm trying to perl + Mac::Glue it, but after reading through the OmniGraffle.pod and Mac::Glue I'm still lost. The following applescript works: tell front document of application OmniGraffl tell page 1 make new shape at beginning of graphics with properties {text:{alignment:left, text:field}, origin:{20, ypos}, size:{150, 20}, magnets:{{-1, 0}, {1, 0}}} end tell end tell However, I can't work out the Mac::Glue for the same. I've tried many variation on the following but I'm still lost. I've also looked through the archives for an example of a $obj-make but all the examples appear to be aimed at retrieving data rather than creating 'things'. use Mac::Glue; my $OmniGraffle = new Mac::Glue 'OmniGraffle'; my $chart = $OmniGraffle-obj(document = 1, page = 1); $chart-make( new = 'shape', # $chart-obj('shape')) at = Mac::Glue::location(before = $chart-obj('graphics')), with_properties = { origin = [20,20], size = [150, 20], text = { text= 'Square' } }, ERRORS = \error_handler, # error handler from the perl website article ); __END__ unfortunately, the error message isn't that helpful .. OSA's fault I figure: they never make any sense! OmniGraffle-make(DOBJ, Mac::AEObjDesc=HASH(0xaf398c), new, shape, with_properties, HASH(0xaf3878), at, AEDesc=SCALAR(0xaf39bc)) event failed: dsLineFErr (10) line trap error
Re: Getting the size of a folder with Mac::Glue
On 18 Mar 2004, at 6:06 AM, Chris Nandor wrote: This works: my $obj = $finder-obj(folder = '/Users/pudge/Movies'); my $size = $finder-data_size($obj); Chris, what is the data_size? The correct size of the folder is (from Finder info) 8.6MB on disk (4,001,454 bytes) rickm% perl -e 'use Mac::Glue; $finder=new Mac::Glue Finder; print $finder-data_size( $finder-obj( folder = $ARGV[0] ) )' /path/to/folder 442 rickm% perl -e 'use Mac::Glue; $finder=new Mac::Glue Finder; $obj=$finder-obj( folder = $ARGV[0] ); print $obj-prop(physical_size)-get' /path/to/folder 9088512 Which is 8.667MB, the size I'm looking for. Cheers! Rick Senior Developer PrintSupply - Print Procurement Supply Management 18 Greenaway Street VIC 3105 Tel: (03) 9850 3255 Fx: (03) 9850 3277 http://www.printsupply.com.au/
Urgent: Turning a script into a droplet
Need some quick help ... how do I turn a perl script into a droplet (and when I do, do the dropped files appear in @ARGV still?) Cheers! Rick Senior Developer PrintSupply - Print Procurement Supply Management 18 Greenaway Street VIC 3105 Tel: (03) 9850 3255 Fx: (03) 9850 3277 http://www.printsupply.com.au/
Re: Urgent: Turning a script into a droplet
On 16 Mar 2004, at 4:34 PM, Sherm Pendley wrote: DropScript. http://www.wsanchez.net/software/ On 16 Mar 2004, at 4:16 PM, Andrew M. Langmead wrote: One suggestion would be DropScript http://www.wsanchez.net/software/ It can turn any script or program into a droplet. (by dropping the script or program onto it. It itself is a droplet) Thanks for the suggestion .. looks good. Cheers Rick Senior Developer PrintSupply - Print Procurement Supply Management 18 Greenaway Street VIC 3105 Tel: (03) 9850 3255 Fx: (03) 9850 3277 http://www.printsupply.com.au/
Getting the size of a folder with Mac::Glue
I'm trying to get the size of a folder and figure Mac::Glue would be the way to go. However I'm getting back a 0: use Mac::Glue; my $finder = new Mac::Glue 'Finder'; die(No such file: $monthdir/$folder/) unless -e $monthdir/$folder/; my $size = $finder-data_size($monthdir/$folder/); print $size; # 0 print $MacError # Now surely if the file doesn't work (like if I'm supposed to put some object there) I should be getting some sort of error? (If there's a better way to get the size of a folder, please let me know!) Cheers! Rick Senior Developer PrintSupply - Print Procurement Supply Management 18 Greenaway Street VIC 3105 Tel: (03) 9850 3255 Fx: (03) 9850 3277 http://www.printsupply.com.au/
Re: ANNOUNCE: Affrus 1.0 - a Perl Debugger
Mark, thanks for this announcement. There is no other place on the net that would have let me know about this tool. I'll go and check it out now. Randal said: I will stand by my statement that the posting is wrong until one or both of those entities have declared contrary ground rules, and continue to object to such postings until being told otherwise by someone with authority. Randal: They have already declared such a post to be allowable. Where did they do that? When Ask set up spam filters on the machine in the TPF owned domain: On 12 Mar 2004, at 4:40 AM, Mark Alldritt wrote: X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on x1.develooper.com X-Spam-Status: No, hits=-4.9 required=8.0 tests=BAYES_00 autolearn=ham version=2.63 So, if they didn't want this, surely it would have scored at least in the positives! Get over it Randall, this is the best place to post it. Cheers! Rick Measham Senior Developer PrintSupply - Print Procurement Supply Management 18 Greenaway Street VIC 3105 Tel: (03) 9850 3255 Fx: (03) 9850 3277 http://www.printsupply.com.au/
Re: Mac::Carbon install problem (Processes.t)
There are others who will certainly know better than I do, however let me ask, are you running CPAN with: sudo /full/path/to/perl -MCPAN -e shell If you don't use sudo (or su to root if you have it enabled) then there will be problems with installs, and if you have your own perl installed you'll need the full path to it. That's just my thoughts, given the 'super-user' related errors. Cheers! Rick On 17 Feb 2004, at 1:54 PM, Salvatore Denaro wrote: The only thing in the system log that looks like there may be a problem is: aped[185]: Attach denied: super-user process, for UserNotification[5049] aped[185]: Attach denied: super-user process, for perl[5050] aped[185]: Attach denied: super-user process, for perl[5058] Anyone know what's wrong? Thanks.
Re: [OT] XML in SQL (was: MySQL for Web Apps)
On Wed, 4 Feb 2004, Rick Measham wrote: I'd love to see an XML parser embedded into SQL so that I can have: CREATE TABLE aTable (id serial, data XML); On 5 Feb 2004, at 05:21 pm, Chris Devers replied: Does this help? snip Is this along the lines of what you were hoping for? Thanks Christ, but not really at all. What I want is the ability to use XML as a data type so that I can have a field full of XML that is searchable. The output would be the'zactly the same as current output. The input would be XML as a string: INSERT INTO data (id, user, data) VALUES (1, 'rick','usernameRick/namesurnameMeasham/surname/user'); INSERT INTO data (id, user, data) VALUES (2, 'rick02','usernameRick/namesurnameSmith/surname/user'); # And then I could retrieve it: SELECT * FROM data WHERE data:user:name='Rick' id | user | data --- 1 | rick | usernameRick/namesurnameMeasham/surname/user 2 | rick02 | usernameRick/namesurnameSmith/surname/user (2 rows returned) Cheers! Rick Measham Senior Designer and Developer Printaform Pty Ltd Tel: (03) 9850 3255 Fax: (03) 9850 3277 http://www.printaform.com.au http://www.printsupply.com.au vcard: http://www.printaform.com.au/staff/rickm.vcf
Re: [OT] XML in SQL (was: MySQL for Web Apps)
On 6 Feb 2004, at 01:47 pm, Rick Measham wrote: Thanks Christ, erm .. sorry .. chris .. Rick Measham Senior Designer and Developer Printaform Pty Ltd Tel: (03) 9850 3255 Fax: (03) 9850 3277 http://www.printaform.com.au http://www.printsupply.com.au vcard: http://www.printaform.com.au/staff/rickm.vcf
Re: [OT] XML in SQL (was: MySQL for Web Apps)
On 6 Feb 2004, at 02:37 pm, Chris Devers wrote: Anyway, it was pointed out to me in a different offlist response that I was probably answering the wrong question. Oh well -- it still seems like a useful (and under-publicized?) capability of the standard MySQL client, so maybe bringing it up will still be of use to someone... Very true .. I'm a PostGreSQLer rather than a MySQLer, and looking through the mailing lists there it looks like theres been talk of accessing the XML as data rather than as text ... h.. Feb 2003 .. I might poke some people! Rick Measham Senior Designer and Developer Printaform Pty Ltd Tel: (03) 9850 3255 Fax: (03) 9850 3277 http://www.printaform.com.au http://www.printsupply.com.au vcard: http://www.printaform.com.au/staff/rickm.vcf
Re: [OT] MySQL for Web Apps
On 4 Feb 2004, at 03:16 pm, Bill Stephenson wrote: As computers keep getting faster, and memory and storage cheaper, isn't it beneficial to program in the most simple, human readable, least learning required, method? Never. You're not going to ever read each 2500 user's 2000 x 40kb records thus it's better to store it in a way that the computer can access it. In short, I'm lazy. I'd rather code this all in perl. Do I really need to learn about and use MySQL or will computers get fast enough that it won't matter anyway. Once again, no. Especially with where you're starting. 3 users and you might be OK. Have a think about this: You have a file: XMLuserid1/idnameBob/name/useruserid2/ idnameNancy/name/user/XML The first thing you're going to do with XML::Parser is turn the XML into a perl data structure: @data = ( { id = 1, name = 'Bob' }, { id = 2, name = 'Nancy' } ); Then you'll look through each element of the list looking for name eq 'Bob'. All you'll do all that in perl. Multiply the files by 2500 users then multiply by 40k of information. Perl wouldn't even be able to start to store it all. On the other hand if you store the data directly in a database which has been optimised for quick searching and already has all the methods you'll ever require to store and retrieve data, you'll be running it as a compiled program. It will run a LOT faster and it will do it's job a LOT better. It will also handle data-locking so you and I can't both be writing to a file at the same time. In short there's no question about which is the better option. Databases are quicker and safer. Cheers! Rick Rick Measham Senior Designer and Developer Printaform Pty Ltd Tel: (03) 9850 3255 Fax: (03) 9850 3277 http://www.printaform.com.au http://www.printsupply.com.au vcard: http://www.printaform.com.au/staff/rickm.vcf
Re: [OT] MySQL for Web Apps
On 4 Feb 2004, at 03:39 pm, kynan wrote: The idea of having XML in the DB is sound though, if you do it thoughtfully. So long as you're not planning on searching on it or indexing it or ... I once used XML to store information about a webpage as a PostGreSQL field ... but later down the track I wanted to search on some of that data and had to retrieve all records that contained 'bob' and then parse the XML and check that 'bob' was in the byline rather than just having his name in the content. dream I'd love to see an XML parser embedded into SQL so that I can have: CREATE TABLE aTable (id serial, data XML); Then I can: SELECT id FROM aTable WHERE data:story:byline = 'Bob'; Which would return the id of any record whose data field looked something like: XMLstory id=1bylineBob/bylinecontentContent/content/storystory id=2bylineBob/bylinecontentContent of another story/content/story/XML But wouldn't return the id where the data looked like: XMLstory id=1bylineNora/bylinecontentBob is a dude/content/storystory id=2bylineBill/bylinecontentContent of another story/content/story/XML even though 'bob' is in the text. Basically the SQL engine would recognise that 'data' is an XML field and could search it according to requirements. /dream Rick Measham Senior Designer and Developer Printaform Pty Ltd Tel: (03) 9850 3255 Fax: (03) 9850 3277 http://www.printaform.com.au http://www.printsupply.com.au vcard: http://www.printaform.com.au/staff/rickm.vcf
Re: permission denied during open
On 2 Feb 2004, at 12:59 am, timothy driscoll wrote: this fails with an error 'Permission denied' when the target dir 'temp' looks like this: drwxrwxr-x 3 nobodynobody 102 1 Feb 08:44 temp but it works if I make the dir writeable by everyone: drwxrwxrwx 3 nobodynobody 102 1 Feb 08:44 temp I thought perl ran as nobody, so giving r/w access to 'nobody' should work. but obviously it doesn't - so what did I do wrong? G'day Tim, perl itself will run as whoever calls it. In the case of CGI it will be run by Apache or whichever http server you're running. By default apache used to run as 'nobody.nobody', then on some installs it runs as 'apache.apache'. However, on MacOS-X it runs as 'www.www'. Check the httpd.conf file to see (It's the 'user' and 'group' directives). Assuming you're on OS-X, set your file's owner.group to www.www and you should be fine with a 744. Cheers! Rick Rick Measham Senior Designer and Developer Printaform Pty Ltd Tel: (03) 9850 3255 Fax: (03) 9850 3277 http://www.printaform.com.au http://www.printsupply.com.au vcard: http://www.printaform.com.au/staff/rickm.vcf
Re: permission denied during open
OK, I'm a git. I didn't scroll down so I didn't realise this had already been answered half a dozen times. Sorry! On 2 Feb 2004, at 10:32 am, Rick Measham wrote: On 2 Feb 2004, at 12:59 am, timothy driscoll wrote: this fails with an error 'Permission denied' when the target dir 'temp' looks like this: drwxrwxr-x 3 nobodynobody 102 1 Feb 08:44 temp but it works if I make the dir writeable by everyone: drwxrwxrwx 3 nobodynobody 102 1 Feb 08:44 temp I thought perl ran as nobody, so giving r/w access to 'nobody' should work. but obviously it doesn't - so what did I do wrong? G'day Tim, perl itself will run as whoever calls it. In the case of CGI it will be run by Apache or whichever http server you're running. By default apache used to run as 'nobody.nobody', then on some installs it runs as 'apache.apache'. However, on MacOS-X it runs as 'www.www'. Check the httpd.conf file to see (It's the 'user' and 'group' directives). Assuming you're on OS-X, set your file's owner.group to www.www and you should be fine with a 744. Cheers! Rick Rick Measham Senior Designer and Developer Printaform Pty Ltd Tel: (03) 9850 3255 Fax: (03) 9850 3277 http://www.printaform.com.au http://www.printsupply.com.au vcard: http://www.printaform.com.au/staff/rickm.vcf Rick Measham Senior Designer and Developer Printaform Pty Ltd Tel: (03) 9850 3255 Fax: (03) 9850 3277 http://www.printaform.com.au http://www.printsupply.com.au vcard: http://www.printaform.com.au/staff/rickm.vcf
Re: tricky parsing question
On 23 Jan 2004, at 01:21 pm, wren argetlahm wrote: I'm working on a linguistic module and I'm trying to find a good way to split a string up into segments. I can't assume single charecter strings and want to assume maximal segments. As an example, the word church would be rendered as the list ('ch', 'u', 'r', 'ch') and wouldn't break the ch up smaller even though both c and h are valid segments in English. I have all the valid segments for a given language stored as keys in a hash, now I just need an algorithm to chop up a string into a list. Any ideas? Wren, when you say 'segments' it appears you mean phonemes or phonetics. CPAN has several modules that may help you: Lingua::Phoneme uses the Moby Pronounciation Dictionery to find the phonemes. Text::Metaphone also deals with phonemes and will return 'Church' as 'XRX' meaning 'ch', 'r', 'ch'. Unfortunately it returns the 'ch' in 'Character' as an 'X' also. And that, of course, is the most difficult part. English is such a hodge-podge of hacks from other languages the understanding it via algorithms is very very hard. Cheers! Rick Rick Measham Senior Designer and Developer Printaform Pty Ltd Tel: (03) 9850 3255 Fax: (03) 9850 3277 http://www.printaform.com.au http://www.printsupply.com.au vcard: http://www.printaform.com.au/staff/rickm.vcf
Getting a 'Save As' dialog box
Hello People, I need some help with a perl on OS-X problem. I need to pop up a 'Save As' dialog. Basically the same as the one AppleScript gives you when you: choose file name with prompt Select a location to save this file default name Name but I need to do this from perl. At first I thought it might be simple: $file = `osascript -e 'choose file name with prompt test1 default name test2'`; but that gives me: 0:57: execution error: No user interaction allowed. (-1713) So next I used CPAN module Mac::AppleScript and I don't get any reply at all: RunAppleScript(qq(choose file name with prompt test1 default name test2)); But I figure that somewhere in all this there must be a way to pop up such a dialog directly from perl. How? Thanks and Cheers! Rick Rick Measham Senior Designer and Developer Printaform Pty Ltd Tel: (03) 9850 3255 Fax: (03) 9850 3277 http://www.printaform.com.au http://www.printsupply.com.au vcard: http://www.printaform.com.au/staff/rickm.vcf
Re: Getting a 'Save As' dialog box
Thanks John, Works a treat! On 12 Jan 2004, at 03:47 pm, John Delacour wrote: At 2:51 pm +1100 12/1/04, Rick Measham wrote: I used CPAN module Mac::AppleScript and I don't get any reply at all: RunAppleScript Further to my last posting, I discover that some applications will not behave properly if the tell target is themselves. Eudora and BBEdit 6.5 are two examples of apps that hang, but you can run this from the Terminal or you can run it from the Terminal with Terminal as the target. It will also work fine with tell self in certain other apps. #!/usr/bin/perl use Mac::AppleScript qw(RunAppleScript); my $asresult = RunAppleScript EOS; tell app Eudora activate choose file name with prompt test1 default name test2 posix path of result end EOS print \n$asresult\n Rick Measham Senior Designer and Developer Printaform Pty Ltd Tel: (03) 9850 3255 Fax: (03) 9850 3277 http://www.printaform.com.au http://www.printsupply.com.au vcard: http://www.printaform.com.au/staff/rickm.vcf