Problem Checking if File Exists When App is Launched
I'm developing an app which checks a file "lastuser.txt" to determine which database to open, as sometimes people share phones. Anyway, I'm trying to call TryGetItemAsync() in the OnLaunched() section in App.xaml.cs but I get the message
"The name 'TryGetItemAsync' does not exist in the current context". I am new to C# and phone app development. Any help would be greatly appreciated. Below is my code:
tia
CS
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using SQLite;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Storage;
using System.Threading.Tasks;
using System.Diagnostics;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Media.Animation;
using Windows.UI.Xaml.Navigation;
// The Blank Application template is documented at http://go.microsoft.com/fwlink/?LinkId=391641
namespace BP_Alert
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
public sealed partial class App : Application
public static string DBPath = string.Empty;
public static string LastUser = string.Empty;
public static DateTime Time_Taken { get; set; }
private TransitionCollection transitions;
/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public App()
this.InitializeComponent();
this.Suspending += this.OnSuspending;
/// <summary>
/// Invoked when the application is launched normally by the end user. Other entry points
/// will be used when the application is launched to open a specific file, to display
/// search results, and so forth.
/// </summary>
/// <param name="e">Details about the launch request and process.</param>
protected async override void OnLaunched(LaunchActivatedEventArgs e)
#if DEBUG
if (System.Diagnostics.Debugger.IsAttached)
this.DebugSettings.EnableFrameRateCounter = true;
#endif
Frame rootFrame = Window.Current.Content as Frame;
// Do not repeat app initialization when the Window already has content,
// just ensure that the window is active
if (rootFrame == null)
// Create a Frame to act as the navigation context and navigate to the first page
rootFrame = new Frame();
// TODO: change this value to a cache size that is appropriate for your application
rootFrame.CacheSize = 1;
if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
// TODO: Load state from previously suspended application
DBPath = Windows.Storage.ApplicationData.Current.LocalFolder.Path;
LastUser = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path,"LastUser.txt");
bool result = await TryGetItemAsync(LastUser); <--Error!!!!!!!!!!!!!!!
// Place the frame in the current Window
Window.Current.Content = rootFrame;
It seems that TryGetItemAsync is a method on a StorageFolder, so you will need to do something like:
myStorageFolder.TryGetItemAsync(LastUser);
See here:
https://msdn.microsoft.com/en-us/library/windows/apps/windows.storage.storagefolder.trygetitemasync.aspx?cs-save-lang=1&cs-lang=csharp#code-snippet-1
If you go to that link and scroll down to the bottom of the page, it says:
Minimum supported phone
None supported
Similar Messages
-
Problem opening pdf file from an app built by Flash Builder 4.5
problem opening pdf file from an app built by Flash Builder 4.5
The iPad and iPhone have NEVER supported Flash and never will. In fact, Adobe is no longer distributing Flash builds to mobile devices.
Time to move on... -
Check if file exists returns false. File is in system32
I'm having a problem detecting if a file exists which was simply copied to the system32 directory. I tried moving the file to various other directories and simply using a vi with the "Check if file or folder exists" action. I've narrowed it down to not being able to find the file if I copy it to either c:\windows or c:\windows\system32.
I thought this could be a permissions issue, but did my best to assign the user name full control of the folders.
Another interesting thing is if I make the file input a control and click on the "folder" icon to open a list of files, I cannot see the newly copied files in system32 directory either. Very strange.
This is on a Dell PC, Windows 7 professional/Labview 2010 SP1 (note I am running the vi. as an executable on this machine). Could it be some setting in my project build?
Solved!
Go to Solution.If you're using Windows 7 64-bit, it may be related to the problems the user was having here:
http://forums.ni.com/t5/LabVIEW/Problem-Using-quot-msg-quot-command-with-quot-System-Exec-vi/m-p/153...
It may be that the LabVIEW functions are 32-bit and are getting redirected. -
Problems with opening files in correct app
Hi guys
Recently we have switched over at my company to OSX tiger. I work for a design firm doing artwork for various clients in the retail sector. We have a bank of logos and images on file that we use, mostly Illustrator eps saved in version 10 of the application. We are having problems opening these files in the right app. It keeps defaulting to opening in Photoshop. When we change the settings in get info and apply them to all, all our photoshop eps try and open in Illustrator. This is proving a real pain especially when opening the files from Quark after double clicking on the image and pressing the edit original button. Is there any way we can tell the system to open Illustrator files in Illustrator and Photoshop files in Photoshop.
Cheers ThomHi, Thom.
You wrote: "We have a bank of logos and images on file that we use, mostly Illustrator eps saved in version 10 of the application. We are having problems opening these files in the right app. It keeps defaulting to opening in Photoshop. When we change the settings in get info and apply them to all, all our photoshop eps try and open in Illustrator."You are describing the procedure in "Mac OS X 10.4 Help: Changing the application that opens a document."
The problem is due to the fact that a given file type or extension, e.g. .eps, can be bound via "Change All" to only one application. If you bind (set the default application) all .eps to Illustrator, that's what they'll all open in.
For the situation you have, you need to bind the documents individually to the specific application. If you can gather a selection of the documents, you can use the contextual menu of the selection (Control-click or right-click the selection), hold the Option key, select "Always open with..." and select the desired application. The selected documents will open in that application and they will henceforth be bound to it until you again change the documents default application.
You can reset all the default bindings you've defined by using the Tiger-specific procedure in my "Resetting Launch Services" FAQ. Start with Step 6 since you also want to eliminate user-defined bindings.
Good luck!
Dr. Smoke
Author: Troubleshooting Mac® OS X
Note: The information provided in the link(s) above is freely available. However, because I own The X Lab™, a commercial Web site to which some of these links point, the Apple Discussions Terms of Use require I include the following disclosure statement with this post:
I may receive some form of compensation, financial or otherwise, from my recommendation or link. -
Applet checking if file exist and if no copy this file
Halo, everyone,
I'm new to java and I need an applet which is able to check if certain file exist on user's hard drive and if not to copy it.
I read that this is possible in certain circumstances, that applet has to be trustes and so on, but that's not my problem. My request is the applet code that checks of existance of certain file.
I'll lbe very thankful if someone could give me such applet or point me to place where I can see steps to creare it myself.
Thank you in advace onse again.Thnaks a lot for your answers. I really ppreciate!
How could I make the applet using such permissions i
how than it would work?I don't understand, in your first post you said "I read that this is possible in certain circumstances, that applet has to be trustes and so on, but that's not my problem. ". I assumed from this that someone else was dealing with the security aspects.
A starting point to signing Applets is - http://java.sun.com/developer/technicalArticles/Security/Signed/ but Google willl find you a whole load of information. -
Help!! Error message: "File Exists" when I try to render the project
It is rendering one of my menus, it has a video background. It gets to the very last frame and then the thing pops up and says "File Exists" And I can only press OK, and when I do the rendering stops. What is wrong?? I need this to work by today please help!!
I have the same problem. Although, after I delete it I still can't render the menu. It shows that its rendering and when it reaches 100% it goes back about 5% (to about 95% complete) and starts moving towards 100% again, then back and forth endlessly.
When I hit cancel I see that it puts files in the project Sources\Menus folder... but when I preview still no motion video and when I try to re-render, I get the error message that "File Exists" all over again.
Any ideas? -
Check if files exist using ABAP
Hi All,
I'm currently using FM: FILE_GET_NAME_USING_PATH, and I'd like to do a check to see if the filepath with file (i.e. /com/tmp/file.txt) I am getting back exists or not.
Very simple question, just not sure what to do.
Thanks,
JohnThere is a class that provides methods to check, if a file exist or if a certain directory does exist
CALL METHOD cl_gui_frontend_services=>directory_exist
EXPORTING
directory = lv_path
RECEIVING
result = lv_valid
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
wrong_parameter = 3
not_supported_by_gui = 4
OTHERS = 5.
CALL METHOD cl_gui_frontend_services=>file_exist
EXPORTING
file = x_file_with_path
RECEIVING
result = y_file_exists
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
wrong_parameter = 3
not_supported_by_gui = 4
OTHERS = 5.
Hope that helps,
Michael -
Check if file exists in file receiver adapter
hello,
we have following scenario -> proxy to file
before appending to the file, it should be copied/renamed to a "tmp" file
xi should then append to that tmp file and copy/rename the file back to the normal name
I tried it with "Run operating system command before message processing" but
it's not working
anybody has an example on how to use those settings before/after message processing ?
regards,
michelHi Michel,
little confused,
1) before message processing do there any file exists?
2) why should we change file name to 'tmp' and append data to that and again rename that file ?
con't we directly proceed in append mode with file name?
When we use single command say for example cp or mv (copy or move) the commands then
eg: cp %F /var/opt/data/outbound/Test/Dummy.txt
when we club commands together or try to redirect the outputs of commands
eg: cp %F /var/opt/data/outbound/Test/Dummy.txt & mv %F /var/opt/data/outbound/Test/Dummy.txt
or
cp %F /var/opt/data/outbound/Test/Dummy.txt
mv %F /var/opt/data/outbound/Test/Dummy.txt
Include all ur command in one file and call that file in the OS parameter
Regards,
Pradeep A. -
Adobe Send - Problem with uploading files. When is this going to get fixed?
When is the Adobe Send problem with uploading files going to get fixed. Similar to others - I have tried and tried to make Adobe Send work and get an error. I have tried to upload the file and it looks like it uploads and then - it is nowhere to be found.
I then go to Adobe Send Now and it works fine.The problem is the same as described in other similar threads.
I have a 57 MB PowerPoint file I am trying to send using Adobe Send. I go through the normal steps to identify the file and select recipients and then send the file. After the file completes the upload - an error saying there was a problem comes up and the file is not uploaded.
I have tried to upload the file to the site with similar results - error and the file doesn't go.
I can go to the old SendNow site and it works flawlessly.
If I need to get screenshots - let me know. There are several other threads describing this same problem. It isn't something new or not heard of before.
Sent from my iPod -
How to check whether file exist or not?
hello,
i wanted to know that how can i check whether a file exist or not independent of underlying Operating system?
please help .
Thank you.Use exists() on a File instance.
-
Use thread to check for file exists. How?
public class FileSearcher extends Thread
String name = "Unknown";
//RunFileSearcher rfs = new RunFileSearcher(name);
//FileSearcher rfs = new FileSearcher(name);
File f = new File();
Thread t = new Thread(); // create the thread
t.start(); // start the thread running
public void run(name)
if( f.exists(name) )
System.out.println("*** File " + f + " has been created. ***");
else
System.out.println("Searching for file " + f) ;
}How do I use each thread to check for each file exists per sec??
Please Help Thanks1) Why are you using Threads?
2) It is preferrable to implement Runnable.
3) This is all incredibly pointless (see point 1) -
Java script in HTMLDB to check if file exists in Unix file system
How do I use javascript to check if file is exists in Unix file system. I would like to dispaly the columns only if file is exists.
Hello,
This is one of those features that the manuals do not cover.
How to use and build AJAX features could be a whole book all by itself, and it's not really HTML DB specific feature even though we have built some hooks in application and javascript to make it easier.
Take a look at this thread
Netflix: Nice UI ideas
and I've built some examples here
http://htmldb.oracle.com/pls/otn/f?p=11933:11
Or just search the forums for AJAX or XMLHTTP
Carl -
Problems checking in files to DMS
Hi DMS gurus,
I have some questions regarding the checking in files to SAP DMS. Any help would be very much appreciated.
1. Ideally, I need to check in a binary table with the file content directly to DMS. Is it possible? I am trying to use CVAPI_DOC_CHECKIN with PF_CONTENT_PROVIDE = 'TBL', but it doesn't work because there is no path for the file name in PT_FILES_X since I do not have a file, just a binary table.
2. How to automatically delete the file from the source after it's been checked in? The checkbox "Delete file after check-in" is marked in configuration for WS application, but the source file is not getting deleted.
3. How to check in the file from Application server using BAPI_DOCUMENT_CHECKIN2? The HOSTNAME requires the network address, but how to configure it. In SPRO I found network addresses for Data carriers. Not sure if it's the place.
Thank youHi DMS gurus,
I have some questions regarding the checking in files to SAP DMS. Any help would be very much appreciated.
1. Ideally, I need to check in a binary table with the file content directly to DMS. Is it possible? I am trying to use CVAPI_DOC_CHECKIN with PF_CONTENT_PROVIDE = 'TBL', but it doesn't work because there is no path for the file name in PT_FILES_X since I do not have a file, just a binary table.
2. How to automatically delete the file from the source after it's been checked in? The checkbox "Delete file after check-in" is marked in configuration for WS application, but the source file is not getting deleted.
3. How to check in the file from Application server using BAPI_DOCUMENT_CHECKIN2? The HOSTNAME requires the network address, but how to configure it. In SPRO I found network addresses for Data carriers. Not sure if it's the place.
Thank you -
Dialog prompt and check if file exists, and use the result of dialog
I have this working script and I want to change the way it behaves.
I want a dialog to come up, Do you want to skip or replace existing files.
Then the result of the dialog to be used in the reast of the script.
I've added it in the script where I need to use it. in noce big letters, hopefully its not a big job.
Many thanks
property type_list : {"8BPS"}
property extension_list : {"psd"}
script o
property theseNames : {}
end script
-- empty log file
do shell script "echo 'Files not processed in Photoshop :' > ~/Desktop/LogPhotoshopError.txt"
set noError to true
--Setup list of folders and process details of folders
set dtF to paragraphs of (do shell script "ls -F ~/Desktop | grep '/' | cut -d'/' -f1")
set tc to (count dtF)
repeat with i from 1 to tc
set folderName to item i of dtF --<: is the folder name, no need to use text item delimiters -->":"
if folderName does not start with "2_" and folderName does not start with "Hot" and folderName does not start with "Press" and folderName does not start with "Design" and folderName does not start with "Keywords" and folderName does not start with "Season" and folderName does not start with "Sue" and folderName does not start with "Design" then
set {oldTID, my text item delimiters} to {my text item delimiters, "_WK"}
set FolderEndName to last text item of folderName
set brandName to first text item of folderName
set my text item delimiters to "_PSD"
set weekNumber to first text item of FolderEndName
set my text item delimiters to oldTID
set theFolder to ("Hal 9000:Users:matthew:Desktop:" & folderName)
--set up names to destination folders and create locally based on brand name and week number
set this_local_folder to "Images:2012-2013"
set localWeekFolder to my getFolderPath("WK" & weekNumber, this_local_folder)
set localBrandFolder to my getFolderPath(brandName, localWeekFolder)
set localBrandFolder_Low_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", localBrandFolder)
set localBrandFolder_High_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_HR", localBrandFolder)
set localBrandFolder_PSD to my getFolderPath(brandName & "_WK" & weekNumber & "_PSD", localBrandFolder)
set this_Network_folder to "GEN:Brands:Zoom:Brand - Zoom:Upload Photos:2013:"
set networkWeekFolder to my getFolderPath("Week" & weekNumber, this_Network_folder)
set networkBrandFolder_Low_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", networkWeekFolder)
set website_images to "GEN:Website_Images:"
--set up names to destination folders and create over Netwrok for FTP collection (based on a mounted drive)
set this_ftp_folder to "pulse:"
set ftpWeekFolder to my getFolderPath("Week" & weekNumber, this_ftp_folder)
set ftpBrandFolder to my getFolderPath(brandName, ftpWeekFolder)
set ftpBrandFolder_Low_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", ftpBrandFolder)
set ftpBrandFolder_High_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_HR", ftpBrandFolder)
--at the beginning of the script, ask whether to replace or skip existing files? to apply to all?
--use the result for the if file exists?
display dialog "Should I replace or skip exisiting files?" buttons {"Replace", "Skip (Faster)"} default button 2 with icon 1
--taking the folder identify which process it must follow.
if brandName is equal to "BH" then
try
tell application "Finder" to set o's theseNames to (name of files of alias theFolder whose file type is in the type_list or name extension is in the extension_list)
on error
set o's theseNames to {} -- no psd files or "8BPS"
end try
set numOfNames to (count o's theseNames)
repeat with j from 1 to numOfNames
set thefile to theFolder & ":" & (item j of o's theseNames)
-- B H Folder Photoshop Process
--if thefile exists in the folder localBrandFolder_PSD then do the result of dialog.
--"Skip" the file and move on to next
--If "replace" continue the rest of the script.
tell application "Adobe Photoshop CS5.1"
-- I remove the command activate, Photoshop stay in background
set ruler units of settings to pixel units
try
open (alias thefile) showing dialogs never
set origName to name of current document
set myOptions to {class:JPEG save options, quality:12}
set myPSDOptions to {class:Photoshop save options, embed color profile:true, save layers:true}
tell current document
--If the quick mask mode has been left on then delete the channel Quick Mask
if (quick mask mode) then delete channel ¬
"Quick Mask"
--If the Layer is incorrectly labeled with Original Layer it needs renaming to original Image
if (exists layer "Original Layer") then ¬
tell layer "Original Layer" to set name to "Original Image"
save in (localBrandFolder_PSD & origName) as Photoshop format with options myPSDOptions without copying
(delete layer "Original Image") flatten
resize image resolution 300 resample method none
--sharpen image
filter current layer using unsharp mask with options {amount:80, radius:3.2, threshold:0}
save in (localBrandFolder_High_Res & name) as JPEG with options myOptions without copying
--get file path, return path of the JPEG file, work with (without copying)
-- (with copying) : it return path of PSD file
set newFile to file path --( return path of type alias )
-- duplicate file using the Finder -->on duplicateFile(..)
my duplicateFile(newFile, {ftpBrandFolder_High_Res})
--Prepare for Low RES by resetting image history
set current history state to history state 3
flatten
resize image width 1348
resize image resolution 300 resample method none
filter current layer using unsharp mask with options {amount:80, radius:3.2, threshold:0}
--add save to lowResFolder with same options
save in (localBrandFolder_Low_Res & name) as JPEG with options myOptions without copying
set newFile to file path
set newFile2 to newFile as string -- for testing end of name
if newFile2 ends with "_2.jpg" or newFile2 ends with "_3.jpg" then -- exclude website_images
my duplicateFile(newFile, {networkBrandFolder_Low_Res, ftpBrandFolder_Low_Res})
else
my duplicateFile(newFile, {networkBrandFolder_Low_Res, ftpBrandFolder_Low_Res, website_images})
end if
close saving no
end tell
on error
set noError to false
my myLogs(thefile) -- write path to log file in Desktop
try
close saving no --if exists, close current document
end try
end try
end tell
end repeat
--End BH
-- else if and the rest of the script.....
end repeat
if not noError then do shell script "/usr/bin/open ~/Desktop/LogPhotoshopError.txt'"
on myLogs(t)
try
do shell script "echo " & (quoted form of t) & ">> ~/Desktop/LogPhotoshopError.txt'"
end try
end myLogs
on duplicateFile(tFile, foldersPath) -- tFile is an alias, foldersPath is a list of folder
tell application "Finder" to repeat with folderPath in foldersPath
with timeout of 200 seconds -- adjust it, error if the copy is longer that 200 seconds
duplicate tFile to folder folderPath with replacing
end timeout
end repeat
end duplicateFile
on getFolderPath(tName, folderPath)
tell application "Finder" to tell folder folderPath
if not (exists folder tName) then
return (make new folder at it with properties {name:tName}) as string
else
return (folder tName) as string
end if
end tell
end getFolderPath
tell application "Finder"
open "Hal 9000:Users:matthew:Desktop:LogPhotoshopError.txt"
end tellHi,
I think that's what you want.
I put the dialog in the beginning, so it does not appear to each folder, otherwise put it in the loop as it was originally.
property type_list : {"8BPS"}
property extension_list : {"psd"}
script o
property theseNames : {}
end script
-- empty log file
do shell script "echo 'Files not processed in Photoshop :' > ~/Desktop/LogPhotoshopError.txt"
set noError to true
--at the beginning of the script, ask whether to replace or skip existing files? to apply to all?
--use the result for the if file exists?
display dialog "Should I replace or skip exisiting files?" buttons {"Replace", "Skip (Faster)"} default button 2 with icon 1
set skipFiles to (button returned of the result) is "Skip (Faster)"
--Setup list of folders and process details of folders
set dtF to paragraphs of (do shell script "ls -F ~/Desktop | grep '/' | cut -d'/' -f1")
set tc to (count dtF)
repeat with i from 1 to tc
set folderName to item i of dtF --<: is the folder name, no need to use text item delimiters -->":"
if folderName does not start with "2_" and folderName does not start with "Hot" and folderName does not start with "Press" and folderName does not start with "Design" and folderName does not start with "Keywords" and folderName does not start with "Season" and folderName does not start with "Sue" and folderName does not start with "Design" then
set {oldTID, my text item delimiters} to {my text item delimiters, "_WK"}
set FolderEndName to last text item of folderName
set brandName to first text item of folderName
set my text item delimiters to "_PSD"
set weekNumber to first text item of FolderEndName
set my text item delimiters to oldTID
set theFolder to ("Hal 9000:Users:matthew:Desktop:" & folderName)
--set up names to destination folders and create locally based on brand name and week number
set this_local_folder to "Images:2012-2013"
set localWeekFolder to my getFolderPath("WK" & weekNumber, this_local_folder)
set localBrandFolder to my getFolderPath(brandName, localWeekFolder)
set localBrandFolder_Low_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", localBrandFolder)
set localBrandFolder_High_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_HR", localBrandFolder)
set localBrandFolder_PSD to my getFolderPath(brandName & "_WK" & weekNumber & "_PSD", localBrandFolder)
set this_Network_folder to "GEN:Brands:Zoom:Brand - Zoom:Upload Photos:2013:"
set networkWeekFolder to my getFolderPath("Week" & weekNumber, this_Network_folder)
set networkBrandFolder_Low_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", networkWeekFolder)
set website_images to "GEN:Website_Images:"
--set up names to destination folders and create over Netwrok for FTP collection (based on a mounted drive)
set this_ftp_folder to "pulse:"
set ftpWeekFolder to my getFolderPath("Week" & weekNumber, this_ftp_folder)
set ftpBrandFolder to my getFolderPath(brandName, ftpWeekFolder)
set ftpBrandFolder_Low_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", ftpBrandFolder)
set ftpBrandFolder_High_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_HR", ftpBrandFolder)
--taking the folder identify which process it must follow.
if brandName is equal to "BH" then
try
tell application "Finder" to set o's theseNames to (name of files of alias theFolder whose file type is in the type_list or name extension is in the extension_list)
on error
set o's theseNames to {} -- no psd files or "8BPS"
end try
set numOfNames to (count o's theseNames)
repeat with j from 1 to numOfNames
set thefile to theFolder & ":" & (item j of o's theseNames)
-- B H Folder Photoshop Process
tell application "Finder" to set b to exists file (localBrandFolder_PSD & item j of o's theseNames)
if b and not skipFiles then -- file exists and "replace" (continue the rest of the script).
tell application "Adobe Photoshop CS5.1"
-- I remove the command activate, Photoshop stay in background
set ruler units of settings to pixel units
try
open (alias thefile) showing dialogs never
set origName to name of current document
set myOptions to {class:JPEG save options, quality:12}
set myPSDOptions to {class:Photoshop save options, embed color profile:true, save layers:true}
tell current document
--If the quick mask mode has been left on then delete the channel Quick Mask
if (quick mask mode) then delete channel ¬
"Quick Mask"
--If the Layer is incorrectly labeled with Original Layer it needs renaming to original Image
if (exists layer "Original Layer") then ¬
tell layer "Original Layer" to set name to "Original Image"
save in (localBrandFolder_PSD & origName) as Photoshop format with options myPSDOptions without copying
(delete layer "Original Image") flatten
resize image resolution 300 resample method none
--sharpen image
filter current layer using unsharp mask with options {amount:80, radius:3.2, threshold:0}
save in (localBrandFolder_High_Res & name) as JPEG with options myOptions without copying
--get file path, return path of the JPEG file, work with (without copying)
-- (with copying) : it return path of PSD file
set newFile to file path --( return path of type alias )
-- duplicate file using the Finder -->on duplicateFile(..)
my duplicateFile(newFile, {ftpBrandFolder_High_Res})
--Prepare for Low RES by resetting image history
set current history state to history state 3
flatten
resize image width 1348
resize image resolution 300 resample method none
filter current layer using unsharp mask with options {amount:80, radius:3.2, threshold:0}
--add save to lowResFolder with same options
save in (localBrandFolder_Low_Res & name) as JPEG with options myOptions without copying
set newFile to file path
set newFile2 to newFile as string -- for testing end of name
if newFile2 ends with "_2.jpg" or newFile2 ends with "_3.jpg" then -- exclude website_images
my duplicateFile(newFile, {networkBrandFolder_Low_Res, ftpBrandFolder_Low_Res})
else
my duplicateFile(newFile, {networkBrandFolder_Low_Res, ftpBrandFolder_Low_Res, website_images})
end if
close saving no
end tell
on error
set noError to false
my myLogs(thefile) -- write path to log file in Desktop
try
close saving no --if exists, close current document
end try
end try
end tell
end if -- else "Skip" the file and move on to next
end repeat
--End BH
end if
end if
end repeat
if not noError then do shell script "/usr/bin/open ~/Desktop/LogPhotoshopError.txt'"
on myLogs(t)
try
do shell script "echo " & (quoted form of t) & ">> ~/Desktop/LogPhotoshopError.txt'"
end try
end myLogs
on duplicateFile(tFile, foldersPath) -- tFile is an alias, foldersPath is a list of folder
tell application "Finder" to repeat with folderPath in foldersPath
with timeout of 200 seconds -- adjust it, error if the copy is longer that 200 seconds
duplicate tFile to folder folderPath with replacing
end timeout
end repeat
end duplicateFile
on getFolderPath(tName, folderPath)
tell application "Finder" to tell folder folderPath
if not (exists folder tName) then
return (make new folder at it with properties {name:tName}) as string
else
return (folder tName) as string
end if
end tell
end getFolderPath
tell application "Finder"
open "Hal 9000:Users:matthew:Desktop:LogPhotoshopError.txt"
end tell -
Autoload file when app is launched?
How do I have an application open a certain file every time that app is launched?
Is the application hard-coded into the device? If so there's not much you can do to change it. If the application is in Login Items then you can replace the application with the document. Otherwise you need to contact the manufacturer's tech support for help.
Maybe you are looking for
-
TNSNAMES.ORA for Oracle database 11.1.0.7
Hi, Im installed oracle database 11.1.0.7 ,but unable find the TNSNAMES.ORA File.Can any help on this.
-
Procedure to define screen variant
Hi all, Please explain the complete procedure to define screen variant for fast data entry.
-
I have Nokia 6681 While I was upgrading mobile software through "Nokia software updater " my cell got disconnected from the PC after that Nokia Software updater reported an error "Failed to update software". I tried many times but problem is still th
-
eyedropper tool in CC converts 1c black to 4 colour grey. overprint black panel now converts 1c black to 4 colour grey. infuriating!!!!
-
Just installed but it wont detect M-Audio Firewire NRV10 Mixer. Contacting M-Audio for advice , but does anyone else have external firewire device issues?