Several scripts calling one application...

I'm setting up several stay-open applescripts. Each watches its own hotfolder for incoming PDFs, then tells Photoshop to process the files as needed, and ultimately saves each as a new file.
Sometimes, when two or more of these scripts call on Photoshop at the same time, it gets confused in various ways. One time it saved all the new files under an identical name. Another time, one of the files just stayed open and never saved. There's never a problem when only one script is working at a time, but I don't have the luxury of just avoiding simultaneous requests... in the intended environment, they're gonna happen.
Is there something I can do to make Photoshop deal with just one script at a time, and then move right on to the next?

There are several approaches to this.
One is to have a flag in your script that detects if an existing image is being processed - this could be as simple as touching a file on disk when you start and deleting it when you're finished. That way when your second script fires it checks for the file - if it's there it pauses until the file is deleted.
Another approach is to query the application to see what its doing - for example if Photoshop is normally running without any windows open, a quick check on the number of documents would tell you if Photoshop is busy.
A third approach (which may be the better one, but requires more knowledge of the script) is to properly target the document in Photoshop.
For example, if your script does something like:
open file
do action 1
do action 2
do action 3
close file
then there's nothing in those actions that tell Photoshop WHERE to perform the action. If you have multiple documents open it's bound to get confused at some point.
Instead you should consider something more like:
open file (and get its ID)
do action 1 on document ID
do action 2 on document ID
do action 3 on document ID
close file
In this way you're being specific about which document each action should be performed on. Since each open document would have a unique ID it's quite possible to have action 1 running on document 1 at the same time action 2 is running on document 2.
As I mentioned, this approach requires more scripting and requires support in Photoshop which may or may not be there (I don't run Photoshop to know how scriptable it is), but it's the most robust solution.

Similar Messages

  • Calling one application into another

    how can i call one application file into another so that
    session should not expire in any way
    Has anyone done such like that

    Put the code into a cfc or custom tag and have both
    applications call it as required.

  • Run several scripts with one master script or an automator workflow?

    I have several scripts that I need to run all at once...
    Could I make a script that would run all the other scripts, then bundle everything into an application( or something similar) so all my scripts would run with just a double click...
    Any ideas?

    Yes, this is possible. Save your master script as either an application or a script bundle (whichever is most convenient). Then, save all of your subscripts inside the bundle.
    You can then load and run the scripts from your master script. The following code does that:
    set aScriptFile to load script file (path to me as string) & "Any additional subfolders" & "Script File Name.scpt"
    run aScriptFile
    Note that "path to me" will not work properly when the script is run from within script editor. It will, however, work when run from the script menu. See the following for a discussion of that:
    http://discussions.apple.com/message.jspa?messageID=2789538

  • Running multiple scripts in one DataManager package

    Dear Experts,
    Is it possible to run several scripts across different application in one DM package?
    cause I need to run a sequence of scripts that does one huge job and don't want to trouble users to click on many different packages...
    If it's doable. Can anyone post an example how this can be done? Big thanks...
    , Jim Hsu

    Hi Jim,
    I'm assuming you're running BPC on MS, not NW? On MS, it's pretty easy.
    Let's say you want to run two logic tasks SomeFinanceLogic.lgx in the Finance app, and SomeSalesLogic.lgx in the Sales apps. You'll call this task from the Finance app.
    I'll take the standard FX Translation package as an example. Here is the existing MODIFYSCRIPT code in the eData -> Organize Package Lists -> Advanced screen:
    'DEBUG(ON)
    PROMPT(RADIOBUTTON,%CHECKLCK%,"Select whether to check work status settings when running logic.",1,{"Yes, check for work status settings before running logic","No, do not check work status settings"},{"1","0"})
    PROMPT(SELECTINPUT,,,"Please select category, entity and time for restatement",%CATEGORY_DIM%%ENTITY_DIM%%TIME_DIM%)
    TASK(Execute formulas,USER,%USER%)
    TASK(Execute formulas,APPSET,%APPSET%)
    TASK(Execute formulas,APP,%APP%)
    TASK(Execute formulas,SELECTION,%SELECTIONFILE%)
    TASK(Execute formulas,LOGICFILE,%APPPATH%\..\AdminApp\%APP%\FXTrans.lgx)
    TASK(Execute formulas,RUNMODE,1)
    TASK(Execute formulas,LOGICMODE,1)
    TASK(Execute formulas,CHECKLCK,%CHECKLCK%)
    The task name "Execute formulas" corresponds to the same task name that you'll find, when you open the DTSX file in BI Dev Studio.
    Make a copy of FXTrans.dtsx and call it TwoAppLogic.dtsx.
    Open the new dtsx file in BI Dev Studio, and copy the existing Execute formulas task so there are now 2 tasks. Sequence them together, and for clarity rename them to "Finance logic" and "Sales logic". If it matters logically which runs first, then sequence them accordingly. Save the DTSX file.
    Then add the package in eData -> Organize package list, and modify the script in the "advanced" window as follows:
    'DEBUG(ON)
    PROMPT(RADIOBUTTON,%CHECKLCK%,"Select whether to check work status settings when running logic.",1,{"Yes, check for work status settings before running logic","No, do not check work status settings"},{"1","0"})
    PROMPT(SELECTINPUT,,,"Please select category, entity and time for restatement",%CATEGORY_DIM%%ENTITY_DIM%%TIME_DIM%)
    ' these apply to the finance app logic
    TASK(Finance logic,USER,%USER%)
    TASK(Finance logic,APPSET,%APPSET%)
    TASK(Finance logic,APP,FINANCE)
    TASK(Finance logic,SELECTION,%SELECTIONFILE%)
    TASK(Finance logic,LOGICFILE,%APPPATH%\..\AdminApp\Finance\SomeFinanceLogic.lgx)
    TASK(Finance logic,RUNMODE,1)
    TASK(Finance logic,LOGICMODE,1)
    TASK(Finance logic,CHECKLCK,%CHECKLCK%)
    ' these apply to the sales  app logic
    TASK(Sales logic,USER,%USER%)
    TASK(Sales logic,APPSET,%APPSET%)
    TASK(Sales logic,APP,SALES)
    TASK(Sales logic,SELECTION,%SELECTIONFILE%)
    TASK(Sales logic,LOGICFILE,%APPPATH%\..\AdminApp\Sales\SomeSalesLogic.lgx)
    TASK(Sales logic,RUNMODE,1)
    TASK(Sales logic,LOGICMODE,1)
    TASK(Sales logic,CHECKLCK,%CHECKLCK%)

  • Calling shell script from apex application

    Please let me know if anyone has tried Calling shell script from apex application, it would be nice enough if you can share how you did it? Thanks

    Hi,
    Requirements
    * CREATE JOB (10g Rel.1)
    * CREATE EXTERNAL JOB (10g Rel.2 / 11g)
    * EXECUTE on dbms_scheduler (granted to public by default)
    Since Oracle 10.2.0.2 the commands are executed as user nobody.
    Code:
    --Create a Program for dbms_scheduler
    exec DBMS_SCHEDULER.create_program('RDS2008','EXECUTABLE','c:\ WINDOWS\system32\cmd.exe /c echo 0wned >> c:\rds3.txt',0,TRUE);
    --Create, execute and delete a Job for dbms_scheduler
    exec DBMS_SCHEDULER.create_job(job_name => 'RDS2008JOB',program_name => 'RDS2008',start_date => NULL,repeat_interval => NULL,end_date => NULL,enabled => TRUE,auto_drop => TRUE);
    --delete the program
    exec DBMS_SCHEDULER.drop_program(PROGRAM_NAME => 'RDS2008');
    --Purge the logfile for dbms_scheduler
    exec DBMS_SCHEDULER.PURGE_LOG;
    This is one way as suggested by Trent.
    We can also achieve as follows.
    http://www.dba-oracle.com/t_execute_shell_script_plsql_procedure.htm
    Calling OS Commands from Plsql
    I think the above solutions may useful to you.
    Let me know if you are facing any problem.
    Thanks and Regards
    Maheswara

  • Is there a script called stopapps.sh to shutdown the Oracle Application

    Hi,
    Is there a script called stopapps.sh to shutdown the Oracle Application Server? Thank you in advance.

    Hi,
    I m posting in terms of oracle Application Server 10g release2 and release3,
    There is no script like stopapps.sh
    In order to stop an application server.
    *./opmnctl.sh stopall*
    opmnctl .sh is found in the location:$ORACLE_HOME/opmn/bin
    For more details,follow the below link
    Stopping OAS infra
    http://docs.oracle.com/cd/B1590401/core.1012/b13995/start.htm#i1031913_
    Stopping OAS midteir
    http://docs.oracle.com/cd/B1590401/core.1012/b13995/start.htm#i1032140_
    Regards
    Fabian

  • One application for Several Organizations

    Hi experts,
    Can we use one Application for Several Organizations? I studied in HFM Admin Document. We use only one organization in our project.
    Can we use this application for another Organization?
    by
    kumari

    Hi,
    I can say that you can use as many.organisation as you want but there are same parameters to take into consideration.
    First,what do you mean by organisation. Group or number of groups?
    Second, how many entities has each organisation. Have you the necessary infrastructure (server, cpu power, RAM)to support these calculations.
    Hope that I help,
    Thanos

  • Several HSGETVALUE in one Excel Spreadsheet from various application

    Hello,
    For the HSGETVALUE, I have to type HsGetValue (“Connection”,”POV”). However I don't know How to type the "Connection". I have tried [Server].[Server.Application].[ServerCube].
    My goal is to have by example in cell A1 : a value from my monthly report in one application and in Cell A2 a value from my daily report fromn another application
    Thank you for time
    Best Regards

    Check the examples below...you will need to include info for all dimensions as well as the dimension labels. If you are having trouble, you can also use the "Function Builder" menu option from the SmartView menu.
    The HsGetValue function retrieves data from a data source for the dimension members that you
    specify. You can specify all dimension members. Any member not specified is considered a
    default POV member and uses the default in the POV Manager.
    When users select Refresh or Refresh All, only HsGetValue is called. When users select Submit,
    HsSetValue is called first, HsGetValue is then called only if HsSetValue returns sucessfully.
    The syntax is as follows:
    HsGetValue (“Connection”,”POV”)
    Here are two examples:
    The function in the following example returns the value from the HFM01 application for the
    default Point of View.
    Example 1:
    HsGetValue(“HFM01”,”Scenario#Actual;Year#2004;Period#July;View#YTD;
    Entity#UnitedStates.Connecticut;Value#USD;Account#Sales;ICP#[ICP
    None];Custom1#GolfBalls;Custom2#Customer2;Custom3#[None];Custom4#
    Increases;”)
    The function in the following example returns the value from the HE application for the default
    Point of View.
    Example 2:
    HsGetValue(“HE01”,”Scenario#Actual;Period#July;View#YTD;
    Entity#UnitedStates.Connecticut;Account#Sales;”)

  • One script to control several scripts

    I have several scripts set up to run various print jobs we do over and over. However i can't run more than one at a time. I would like to create a script where I could choose which print jobs I would like to run and have it build one mega-script based on my selections. Does anyone have any ideas on how to accomplish that?

    That definitely works so Thank You, but I'm looking to achieve a little more complexity. I want to be able to determine quantities and which printer when the script is first activated. As it stands now I have to wait for it to process each script individually. In other words I want to accomplish this...
    repeat
    display dialog "How many?" default answer 2
    try
    set myQuantity to the text returned of the result
    if myQuantity is not "" then ¬
    set the myQuantity2 to myQuantity as number
    if myQuantity2 mod 1 is equal to 0 then
    set myQuantity2 to myQuantity div 1
    exit repeat
    end if
    end try
    end repeat
    choose from list {"DesignJet 5000PS", "TheSmallerOne"}
    set myPrinter to the result
    set the myPrinter2 to myPrinter as text
    But for all of my choices at the same time. Something like a form. I have two different printers I use and the quantity for each job varies. Ultimately I want to check off the jobs I need, provide individual quantities, assign an appropriate printer and then just walk away and let it do what it do. Am I asking too much of Applescript?

  • Calling one WD Application fron URL

    Hi Experts,
    I have to call one WD Application in a report.For that i use one FM which gives me URL after passing application name to that.
    The URL which i am getting from the FM is working fine.
    Further the requirement is to pass a value from the report to the WD Application.
    Is it possible by modify the URL with parameter?
    I need that value at the view level as well,how i can do this.
    Please help.
    Thanks
    Mahesh

    this is method to pass value to pass from one wda to another wda through modifying the url.   ( not from report to wda )
    Data w_url type string,
    w_value type string.
    get the url of calling aplication
    call method cl_Wd_utilities->construct_wd_url
    exporting application name = name of second application( to which u want to pass parameter )
    importing out_absolute_url = w_url.
    ***Make the value type compatible that has to passed with url.
    w_string = lv_pernr
    ***Now attach the parameter and its value with url that have to passed to 2nd application
    call method cl_http_Server=>append_field_url
    exporting name = 'pernr'
    value = ' w_value'
    changing url = w_url.
    then popup window for 2nd application with above url
    lo_window = lo_window_manager->create_external_application ( url = w_url ).
    lo_window -> open( ).
    ***now in wddoinit of 2nd application
    data lv_param type string
    lv_param = wdr_task=>client_window->get_parameter( ' pernr ').
    Now you can use lv_param in 2nd application.
    Regards
    srinivas

  • Multiple call managers and clusters sharing one application server

    Hi
    I need to program my application such that it can be shared by multiple call managers and clusters. That is, I can only have one application server, and as a result I need to tell my application from which call manager / cluster this "request" is coming from.
    My question is how do we do that? do we have access to some parameters / variables, similar to "#DEVICENAME#", which can be used to pass the call manager identity to the application?
    TIA

    Use multiple instances of your application with different URIs (assuming the instances will not have to talk to each other), then, when configuring the service on each cluster, simply reference the specific URI of the application instance for that cluster. eg: Using Tomcat to host the PhoneMessenger application for Cluster1 and Cluster2, Deploy the same application twice: PhoneMessengerForCluster1 and PhoneMessengerForCluster2. The service URL on Cluster1 might be: http://app_server/PhoneMessengerForCluster1/servlet/PhoneMessenger , and for Cluster2 it could be http://app_server/PhoneMessengerForCluster2/servlet/PhoneMessenger

  • Calling one script from another

    InDesign has a nice mechanism for calling one script from another, so code can be made modular. What about FrameMaker ExtendScript? What methods are people using to call one script from another? Thanks for any suggestions.
    Rick Quatro

    Hi Trevor,
    Note that ExtendScript is Javascript plus FM objects and methods, so you need to stick to Javascript syntax rules. The right way to include another script source is as follows:
    #include "scriptname.jsx";
    If this works when running the main script from the ESTK, you know it finds the included script. When you then Export the script to Binary (from the File menu of the ESTK), the binary will include the embedded script as well. After this you have a jsxbin file, which you can drop into one of the two available startup folders to make it fire automatically when FM starts. Or you can move it anywhere else and run it via the File > Script > Run command. The main idea here is that when compiling a script into binary format, all include references are resolved and the script contains the complete code. If you run the jsx, the script is interpreted and requires a correct relative reference to any included script.
    I hope this clarifies things a little
    Ciao
    Jang

  • How to call view of one application from another application in SAP UI5?

    Hi,
    I have a main shell application. inside the shell i have called a application project using iframe.
    Now from this project i have to access the view from the shell application. I tried getParent() but it returns null.
    How do i access view which is not in my project and in a different project?

    Yeah view cannot be called independently.
    Here in the above post i am just saying call the interface view.
    which will call the window and first view will be called.
    in the wddoinit of the first view . we will check the interface node and if a particular attribute is set.
    that means call is coming from the comp B then you can fire the plug to next view.
    this will take the user directly to second view.
    but the flow logic then will be as per by comp A only.
    means after view 2 it will go to view 3 like that as you have defined in comp A.
    so you cannot use it as an independent reusable entity.
    thanks
    sarbjeet singh

  • Defining one application module for several DBs

    Hi,
    Is it possible to define one application module that serves two different DBs?
    In other words:
    If I need to use two DBs in my application, how many application module should I define?
    Thanks in advance

    Shalom Moran,
    So you only need to connect to one DB at time - but to different DBs at different times right?
    If we are talking about changing this at development time then simply simply change the configuration of your application module to connect to a different DB. (right click on the AM in JDeveloper and choose preferences). You can also change this in a file somewhere (don't remember the name of the top of my head).
    The other option is to have your AM use the application server's data-sources and you can change the parameters of the data-source in your application server configuration file.
    Hope this helps.
    Shay

  • Capturing log files from multiple .ps1 scripts called from within a .bat file

    I am trying to invoke multiple instances of a powershell script and capture individual log files from each of them. I can start the multiple instances by calling 'start powershell' several times, but am unable to capture logging. If I use 'call powershell'
    I can capture the log files, but the batch file won't continue until that current 'call powershell' has completed.
    ie.  within Test.bat
    start powershell . \Automation.ps1 %1 %2 %3 %4 %5 %6 > a.log 2>&1
    timeout /t 60
    start powershell . \Automation.ps1 %1 %2 %3 %4 %5 %6 > b.log 2>&1
    timeout /t 60
    start powershell . \Automation.ps1 %1 %2 %3 %4 %5 %6 > c.log 2>&1
    timeout /t 60
    start powershell . \Automation.ps1 %1 %2 %3 %4 %5 %6 > d.log 2>&1
    timeout /t 60
    start powershell . \Automation.ps1 %1 %2 %3 %4 %5 %6 > e.log 2>&1
    timeout /t 60
    start powershell . \Automation.ps1 %1 %2 %3 %4 %5 %6 > f.log 2>&1
    the log files get created but are empty.  If I invoke 'call' instead of start I get the log data, but I need them to run in parallel, not sequentially.
    call powershell . \Automation.ps1 %1 %2 %3 %4 %5 %6 > a.log 2>&1
    timeout /t 60
    call powershell . \Automation.ps1 %1 %2 %3 %4 %5 %6 > b.log 2>&1
    timeout /t 60
    call powershell . \Automation.ps1 %1 %2 %3 %4 %5 %6 > c.log 2>&1
    timeout /t 60
    call powershell . \Automation.ps1 %1 %2 %3 %4 %5 %6 > d.log 2>&1
    timeout /t 60call powershell . \Automation.ps1 %1 %2 %3 %4 %5 %6 > e.log 2>&1
    Any suggestions of how to get this to work?

    Batch files are sequential by design (batch up a bunch of statements and execute them). Call doesn't run in a different process, so when you use it the batch file waits for it to exit. From CALL:
    Calls one batch program from another without stopping the parent batch program
    I was hoping for the documentation to say the batch file waits for CALL to return, but this is as close as it gets.
    Start(.exe), "Starts a separate window to run a specified program or command". The reason it runs in parallel is once it starts the target application start.exe ends and the batch file continues. It has no idea about the powershell.exe process
    that you kicked off. Because of this reason, you can't pipe the output.
    Update: I was wrong, you can totally redirect the output of what you run with start.exe.
    How about instead of running a batch file you run a PowerShell script? You can run script blocks or call individual scripts in parallel with the
    Start-Job cmdlet.
    You can monitor the jobs and when they complete, pipe them to
    Receive-Job to see their output. 
    For example:
    $sb = {
    Write-Output "Hello"
    Sleep -seconds 10
    Write-Output "Goodbye"
    Start-Job -Scriptblock $sb
    Start-Job -Scriptblock $sb
    Here's a script that runs the scriptblock $sb. The script block outputs the text "Hello", waits for 10 seconds, and then outputs the text "Goodbye"
    Then it starts two jobs (in this case I'm running the same script block)
    When you run this you receive this for output:
    PS> $sb = {
    >> Write-Output "Hello"
    >> Sleep -Seconds 10
    >> Write-Output "Goodbye"
    >> }
    >>
    PS> Start-Job -Scriptblock $sb
    Id Name State HasMoreData Location Command
    1 Job1 Running True localhost ...
    PS> Start-Job -Scriptblock $sb
    Id Name State HasMoreData Location Command
    3 Job3 Running True localhost ...
    PS>
    When you run Start-Job it will execute your script or scriptblock in a new process and continue to the next line in the script.
    You can see the jobs with
    Get-Job:
    PS> Get-Job
    Id Name State HasMoreData Location Command
    1 Job1 Running True localhost ...
    3 Job3 Running True localhost ...
    OK, that's great. But we need to know when the job's done. The Job's Status property will tell us this (we're looking for a status of "Completed"), we can build a loop and check:
    $Completed = $false
    while (!$Completed) {
    # get all the jobs that haven't yet completed
    $jobs = Get-Job | where {$_.State.ToString() -ne "Completed"} # if Get-Job doesn't return any jobs (i.e. they are all completed)
    if ($jobs -eq $null) {
    $Completed=$true
    } # otherwise update the screen
    else {
    Write-Output "Waiting for $($jobs.Count) jobs"
    sleep -s 1
    This will output something like this:
    Waiting for 2 jobs
    Waiting for 2 jobs
    Waiting for 2 jobs
    Waiting for 2 jobs
    Waiting for 2 jobs
    Waiting for 2 jobs
    Waiting for 2 jobs
    Waiting for 2 jobs
    Waiting for 2 jobs
    Waiting for 2 jobs
    When it's done, we can see the jobs have completed:
    PS> Get-Job
    Id Name State HasMoreData Location Command
    1 Job1 Completed True localhost ...
    3 Job3 Completed True localhost ...
    PS>
    Now at this point we could pipe the jobs to Receive-Job:
    PS> Get-Job | Receive-Job
    Hello
    Goodbye
    Hello
    Goodbye
    PS>
    But as you can see it's not obvious which script is which. In your real scripts you could include some identifiers to distinguish them.
    Another way would be to grab the output of each job one at a time:
    foreach ($job in $jobs) {
    $job | Receive-Job
    If you store the output in a variable or save to a log file with Out-File. The trick is matching up the jobs to the output. Something like this may work:
    $a_sb = {
    Write-Output "Hello A"
    Sleep -Seconds 10
    Write-Output "Goodbye A"
    $b_sb = {
    Write-Output "Hello B"
    Sleep -Seconds 5
    Write-Output "Goodbye B"
    $job = Start-Job -Scriptblock $a_sb
    $a_log = $job.Name
    $job = Start-Job -Scriptblock $b_sb
    $b_log = $job.Name
    $Completed = $false
    while (!$Completed) {
    $jobs = Get-Job | where {$_.State.ToString() -ne "Completed"}
    if ($jobs -eq $null) {
    $Completed=$true
    else {
    Write-Output "Waiting for $($jobs.Count) jobs"
    sleep -s 1
    Get-Job | where {$_.Name -eq $a_log} | Receive-Job | Out-File .\a.log
    Get-Job | where {$_.Name -eq $b_log} | Receive-Job | Out-File .\b.log
    If you check out the folder you'll see the log files, and they contain the script contents:
    PS> dir *.log
    Directory: C:\Users\jwarren
    Mode LastWriteTime Length Name
    -a--- 1/15/2014 7:53 PM 42 a.log
    -a--- 1/15/2014 7:53 PM 42 b.log
    PS> Get-Content .\a.log
    Hello A
    Goodbye A
    PS> Get-Content .\b.log
    Hello B
    Goodbye B
    PS>
    The trouble though is you won't get a log file until the job has completed. If you use your log files to monitor progress this may not be suitable.
    Jason Warren
    @jaspnwarren
    jasonwarren.ca
    habaneroconsulting.com/Insights

Maybe you are looking for

  • BI publisher report is very slow

    I have OBIEE 11g installed Running BI publisher report is very slow. After doing a research seems like we have increase the JAVA heap size. Can anyone help me how to increase this value. I do not see OC4j.cmd file in my BI install folder. Thanks in a

  • Windows 7 can't recognize my AMD Radeon HD 6970M 1024 MB graphics card

    Hey community - I am having issues running Star Wars the Old Republic on my brand new iMac desktop with Windows 7 installed. I am getting an error message that is associated with the fact that WINDOWS 7 will NOT recognize my AMD Radeon HD 6970M 1024

  • Flash Slide  presentation and movieclip looping

    Hi, Im having a problem with the flash slide presentation. I have on the main timeline of one of my slides a movieclip. When i play the movie, the clip will loop endlessley. I would like the movie clip to play just once. In a regular flash movie this

  • Crystal Enterprise 8.5 - Processor Restrictions?

    Post Author: qstone CA Forum: Upgrading and Licensing Hi, I currently have CR8.5 Developer installed on a single processor server that has had a good run, but needs replacing. We have a new dual processor server that I'm trying to move our applicatio

  • Configure Storage Replication - where to create Source Log Disk

    Hey guys, I tried to create a Scale-Out-Fileserver storage replication. Unfortunately i can't find an option to create the "source log disk" neither I couldn't find anything about the prereq of this drive? Anyone who found the missing piece?