Edit a run only script

Can I (And how in the world do I?) edit a script that someone has made as a run only file?

Folder Actions needs to be enabled in order for you to use them. I think by default this is not. If you open AppleScript Utility App you can click the 'Set UP Actions…' button. From here you can manage which folders have what Action Scripts Attached to them. You can also do this via 'ctrl' clicking a folder. Folders with Action Scripts will just sit there until an adding item or removing item event is triggered the script then processes these items. There are also a set of sample scripts that should get you started… You can also put the default scripts into your finder menubar while your there…

Similar Messages

  • Script to export a script as run-only via AppleScript Editor

    Hi,
    I have written a script that's creating a new script and than save it to the desktop as run-only.
    Now Apple has re-written the rules of AppleScript Editor so the run-only command had to go via 'Export' (and not 'Save' anymore).
    I can't figure out how to script it now... I even tried to script the menu's but that's only possible for all menu's without '...' ending it. For example: 'File > New' is scriptable, but 'File > Export...' is not.
    Script 1 is the script I want to get working, but if scripting the Export of AppleScript Editor is not possible, I want to get de workaround of Script 2
    Script 1:
    ==================================================
    set myScript to "
    set studentnumber to \"" & studentnumber & "\"
    set password to \"" & password & "\"
    tell application \"Safari\"
    tell application "AppleScript Editor"
    activate
    make new document with data myScript
              save document 1 as "application" in file ((path to desktop as Unicode text) & "Automatisch Inloggen op GLR.app") with run only
    -- save doesn't work anymore and has to be EXPORT...
              return
    close document 1
    end tell
    =================================================
    Script 2 (workaround, but doesn't work either)
    tell application "AppleScript Editor" to activate
    menu_click({"AppleScript Editor", "File", "Export..."})
    -- 'File > New' works but 'File > Export... not'
    on menu_click(mList)
              local appName, topMenu, r
    -- Validate our input
              if mList's length < 3 then error "Menu list is not long enough"
    -- Set these variables for clarity and brevity later on
              set {appName, topMenu} to (items 1 through 2 of mList)
              set r to (items 3 through (mList's length) of mList)
    -- This overly-long line calls the menu_recurse function with
    -- two arguments: r, and a reference to the top-level menu
              tell application "System Events" to my menu_click_recurse(r, ((process appName)'s ¬
                        (menu bar 1)'s (menu bar item topMenu)'s (menu topMenu)))
    end menu_click
    on menu_click_recurse(mList, parentObject)
              local f, r
    -- `f` = first item, `r` = rest of items
              set f to item 1 of mList
              if mList's length > 1 then set r to (items 2 through (mList's length) of mList)
    -- either actually click the menu item, or recurse again
              tell application "System Events"
                        if mList's length is 1 then
      click parentObject's menu item f
                        else
                                  my menu_click_recurse(r, (parentObject's (menu item f)'s (menu f)))
                        end if
              end tell
    end menu_click_recurse

    Applescript has changed a little. You can now save uncompiled scripts, but it would make no sense to save an uncompiled script as read-only, so trying to do that fails. Add a compile command before the save:
    tell application "AppleScript Editor"
      activate
              set doc to make new document with data myScript
      compile doc
              save doc as "application" in ((POSIX path of (path to desktop)) & "Automatisch Inloggen op GLR.app") with run only
              return
      close doc
    end tell

  • Cannot run SQL script on Oracle Database 10g Express Edition

    I'm trying to upload a script, and the file is being uploaded fine, but in the Script Editor window where I'm going to actually run the script, the entire file content is shown on one line and the whole edit area is in red. I'm not being able to run that script. Also if I create a new script from the editor, the edit area is again in red and I'm not able to save it. Please help me understand what's to be done so that I can run my SQL scripts.

    I'd bet the database is down.
    Try a login through sqlplus ("Run SQL Command Line" in the Oracle Express Edition 'Start' menu).
    Do a CONN / AS SYSDBA
    If you get a message about database or memory area not available, try STARTUP.
    If that doesn't work, you are best off in the General Database forum or the Express Edition forum.
    You'll probably get the most expert response in General Database, but the Express Edition forum can be gentler on newbies (as it is more accepted that questioners are not and do not have access to full-time DBAs).

  • Change Run-Only Application to Editable

    Hello,
    Yesterday i've finished part of my APEX 4 application and, in order to get it tested i edited it's properties to Run-Only.
    Now i want to modify something in it and i can't since it's "Not Editable".
    Any ideea how can i change it to be editable again?
    Kind Regards,
    Cearnau Dan

    Hi,
    Documentation might help
    http://download.oracle.com/docs/cd/E17556_01/doc/admin.40/e15521/adm_mg_wrkspc.htm#sthref452
    Regards,
    Jari
    Edited by: jarola on Oct 27, 2010 4:19 PM
    Also
    http://download.oracle.com/docs/cd/E17556_01/doc/user.40/e15517/bldr.htm#sthref438

  • Run a script only at shutdown (not log off or restart)

    Hi,
    Is there any way to run a script only at shutdown?
    I mean, only when the computer is really shutting down to off state. This script should not run when doing just a log off or restart.
    Any help really appreciated. Thank you!
    Cheers!

    Hi,
    The problem is that the standard scripts can't differentiate between a restart and a complete shutdown.
    If there's no separate shutdown/power off script (I'm not aware of any), maybe there's some method to detect within a script what is actually in process.
    Cheers!

  • Create a user who can run only 'rman script'

    Dear Friends ,
    I have created a 'rmanback; user who only can run the RMAN script only . I have created user like follwoing way :
    1)
    SQL> CREATE USER rmanback IDENTIFIED BY rmanback;
    User created.
    SQL> GRANT RECOVERY_CATALOG_OWNER TO rmanback;
    Grant succeeded.
    SQL> GRANT CONNECT, RESOURCE TO rmanback;
    Grant succeeded.
    2)
    And My rman script is :
    rman target rmanback/rmanback@orcl <<!
    run
    allocate channel t1 type disk;
    backup format 'df_%t_%s_%p'
    (database);}
    3) And I make a situation where sys user cannot enter the database using its password . For this reason i give the follwoing entry in "sqlnet.ora" :
    SQLNET.AUTHENTICATION_SERVICES=(NONE)
    Now when I run the script then it shows the follwing error :
    [oracle@localhost RMAN]$ sh rman.sh.copy
    Recovery Manager: Release 10.1.0.3.0 - Production
    Copyright (c) 1995, 2004, Oracle. All rights reserved.
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-00554: initialization of internal recovery manager package failed
    RMAN-04005: error from target database:
    ORA-01031: insufficient privileges
    Now plz tell me where is the problem . If I make any mistake then plz inform me .....
    Thx
    -----

    SYSOPER is a privilege that is not enough for recovery manager. Talking about SYSOPER privileges to perform a backup/recover operation from a sqlplus prompt, SYSOPER can perform backup operations, but when recovery is required, the only kind of recover it can perform is a complete recover, if the user requires any kind of incomplete recover it won't be possible since SYSOPER cannot issue neither of until time|change|cancel|controlfile operations, which require the user to connect with the SYSDBA role.
    If you attempt to connect to the database by means of recovery manager with an account with SYSOPER role, you will get the following error:
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS===============
    RMAN-00571: ===========================================================
    RMAN-00554: initialization of internal recovery manager package failed
    RMAN-04005: error from target database:
    ORA-01031: insufficient privilegesFor the OP, there is no way to create some sort of operator accout, since this will have to connect as SYSDBA to perform all operations required by recovery manager, you will absolutely have to rethink your security strategy, and as I previously posted, you should use OS authentication and protect access to the host server.
    ~ Madrid
    http://hrivera99.blogspot.com/

  • Firefox seems to run in script only

    when i log on to Firefox seems to run in script only it the same when i load any other web page such as the BBC news
    Internet Explorer runs fine

    Clear the cache and the cookies from sites that cause problems.
    "Clear the Cache":
    *Tools > Options > Advanced > Network > Offline Storage (Cache): "Clear Now"
    "Remove Cookies" from sites causing problems:
    *Tools > Options > Privacy > Cookies: "Show Cookies"
    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.org/kb/Safe+Mode

  • Help editing the imageTracing.jsx Script

    Hello, I am looking for guidance on how to properly edit the imageTracing.jsx script in Illustrator CC. At the moment it only defaults to using a basic black and white trace, I need the trace to use one of my presets, expand the trace and save it. I need to run thousands of frames of bitmap animation through a batch trace process essentially. I've tried to batch it through Bridge, but it just throws up and error (59 I believe) and I've set up an action to try and batch that way but it never completes the batch by expanding the trace.
    I've tried editing the script myself, but if I change the preset numeral it appears to break the save and close functionality of the script. Not quite sure what I am doing wrong. I've also tried adding a line for expanding the trace but I may be using the wrong syntax  --- tracing.expandTracing(); ---
    Below is the default script as shipped with Illustrator, no changes made.
    // Main Code [Execution of script begins here]
    // uncomment to suppress Illustrator warning dialogs
    // app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;
    // Collectable files
    var COLLECTABLE_EXTENSIONS = ["bmp", "gif", "giff", "jpeg", "jpg", "pct", "pic", "psd", "png", "tif", "tiff"];
    var destFolder, sourceFolder;
    // Select the source folder
    sourceFolder = Folder.selectDialog( 'Select the SOURCE folder...', '~' );
    //sourceFolder = new Folder("C:/Users/<Username>/Desktop/1");
    if(sourceFolder != null)
        // Select the destination folder
        destFolder = Folder.selectDialog( 'Select the DESTINATION folder...', '~' );       
        //destFolder = new Folder("C:/Users/<Username>/Desktop/2");
    if(sourceFolder != null && destFolder != null)
            //getting the list of the files from the input folder
            var fileList = sourceFolder.getFiles();
            var errorList;
            var tracingPresets = app.tracingPresetsList;
            for (var i=0; i<fileList.length; ++i)
                if (fileList[i] instanceof File)
                     try
                            var fileExt = String(fileList[i]).split (".").pop();
                            if(isTraceable(fileExt) != true)
                                continue;
                            // Trace the files by placing them in the document.
                            // Add a document in the app
                            var doc = app.documents.add();
                            // Add a placed item
                            var p = doc.placedItems.add();
                            p.file = new File(fileList[i]);
                            // Trace the placed item
                            var t = p.trace();
                            t.tracing.tracingOptions.loadFromPreset(tracingPresets[3]);
                            app.redraw();
                            var destFileName = fileList[i].name.substring(0, fileList[i].name.length - fileExt.length-1) + "_" +fileExt;
                            var outfile = new File(destFolder+"/"+destFileName);
                            doc.saveAs(outfile);
                            doc.close();
                    catch (err)
                            errorStr = ("Error while tracing "+ fileList[i].name  +".\n" + (err.number & 0xFFFF) + ", " + err.description);
                            // alert(errorStr);
                            errorList += fileList[i].name + " ";
           fileList = null;
           alert("Batch process complete.");
    else
           alert("Batch process aborted.");
    sourceFolder = null;
    destFolder = null;
    function isTraceable(ext)
         var result = false;
         for (var i=0; i<COLLECTABLE_EXTENSIONS.length; ++i)
              if(ext == COLLECTABLE_EXTENSIONS[i])
                result = true;
                break;
        return result;
    And this is the amended version with my change to lines 57 and 58.
    // Main Code [Execution of script begins here]
    // uncomment to suppress Illustrator warning dialogs
    // app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;
    // Collectable files
    var COLLECTABLE_EXTENSIONS = ["bmp", "gif", "giff", "jpeg", "jpg", "pct", "pic", "psd", "png", "tif", "tiff"];
    var destFolder, sourceFolder;
    // Select the source folder
    sourceFolder = Folder.selectDialog( 'Select the SOURCE folder...', '~' );
    //sourceFolder = new Folder("C:/Users/<Username>/Desktop/1");
    if(sourceFolder != null)
        // Select the destination folder
        destFolder = Folder.selectDialog( 'Select the DESTINATION folder...', '~' );       
        //destFolder = new Folder("C:/Users/<Username>/Desktop/2");
    if(sourceFolder != null && destFolder != null)
            //getting the list of the files from the input folder
            var fileList = sourceFolder.getFiles();
            var errorList;
            var tracingPresets = app.tracingPresetsList;
            for (var i=0; i<fileList.length; ++i)
                if (fileList[i] instanceof File)
                     try
                            var fileExt = String(fileList[i]).split (".").pop();
                            if(isTraceable(fileExt) != true)
                                continue;
                            // Trace the files by placing them in the document.
                            // Add a document in the app
                            var doc = app.documents.add();
                            // Add a placed item
                            var p = doc.placedItems.add();
                            p.file = new File(fileList[i]);
                            // Trace the placed item
                            var t = p.trace();
                            t.tracing.tracingOptions.loadFromPreset(tracingPresets[1]);
      tracing.expandTracing();
      app.redraw();
                            var destFileName = fileList[i].name.substring(0, fileList[i].name.length - fileExt.length-1) + "_" +fileExt;
                            var outfile = new File(destFolder+"/"+destFileName);
                            doc.saveAs(outfile);
                            doc.close();
                    catch (err)
                            errorStr = ("Error while tracing "+ fileList[i].name  +".\n" + (err.number & 0xFFFF) + ", " + err.description);
                            // alert(errorStr);
                            errorList += fileList[i].name + " ";
           fileList = null;
           alert("Batch process complete.");
    else
           alert("Batch process aborted.");
    sourceFolder = null;
    destFolder = null;
    function isTraceable(ext)
         var result = false;
         for (var i=0; i<COLLECTABLE_EXTENSIONS.length; ++i)
              if(ext == COLLECTABLE_EXTENSIONS[i])
                result = true;
                break;
        return result;
    Thanks in advance for your help, as you can imagine, manually tracing thousands of images for a client job will be a nightmare if I can't sort out a batch.

    hello,
    after line 32 :
    var tracingPresets = app.tracingPresetsList;
    do an alert :
    alert( app.tracingPresetsList );
    it'll show you the name of the differents presets
    then line 57, call the good preset :
    t.tracing.tracingOptions.loadFromPreset('here the name of your preset');
    for expanding :
    change line 58 like that :
    t.tracing.expandTracing();
    you forget (t.) at the beginning
    best wishes for the new year

  • How Can I View an AppleScript File that was Saved as "Run Only"?

    Hello. I would like to view the AppleScript of a file I downloaded. But when I show the package contents, find the script, and try to open it, I get a message saying that the file "main.scpt" could not be opened because it was saved as run-only. How can I view this file?

    Are you using the save version of Illustrator on both Mac and PC? If so, and you have the same fonts installed on both machines you should be able to open it without any problems. You may need to tell it which fonts to assign, they are not always named the same. If you don't need to edit the text, you could convert the text to outline and eliminate the need for fonts.

  • [solved] How to run a script on logout?

    I've just migrated from ubuntu and so far I'm really happy with Arch. GNU/Linux really is easier to 'get' with Arch. I've been able to overcome all problems so far with reading previous posts or searching for it by other means, yet this obviously elementary broblem still defies solution.
    - How do I run a script on logout?
    What I want to do on logout is to run 'fusermount -u ~/mounted-dir/', where 'mounted-dir' holds media from my account on another host. I have it set up so that /etc/profile runs ~/.login which in turn runs 'sshfs [email protected]:~/media/ ~/mounted-dir/ -o sshfs_sync -o reconnect'.
    - Is this a reasonable way of Getting Things Done?
    I suspect (as I always do) that there might be a way these things are supposed to be done, this not being it.
    Last edited by pooflinger (2007-10-05 10:05:29)

    pooflinger wrote:
    _adam_ wrote:
    the problem with .bash_logout is it will run whenever you exit a bash instance.
    are you using a desktop environment? do you just want this to happen prior to shutdown? or when you actually log out?
    I pretty sure that .bash_logout only runs if $SHELL is /bin/bash when you log out. I want this to happen when I actually log out.
    yeah, sorry, i forgot its only executed when a login shell is used.

  • Firefox profile got corrupted? can't run cgi scripts anymore

    Something happened recently that hosed my ability to run cgi scripts from my firefox profile.  If I browse to my local webserver at http://localhost/blah I was able to run a cgi script.  Now for some reason, firefox asks me if to save the script rather than running it.
    Opening monitorix.cgi
    You have chosen to open monitorix.cgi
    which is a: BIN file
    from: http://localhost
    Would you like to save this file?
    [Cancel] [Save File]
    If I load firefox with a fresh profile, I am able to run the cgi script with no such problems.  I don't want to create a new profile to solve this.  Does anyone know which setting controls this behavior so I can fix it?
    Thanks!
    EDIT: this is too weird.  If I browse to http://reborn/blah (reborn is the hostname of my local PC) rather than http://localhost/blah, the script runs just fine!  What's going on?  Again, this localhost problem only affect my user's firefox profile.
    Last edited by graysky (2010-02-06 19:52:44)

    Same thing seems to be true when I try connecting to other PC's on my LAN.  If I use their hostname I get nothing, if I use their IP it works.
    Browsing to --> http://mars/http will result in firefox trying to connect "transferring data from mars..." and it hangs as such forever.
    Browsing to --> http://192.168.1.101 will result in the page loading perfectly.
    If I repeat the above using a new profile within firefox, everything works!  I'm at a loss to explain it.
    $ cat /etc/hosts
    127.0.0.1 localhost.localdomain localhost reborn
    192.168.0.101 mars
    Last edited by graysky (2010-02-06 19:56:50)

  • Modifying /etc/passwd to run a script (with logging)

    This is not Arch related so feel free to ignore...
    The goal is to modify a users /etc/passwd entry so it runs a script instead of a shell.
    As a proof of concept, this works:
    #!/bin/bash
    read -p "Enter your selection: " selection
    case "$selection" in
    1) /usr/bin/ssh [email protected];;
    *) exit 0;;
    esac
    If I su to a user with that as their "shell" I see the prompt, I can press 1 and login to the remote box
    Then I thought I'd try to add some logging and script became this:
    #!/bin/bash
    read -p "Enter your selection: " selection
    case "$selection" in
    1) /usr/bin/script -c "/usr/bin/ssh [email protected]";;
    *) exit 0;;
    esac
    This does work when run directly at the command line but does not work when set as a users shell in /etc/passwd... it's like it executes the script over and over again.  The output is:
    Enter your selection: 1
    Script started, file is typescript
    Enter your selection: 1
    Script started, file is typescript
    So adding the /usr/bin/script to the mix is causing a problem.
    What is the cause?  I'm assuming it's something to do with subshells but I thought the '-c' would resolve that.
    How can I make it do as expected (without modifying .profile if possible.)  The end-goal is for users to log in and be presented with a list of servers to connect to
    Is there a better way to accomplish this?
    Last edited by oliver (2015-01-20 16:38:11)

    I'm trying to avoid modifying profiles due to the archaic way we handle user accounts at work... it would be one more thing to maintain but it's certainly not impossible.
    I think I will switch to /bin/sh anyway - just used bash out of habit
    And reading the first post back, I'm not sure it's entirely clear... but it works at the command line and only fails when it's set as a user's shell.  I'm not sure what the difference is
    Last edited by oliver (2015-01-20 16:51:48)

  • Run a script every workday

    Hello,
    I have several scripts I need to run every workday. During weekends I need to skip these scripts. I can't figure from launchd and launchd.plist man pages how could I make only one property list for each of these scripts. So I tried this:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    <key>Label</key>
    <string>com.justme.workdaystest</string>
    <key>ProgramArguments</key>
    <array>
    <string>/scripts/workdaystest.command</string>
    </array>
    <key>QueueDirectories</key>
    <array/>
    <key>StartCalendarInterval</key>
    <dict>
    <key>Hour</key>
    <integer>11</integer>
    <key>Minute</key>
    <integer>30</integer>
    <key>Weekday</key>
    <integer>1</integer>
    <key>Weekday</key>
    <integer>2</integer>
    <key>Weekday</key>
    <integer>3</integer>
    <key>Weekday</key>
    <integer>4</integer>
    <key>Weekday</key>
    <integer>5</integer>
    </dict>
    <key>WatchPaths</key>
    <array/>
    </dict>
    </plist>
    That didn't work. Do I need to maintain 5 x plist for each script?
    Juha

    J.Otava wrote:
    Hello,
    From the other topic I found need for arrays. Problem is I'm not sure how to create valid arrays. After some trials and errors I managed to create a valid XML-file, at least launchctl loads it without error messages. But nothing happens.
    Here's the code if someone is interested, should run a script on mondays and tuesdays:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    <key>Label</key>
    <string>com.memyselfandi.ldaemontest3</string>
    <key>ProgramArguments</key>
    <array>
    <string>/scripts/ldaemontest.command</string>
    </array>
    <key>QueueDirectories</key>
    <array/>
    <key>StartCalendarInterval</key>
    <array>
    <dict>
    <key>Hour</key>
    <integer>12</integer>
    <key>Minute</key>
    <integer>0</integer>
    <key>Weekday</key>
    <integer>2</integer>
    </dict>
    <dict>
    <key>Hour</key>
    <integer>12</integer>
    <key>Minute</key>
    <integer>0</integer>
    <key>Weekday</key>
    <integer>3</integer>
    </dict>
    </array>
    <key>WatchPaths</key>
    <array/>
    </dict>
    </plist>
    The array you've made is constructed correctly. if it's not working something else is wrong. check your console messages at the times when the script has to run. see anything? also, check that you load the plist properly.
    P.S. why do you have that empty Watch Path there? it's not doing anything.
    and you have an incorrectly constructed array that starts after QueueDirectories
    and ends after Watchpath. what is it doing there? perhaps that's what's creating the problem?
    My best
    Juha
    Message was edited by: V.K.

  • Run GUI script more than once

    Hi everyone,
    until now I usually asked users to log - in into SAP first and then use some Excel macros to download /modify data in SAP.
    I have now found a neat way of opening SAP by opening a SAP shortcut - which works like a charm. Unfortunately that Charm has a very limited life span - because you are only able to run the macro once. If I want to rerun the macro I receive a Runtimeerror 91: wscript.ConnectObject Session, "on" .
    This is the code I am using:
    Dim SapApplication, SapGuiAuto, Connection, Session, wscript As Object
    Public System As String
    Sub SAP_prepare_sapscript()
    System = "PL1"
        Application.EnableCancelKey = xlDisabled
        PathStrg = "C:\Temp\"
        On Error Resume Next
        Shell ("C:\Program Files\SAP\FrontEnd\SAPgui\"sapshcut.exe " & PathStrg & System & ".sap")
        If Wait_for_Window("SAP Easy Access") = False Then GoTo giveUp 'Separate Macro which waits until SAP is open
        On Error GoTo 0
        If Not IsObject(SapApplication) Then
            On Error Resume Next
            Set SapGuiAuto = GetObject("SAPGUI")
            If Err.Number <> 0 Then
                MsgBox ("Not able to log in")
                NoSap = True
                Err.Clear
                GoTo giveUp
            End If
            Set SapApplication = SapGuiAuto.GetScriptingEngine
        End If
        If Not IsObject(Connection) Then
            Set Connection = SapApplication.Children(0)
        End If
        If Not IsObject(Session) Then
            Set Session = Connection.Children(0)
        End If
        If IsObject(wscript) Then
            wscript.ConnectObject Session, "on"
            wscript.ConnectObject Application, "on"
        End If
        Err.Clear
        Session.findById("wnd[0]").maximize
        run_Sap_Script
        Application.ScreenUpdating = False
        If Err.Number <> 0 Then
            If Err.Number <> 91 Then
                If Err.Number <> 9 Then
                    MsgBox ("There was an error running the Script")
                    Sapok = False
                    Err.Clear
                    GoTo giveUp
                End If
            End If
            Err.Clear
        End If
    giveUp:
        Application.WindowState = xlMaximized
    End Sub
    Sub run_Sap_Script()
            'here I am running my normal SAP commands like opening transactions....
            'log out of SAP    
            Session.findById("wnd[0]/tbar[0]/btn[15]").press
            Session.findById("wnd[1]/usr/btnSPOP-OPTION1").press
            Err.Clear
    End Sub
    Any Idea what needs to be changed?
    Thanks for your help
    Theo
    Edited by: Fettertiger on Jul 29, 2011 3:11 PM

    Hi Theo,
    I know the Problem ...
    Usually it gets me everytime I want to restart a Macro when i've changed som lines for the first time...
    Found out that it is better to Logon with a new Window / Logon
    This can be done by using this code:;
    If Not IsObject(SAPguiApp) Then
    Set SAPguiApp = CreateObject("Sapgui.ScriptingCtrl.1")
    End If
    If Not IsObject(Connection) Then
    Set Connection = SAPguiApp.OpenConnection("SYSTEM", True)
    End If
    If Not IsObject(Session) Then
    Set Session = Connection.Children(0)
    End If
    Session.findById("wnd[0]/usr/txtRSYST-MANDT").Text = "PL1"
    Session.findById("wnd[0]/usr/txtRSYST-BNAME").Text = inputbox("Benutzer")
    Session.findById("wnd[0]/usr/pwdRSYST-BCODE").Text = inputBox("Passwort")
    Session.findById("wnd[0]/usr/txtRSYST-LANGU").Text = "DE"
    Session.findById("wnd[0]/usr/txtRSYST-LANGU").SetFocus
    Session.findById("wnd[0]/usr/txtRSYST-LANGU").caretPosition = 2
    Session.findById("wnd[0]").sendVKey 0
    This always works ...

  • How can I run a script last?

    Hiya,
    I have a single backup job running a single dataset. That single dataset has an include statement to include a dataset directory, which holds individual datasets for the several hosts I want to back up, each with potentially different parameters. This works well, the hosts back up in some order (I don't care), everything's happy.
    However, what I want to do is add a step on the end of this process to run a report on the admin server after all the backups are complete. That is, to run a script once, last.
    If I add an "after backup" command in the dataset, it runs it (as stated in the manual) on the client servers, after every backup, which is no good to me. I've tried creating a separate job and scheduling it at a lower priority a few minutes later than the backup job, but that seems to just run when it feels like it, I presume because there aren't any conflicts so why shouldn't it?
    Can anyone advise how I should be doing this?
    Related question... I've tried putting an "after backup" step on the Catalog backup job, but that appears to get run twice (I presume because there are two "include" steps in the catalog dataset)! Is this expected? How can I get it to just run once, after the catalog backup is complete?
    Thanks,
    David.

    Thanks Donna, but... no. It didn't work.
    We've actually purchased a license for OSB, so I've fired this question at our official support channel now, and they came back with the same answer at the same time (are you the Oracle techie looking at my problem, by any chance?). For the record here's (with some tweaks for readability in this context) what I've sent back in response to that article.
    From the article, I thought perhaps the following might do the trick:
    include dataset /Hosts {
    after backup optional "/usr/local/osb/pre-n-post after-fsd-hosts mail"
    But, from the log:
    2010/11/05.07:26:58 trouble parsing dataset in FSdaily line 1 - open brace appears where not allowed (OB dataset mgr)
    "010/11/05.07:26:58 offending line is "include dataset /Hosts {
    2010/11/05.07:26:58 trouble parsing dataset in FSdaily line 3 - bad nesting (OB dataset mgr)
    "010/11/05.07:26:58 offending line is "}
    So it appears I’m not actually allowed to do that. I don’t understand why that would be.
    The only other idea I have is to include a dummy backup step, backing up something really small (because OSB won’t let you run a backup without backing anything up - sigh!), tack a script onto that, and hope like heck OSB decides that it should run that last. All the documentation I’ve read gives the impression that datasets are all about scope, not order, so I’m not altogether confident that this will work. In any case, it seems a pretty kludgy way of doing it! And, given the next paragraph below, I’m not all that sure it’ll work in any case.
    My idea of scheduling a catalog backup for five minutes later than the client backups, with a lower priority, so that it runs when the client backups finish, also has a flaw - if I use two tape drives in parallel, it runs the catalog job in parallel with the last client job, which is completely useless. I want to put on the end of the tape a backup of the catalog as at just after the client backups, so that in the case of a disaster I can restore that and I’ll be good to restore everything else.
    In addition to being completely useless for the purposes of putting an “after” catalog backup on the end of the tape, it’s also completely useless for the purposes of running a script last - I tried the following:
    include catalog {
    after backup optional "/usr/local/osb/pre-n-post after-catalog mail"
    This ran the pre-n-post script twice, once for each component of the catalog, which is altogether not what I want it to do.
    I can’t think of any way to achieve a catalog backup on the end of the script except for scheduling it for some time later and hoping the dataset backups always finish by then. Ugly.
    The only way I can think to achieve the run-a-script-last is to munge all the datasets together into one humongous dataset file, and do stuff as in the article to try to bend OSB to my will (again, hoping that OSB obeys the order of statements in the dataset). Which, when I’m given the ability to use “include dataset /Hosts” to make it easy to maintain, seems a bit of a mean trick to pull on me. And, again, with two tape drives available I’m not at all sure it’ll work in any case.
    I'll post further results as they come to light...
    David.

Maybe you are looking for