Sponsored Content
Full Discussion: Help with blobbing
Operating Systems OS X (Apple) Help with blobbing Post 302850243 by kailasgurung on Wednesday 4th of September 2013 10:29:45 AM
Old 09-04-2013
Apple Help with blobbing

I am pretty new to scripting and i was wondering if anyone could help me out.

Here is the situation. I am trying to make an action folder that when an image is saved to it, the image is automatically moved to a folder based upon the first 4 or 5 integers of the name.

image names come in a few variations for example:

1000.jpg
10000.jpg
10000-v1.jpg
10000-v1 copy.jpg

any of the first 4 or 5 integers can be from 0-9.

this is the code i came up with so far.

Code:
tell application "Finder"

   do shell script " if [ -f ~/Desktop/filing/1[0-9][0-9][0-9][!0-9]*.jpg ]
then
scp ~/Desktop/filing/1[0-9][0-9][0-9][!0-9]*.jpg ~/Desktop/filed/1000/
fi"
   
   do shell script "if [ -f ~/Desktop/filing/1[0-9][0-9][0-9][0-9][!0-9]*.jpg ]
then
scp ~/Desktop/filing/1[0-9][0-9][0-9][0-9][!0-9]*.jpg ~/Desktop/filed/13000/
fi"

end tell

the trouble with this code is the wildcard [!0-9] wont work if the image is just 1000.jpg or 10000.jpg as having the [!0-9] means that it is excluding 0-9 range but expecting a character of some sort.

Anyway if anyone could shed some light on a solution to this that would be great.

Kai
 
IMAGEISTRUECOLOR(3)							 1						       IMAGEISTRUECOLOR(3)

imageistruecolor - Finds whether an image is a truecolor image

SYNOPSIS
bool imageistruecolor (resource $image) DESCRIPTION
imageistruecolor(3) finds whether the image $image is a truecolor image. PARAMETERS
o $ image -An image resource, returned by one of the image creation functions, such as imagecreatetruecolor(3). RETURN VALUES
Returns TRUE if the $image is truecolor, FALSE otherwise. EXAMPLES
Example #1 Simple detection of true color image instances using imageistruecolor(3) <?php // $im is an image instance // Check if image is a true color image or not if(!imageistruecolor($im)) { // Create a new true color image instance $tc = imagecreatetruecolor(imagesx($im), imagesy($im)); // Copy over the pixels imagecopy($tc, $im, 0, 0, 0, 0, imagesx($im), imagesy($im)); imagedestroy($im); $im = $tc; $tc = NULL; // OR use imagepalettetotruecolor() } // Continue working with image instance ?> NOTES
Note This function requires GD 2.0.1 or later (2.0.28 or later is recommended). SEE ALSO
imagecreatetruecolor(3), imagepalettetotruecolor(3). PHP Documentation Group IMAGEISTRUECOLOR(3)
All times are GMT -4. The time now is 06:41 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy