On 12:21 AM 12/26/00 robinmcf@altern.org wrote: > Ok did that, but I still get the hangs - however if I run the > SetFrontProcess part on it's own (ie in a small test script) it works > as it is supposed too Your hang is happening outside of BBEdit, but being the nice guy that I am (and I am on vacation this week too!) I'll help out ;-). You can't call standard file from the background. Your SetFrontProcess part doesn't work because SetFrontProcess just schedules the process to come to the front - it comes to the front later when it can. So you need to sit and spin while it comes to the front (and MacPerl will give the OS time). Here is my utility code for doing the same, worked into your script: #! perl -w #=========== declare includes ============= use strict; use diagnostics-verbose; use Mac::Events; use Mac::StandardFile; use Mac::Processes; sub AppToFront { my $creator = shift @_; my $result = 0; my $psn = kNoProcess; my $psi; while ( ( ! $result ) && ( $psn = GetNextProcess($psn) ) ) { $psi = GetProcessInformation($psn); if ( $psi->processSignature eq $creator ) { SetFrontProcess($psn); $result = 1; } } # since SetFrontProcess only schedules the process to come # to the front, we have to wait in a loop here until it # actually does come to the front $result = 0; $psn = kNoProcess; while ( ( ! $result ) && ( $psn = GetFrontProcess() ) ) { $psi = GetProcessInformation($psn); if ( $psi->processSignature eq $creator ) { $result = 1; } } return $result; } sub MacPerlFront { return AppToFront('McPL'); } sub BBEditFront { return AppToFront('R*ch'); } #========== declare variables ============= my($version,$file,$comma,$ProcessNumber); my (@FileInfo,%Process); #============= script body ================ $version="Script =-> $0 version =-> 1.0.a"; $comma="\'"; # -- this part should bring MacPerl to the front MacPerlFront(); $file=StandardGetFile(0,0) or die"there's a problem getting the file info: $^E"; if ($file->sfGood()) { @FileInfo=MacPerl::GetFileInfo($file->sfFile()); print "creator code= $comma$FileInfo[0]$comma file type=$comma$FileInfo[1]$comma\n"; print "path to file = $comma",$file->sfFile(),"$comma\n"; } BBEditFront(); #========= sub routine separator =========== -- Jim Correia Bare Bones Software, Inc. correia@barebones.com <http://web.barebones.com> # ===== Want to unsubscribe from this list? # ===== Send mail with body "unsubscribe" to macperl-request@macperl.org