AppleScript Ignoring "with timeout" Command

Mac OS 10.4.11
AppleScript 1.10.7
Hi all. I'm experimenting with the idea of using my screensaver as my Desktop Background. In order to continue using a script in the macosxhints site that locks the screen via the keychain menubar item (so I'm not forced to have it require a password when it normally accesses the screensaver), I need to modify it so that it turns the said feature off and displays a dialog enabling me to turn it back on when I return.
Here's the problem: By the time I do return, the script times out on me, preventing me from accessing its dialog. I've applied the "with timeout" command, but it doesn't seem to have any effect on the script at all. Even a "with timeout of 1 second" command does not change its behavior from the default timeout time. Any help here? Here's what I've been able to come up with thus far:
with timeout of 86400 seconds
tell application "System Events"
if process "ScreenSaverEngine" exists then tell application "ScreenSaverEngine" to quit
end tell
activate application "SystemUIServer"
tell application "System Events"
tell process "SystemUIServer"
repeat with i from 1 to number of menu bar items of menu bar 1
tell menu bar item i of menu bar 1
click
try
if name of menu item 1 of front menu is "Lock Screen" then
click menu item "Lock Screen" of front menu
exit repeat
end if
end try
end tell
end repeat
end tell
end tell
display dialog "Select the desktop background type:" buttons {"Normal", "ScreenSaver"} default button 2
if button returned of result = "ScreenSaver" then
do shell script "/System/Library/Frameworks/ScreenSaver.framework/Resources/ScreenSaverEngine.a pp/Contents/MacOS/ScreenSaverEngine -background > /dev/null 2>&1 &"
else
tell application "System Events"
if process "ScreenSaverEngine" exists then tell application "ScreenSaverEngine" to quit
end tell
end if
end timeout
Thanks in advanced!
Message was edited by: Viewer07

HI,
Try posting in the AppleScript forum here: http://discussions.apple.com/forum.jspa?forumID=724
Carolyn

Similar Messages

  • Applescript Ignoring Timeout

    Hi Guys,
    Long time listener, first time caller. I have cobbled this script together from other posts. It is designed to close all open applications with exceptions and rsync a directory to a removable drive. Unfortunately the script times out after some hours when rsyncing some large files (>~40 gig).
    Script Below
    set userCancelled to false
    with timeout of 86400 seconds -- one day
    display dialog "Do you want to Sync and Shutdown? " & "" buttons {"No", "Yes"} with icon caution with title "Backup" default button "Yes"
    if button returned of result = "Yes" then
    tell application "System Events" to set the visible of every process to true
    set white_list to {"Finder", "AppleScript Editor", "Mail", "Address Book", "iCal", "Things", "Skype"}
    try
    tell application "Finder"
    set process_list to the name of every process whose visible is true
    end tell
    repeat with i from 1 to (number of items in process_list)
    set this_process to item i of the process_list
    if this_process is not in white_list then
    tell application this_process
    quit
    end tell
    end if
    end repeat
    on error
    tell the current application to display dialog "An error has occurred!" & return & "This script will now quit" buttons {"Quit"} default button 1 with icon 0
    end try
    set {weekday:d} to (current date)
    set date_format to d as string
    display dialog date_format & "Syncing starts in 5 seconds…
    This operation may takes few minutes." with icon note buttons {"OK"} with title "Backup" giving up after 5
    do shell script "rsync -avE –delete-after ~/Library/VirtualBox/ /Volumes/Daily_Backup/Backup/VirtualBox/" & date_format & "/ > ~/rsync.log || echo -n"
    -- do shell script "rsync -avE –delete-after ~/Documents/ /Volumes/Daily_Backup/Backup/Documents/" & date_format & "/ > ~/rsync.log || echo -n"
    --display dialog "Backup completed Do you want to see the log?" with icon note buttons {"No", "Yes"} with title "Backup" default button "Yes" giving up after 10
    --if button returned of result = "Yes" then
    -- tell application "Finder" to open file "rsync.log" of home
    --end if
    try
    set answer to display dialog "Backup complete. Shutting down in 30 seconds." giving up after 30
    on error number -128
    set userCancelled to true
    end try
    if userCancelled then
    else if gave up of answer then
    tell application "Finder"
    shut down
    end tell
    end if
    end if
    end timeout
    Script Above
    It does take any longer than 24 hours and if there is nothing or little to rsync the script executes without an issue.
    I have seen other posts but none of their suggestions seem to help.
    Please HELP.... it is really frustrating me though I am sure I have done something stupid.
    Thanks,
    Will

    From the AppleScript Language Guide: "A +with timeout+ statement applies only to commands sent to application objects, not to commands sent to the application that is running the script". As far as I can tell, since it would be the current application (the script) that ultimately executes the +do shell script+ command, +with timeout+ would not be applied - for example, if you perform an ls command on a large volume/directory with a short timeout, the script does not time out:with timeout of 10 seconds
    do shell script "ls -lR /Library; echo 'done'"
    end timeout
    activate me
    display dialog "done"I'm not sure where the ultimate timeout is coming from, but you might try another approach, such as testing the result log or capturing the error with a try statement.

  • AppFabric 1.1 with Windows 7 losing or abandone sessions and ignore the timeout settings

    Hi,
    We have a enterprise financial web solution using aspx and AppFabric 1.1 and we have an issue with Sessions as the get abandoned or appFabric is ignoring the timeout settings.
    I tried almost everything: use sql and xml configuration, deactivate firewalls, ensure all sessions are set to 20 minutes expirations. We have the appFabric settings on the web.config and our project is multilayer but sessions are mainly
    created/consumed at the web project level..
    We use AppFabric 1.1 with Sql Server 2008R2 over a Windows7 x64 environment.
    I also tried all the options using powerShell command: get-command -module DistributedCacheAdministration, I increased the TTL to 38 mins but still nothing makes any difference. Sessions are lost between ~~ 5 to 10 minutes no matter if
    you are playing with the solution or you left aside..
    Please help. I really appreciate any suggestion, idea, recommendation..
    Hernan Bogantes
    Florida.

    Note the provider type in AF 1.1 is 
    type="Microsoft.Web.DistributedCache.DistributedCacheSessionStateStoreProvider,Microsoft.Web.DistributedCache"
    which is different from the type in 1.0:
    type="Microsoft.ApplicationServer.Caching.DataCacheSessionStoreProvider"
    https://msdn.microsoft.com/en-us/library/hh361709(v=azure.10).aspx

  • Print to two printers with one command?

    Is there a way to print the same document to two printers with one command? I'd like to have every document I print automatically saved as a PDF at the same time.
    Thanks,
    Mark.
    MacBook Pro (and 5 others)   Mac OS X (10.4.9)  

    That would be a good use of the PDF Services available in OS X. You can use PDF Services with AppleScript or an Automator workflow.
    Matt
    Mac Mini G4; B&W G3/300    

  • Error with sql commands with ms access

    hi!
    I'm having problems with sending commands like "create group x" and "alter database password" these aren't working.
    I'm using the jdbcodbc bridge. Simply doing this:
    Statement stmt = con.createStatement();
    stmt.executeUpdate ("alter database password a null");
    doesn't work.
    create group also don't work. Surely other stuff also don't work. But things like create table, drop table, create proc, do work.
    I can't do all the stuff that appears here.
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnacc2k/html/acadvsql.asp
    What may be happenning?
    can all that really work from java just like this or it don't?
    I'm using Access 2002 with access 2000 db format.
    Thanks.
    Greeting from chile.

    Well may be I am ignorant. I'm doing a real thing (for somebody) for the first time. They will buy few pcs. Also I think I would like they update to access 2000 or 2002 from 97 because of the semi stored procedures... They will do a lot of effort to just buy that but they really need it.
    I just actually wanted the ability to mantain users and assign permissions to do stuff from the same application. That would have been nice but it is not critical, at least execute procedures does work.

  • VSS snapshot of 1.1TB is ending after few hours with timeout. No errors in event log

    Hello,
    does someone have experienced issue where starting making snapshot (forum GUI or command line) is taking a lot of time and then it just ends with timeout?
    I have scenario on virtualised Windows Web Server 2008 R2 where backup is being made by Idera Backup Software but since it relies on VSS Snapshots then we can just skip this point because making snapshots from directly Windows command line or drive preferences/GUI
    is ending with timeout for this single drive after few hours. Affected system has 3 drives: C - 95GB, D-1.06TB and E-120GB. C and E can be backuped correctly and only drive D has problems. System is updated with latest drivers vssadmin for writers returns
    list without any errors and snapshot for drive D which ends with timeout is not generating any error in event log. I wanted to configure VSS trace like it is being instructed on this site:
    http://publib.boulder.ibm.com/infocenter/tsminfo/v6/index.jsp?topic=%2Fcom.ibm.itsm.tshoot.doc%2Ft_pdg_traceprfrm.html
    but I don't see any trace.txt file on given location. If I remove drive D from backup process it ends without errors. System was restarted many times. Only thing which is visible in windows Event log (application part) is that "The VSS service is shutting
    down due to idle timeout." about 4 hours after snapshot making proces is starting.
    I've contacted Idera backup about this but they can't help too much if Windows snapshot process is failing. They suggested that something can be wrong with this drive but since this is virtualised machine and all of my VM are being stored on RAID10 disk
    array connected to my server using fiber connections then I don't think that this is hardware issue (especially when other two drives are located on the same LUN on disk array).
    Any suggestions?
    Regards

    Hi,
    Do you create VMs on Hyper-V or VMWare? Based on research, possible causes could be:
    1. Files changes in the volume is very huge. So the shadow size may be big and the current shadow storage my not able to hold it. And that’s cause the shadow copy creation failure. 
    2. The I/O in D drive is heavy and make the shadow copy I/O failed. 
    3. Server is too busy to handle the request.
    4. The disk is heavily defragment.
    Please refer to the articles to troubleshoot the issue:
    Time-out errors occur in Volume Shadow Copy service writers, and shadow copies are lost during backup and during times when there are high levels of input/output
    http://support.microsoft.com/kb/826936/en-us
    VSS timeouts during backup? What could contribute to that?
    https://blogs.technet.com/b/askpfeplat/archive/2012/09/12/vss-timeouts-during-backup-check-fragmentation.aspx
    Regards,
    Mandy
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • Applescript application with UI dialogs auto relaunch !

    I have a strange behavior with Applescript Application with UI dialogs (for exemple, just display dialog "toto" ). These scripts run, quit and then always relaunch with no end, a king of "keepalive" option.
    The problem doesn't appear when I run the script from the Applescript Editor, neither with scripts without UI dialogs. I've tried my application script on another Mac, and it was okay, just on normal run and quit.
    I can't find the source of my problem on the particular mac, both Macs are up to date (10.8.2). I've cleaned up some startup damemons, relaunch the dyld database. I tried to find a clue with the ps command, but I just can see that my application is relaunched by launchd, without more information.
    Has anyone experienced the same problem, or have an idea to find the source of this, thanks.

    You're a little light on details there, which is going to make answering your question tricky.
    Are you saying, though, that launchd is starting your script? repeatedly?
    If so it would help to know what your script is doing. Launchd expects to launch executables and doesn't expect them to quit. If it quits (or dies) within 10 seconds then launchd assumes the process failed and relaunches it. That sounds to me like what you're saying (/var/log/system.log will confirm that).
    If that's the case, the problem is that your script is too quick. Slow it down by ensuring it takes at least 10 seconds before it quits (a simple delay added to the end of the run handler should take care of that), then launchd won't try to restart it.
    You can also edit the launchd configuration to not be so sensitive to short-lived tasks, but that's probably more work.

  • Applescript Event Alarm Timeout Problem

    I made a simple applescript that performs a folder backup... it runs fine by itself but takes more than a few minutes... when triggered from iCal alarm : run applescript.... it starts ok but after a few minutes before the backup app is finished I get this error:
    An Applescript event alarm did not execute properly.
    ...the script xxx.scrpt .... did not open or finish
    All is fine with a few megs but fails with larger content...
    How Do I get this iCal timeout to stop?
    on tiger 10.4.11

    Hi Austin,
    I did get it working with an app called cronnix - so thanks for the suggestion.
    Is there some sort of GUI for launchd?
    Also - with timeout of 600 seconds line below worked great
    with timeout of 600 seconds
    tell application "Transmit"
    ----code here
    end tell
    end timeout

  • Applescript freezes with Safari

    When I ask Applescript to wait until a web page in Safari has fully loaded, it seems like Safari often simply refuses to answer and my applescript consequently freezes. Is there a way around this? Here's a simplified version of what I'm asking Safari to do. I added the timeout so you don't have to wait 2 minutes for the script to time out:
    with timeout of 20 seconds
              tell application "Safari"
      activate
                        repeat 100 times
                                  set the URL of document 1 to "https://accounts.craigslist.org/login"
                                  repeat until the text of document 1 contains "Account Log In"
                                            delay 1
                                  end repeat
                                  set the URL of document 1 to "http://humanpotentialcenter.org"
                                  repeat until the text of document 1 contains "Want to know more?"
                                            delay 1
                                  end repeat
                        end repeat
              end tell
    end timeout
    It doesn't have any problems when I run it on my 10.5.8 system, but it does freeze the Applescript when I run it on my 10.8.5 system. Suggestions?

    The web sites visited are pretty much the same on either the iMac or MacBook. These are well known sites for the most part. I always keep updates current with any of the software I use including Adobe...

  • Action with Move command fails after illustrator restarts

    Make new illustrator file
    Make a Rectangle
    Make a new action
    While recording action press enter, and move any direction
    Stop recording
    Run action again to test
    Close Illustrator
    Open Illustrator
    Try and use action
    Fails and gives error "The object 'Move' is not currently available, the action button turns orange.
    It also fails in button mode
    It fails if I try to reload the actions
    It only works if I recreate them in that session illustrator is open.
    Expected Behavior
    Actions work no matter how many times you restart illustrator

    Sorry about not being very clear originally. We don't actually send remote notices to the target machines via ARD. The command
    osascript -e 'tell application "System Events" to display dialog "Message"'
    is just an example of what ARD is having issues with for me: If the script for the target machine pushes any user-facing GUI at all, it will not quit until someone manually OKs or closes the window... no amount of messing with the command by giving it ampersands or starting subshells prevents ARD from minding every single one of the subprocesses that it has started.
    There are posts here where we see that a certain task never even "ends" in ARD's eyes: the scripted reboot
    A colleague has suggested that we update our application to echo command information instead of triggering an "Everything was OK" dialog. Most of the time this will fail because you do not have access to the source code in the real world. In my case, we do, but making the changes requires reviewing, changing the code and new testing for the triggered application.
    Still, there is a flaw in not having an option for ARD to just hit-and-run with a script to, say, open a presentation in 100 computers and leave it running. Currently, ARD will hit a few and hang on "Running" as soon as its whatever maximum parallel workstations is stuck running this script.
    ARD designers seem to have planned it "we must receive the return value of this open-ended script," while clients see it as "please let us treat the job as finished as soon as the last line has been triggered"

  • Error while trying to remove an object with dsrm command

    hello,
    i get an error while trying to delete an object computer with the command line tool, DSRM. i get this view:
    actually, it's a one of hundreds of commands, that help cleaning the active directory of the obsolete objects. it is saying : "Access Denied" (in french, accès refusé). i say that the account used to execute this command, is a member of domain
    admins group, and enterprise admins group too. so i cannot believe it's a mater of some missing rights... :/
    thanks in advance, for your help,
    regards
    Lotfi BOUCHERIT

    Hi,
    I was able to reproduce your issue when using a non-elevated command prompt in a 2008R2 box. So please try to elevate your command prompt and your command will most likely go through.
    In addition to above, I'd suggest you look in to PowerShell instead, which in most cases is more effective.(and doesn't need to run in an elevated prompt to make AD-Changes)
    The same as above could be done with the powershell cmdlet Remove-AdComputer.
    Remove-AdComputer -Identity "Distinguishedname"
    Hope this helps you!
    Microsoft Certified Trainer
    MCSE: Desktop, Server, Private Cloud, Messaging
    Blog: http://365lab.net

  • How to export data with column headers in sql server 2008 with bcp command?

    Hi all,
    I want know "how to export data with column headers in sql server 2008 with bcp command", I know how to import data with import and export wizard. when i
    am trying to import data with bcp command data has been copied but column names are not came.
    I am using the below query:-
    EXEC master..xp_cmdshell
    'BCP "SELECT  * FROM   [tempdb].[dbo].[VBAS_ErrorLog] " QUERYOUT "D:\Temp\SQLServer.log" -c -t , -T -S SERVER-A'
    Thanks,
    SAAD.

    Hi All,
    I have done as per your suggestion but here i have face the below problem, in print statment it give correct query, in EXEC ( EXEC master..xp_cmdshell @BCPCMD) it was displayed error message like below
    DECLARE @BCPCMD
    nvarchar(4000)
    DECLARE @BCPCMD1
    nvarchar(4000)
    DECLARE @BCPCMD2
    nvarchar(4000)
    DECLARE @SQLEXPRESS
    varchar(50)
    DECLARE @filepath
    nvarchar(150),@SQLServer
    varchar(50)
    SET @filepath
    = N'"D:\Temp\LDH_SQLErrorlog_'+CAST(YEAR(GETDATE())
    as varchar(4))
    +RIGHT('00'+CAST(MONTH(GETDATE())
    as varchar(2)),2)
    +RIGHT('00'+CAST(DAY(GETDATE())
    as varchar(2)),2)+'.log" '
    Set @SQLServer
    =(SELECT
    @@SERVERNAME)
    SELECT @BCPCMD1
    = '''BCP "SELECT 
    * FROM   [tempdb].[dbo].[wErrorLog] " QUERYOUT '
    SELECT @BCPCMD2
    = '-c -t , -T -S '
    + @SQLServer + 
    SET @BCPCMD
    = @BCPCMD1+ @filepath 
    + @BCPCMD2
    Print @BCPCMD
    -- Print out below
    'BCP "SELECT 
    * FROM   [tempdb].[dbo].[wErrorLog] " QUERYOUT "D:\Temp\LDH_SQLErrorlog_20130313.log" -c -t , -T -S servername'
    EXEC
    master..xp_cmdshell
    @BCPCMD
      ''BCP' is not recognized as an internal or external command,
    operable program or batch file.
    NULL
    if i copy the print ourt put like below and excecute the CMD it was working fine, could you please suggest me what is the problem in above query.
    EXEC
    master..xp_cmdshell
    'BCP "SELECT  * FROM  
    [tempdb].[dbo].[wErrorLog] " QUERYOUT "D:\Temp\LDH_SQLErrorlog_20130313.log" -c -t , -T -S servername '
    Thanks, SAAD.

  • Report with two Command is empty if one of the two commands returns no data

    Hi all,
    I have a report with two Commands not linked together.
    If ONLY one of the two Commands returns no data, the full report is empty (although the other Command returns data).
    I'm using Crystal Report 2008 and the CRJ 12.2.205
    Have an idea?

    Hi Ted,
    how can I solve the problem, please? It is important.
    If I can help yourself, the problem is appeared in many reports since I updated the library (the old library version 11.8.4.1094 works fine with all). I'm waiting for your answer, please.
    Thank you very much.

  • How can you run a command with elevated rights on a remote server with invoke-command ?

    I am trying to run a script on a remote server with invoke-command.  The script is starting and is running fine, but the problem is that it should be running with elevated rights on the remote server.  On the server where I start the invoke-command, my account has the necessary rights.
    The server were I launch the invoke-command is a W2K8 R2.  The remote box is a W2K3 with powershell v2.0 installed.
    When I launch the script on the remote-box from the command line, I don't get the access denied's.
    Is there a way to do this ?
    Thanks in advance

    The script that I want to run is to install the windows updates.  I get an access denied on the download of the updates.
    When I execute the script on an W2K8 box, (not remotely) and I run it with non-elevated rights, I get the same error.
    The script is running fine when it is launched on W2K3 box locally with a domain account that has local admin rights, or on a W2K8 R2 server with a domain account that has local admin rights, but with elevated rights.
    Thanks in advance for your help.
    #=== start script ====
    param($installOption="TESTINSTALL",$rebootOption="NOREBOOT")
    Function Show-Help
    Write-Host ""
    Write-Host "SCRIPT: $scriptName <installOption> <RebootOption>"
    Write-Host ""
    Write-Host "DESCRIPTION: Installatie van WSUS updates op de lokale server"
    Write-Host ""
    Write-Host "PARAMETERS"
    Write-Host " -installOption <[INSTALL|TESTINSTALL]>"
    Write-Host " -rebootOption <[REBOOT|NOREBOOT|REBOOT_IF_UPDATED]>"
    Write-Host ""
    Write-Host "EXAMPLE:"
    Write-Host "$ScriptName -installOption INSTALL -rebootOption REBOOT_IF_UPDATED"
    Write-Host "$ScriptNAme INSTALL NOREBOOT"
    Write-Host ""
    Write-Host "Indien beide parameter weggelaten worden zijn de defaultwaarden :"
    Write-Host " installOption=TESTINSTALL "
    Write-Host " RebootOption=NOREBOOT"
    Write-Host ""
    Exit
    #Include alle globale variablen
    $CEIF_WIN_PATH = (get-content env:CEIF_WIN_PATH)
    $includeFile=$CEIF_WIN_PATH + "\Scripts\include_win.ps1"
    . $includeFile
    #initialiseer error count
    $errcnt=0
    $scriptName=$MyInvocation.MyCommand.Name
    #argumenten controleren
    $arrInstallOption= "TESTINSTALL", "INSTALL" # Mandatory variable with predefined values
    If (!($arrInstallOption –contains $installOption)){ Show-Help }
    $arrRebootOption = "REBOOT", "NOREBOOT","REBOOT_IF_UPDATED" # Mandatory variable with predefined values
    If (!($arrRebootOption –contains $rebootOption)){ Show-Help }
    #Logfile opbouwen
    $logfile = get-logfileName($MyInvocation.MyCommand.Name)
    Log-scriptStart $MyInvocation.MyCommand.Name $logfile
    function Get-WIAStatusValue($value)
    switch -exact ($value)
    0 {"NotStarted"}
    1 {"InProgress"}
    2 {"Succeeded"}
    3 {"SucceededWithErrors"}
    4 {"Failed"}
    5 {"Aborted"}
    function boot-server()
    if ($installOption -eq "TESTINSTALL")
    logger "TESTINSTALL : - Reboot local Server" $logfile
    else
    logger " - Reboot local Server" $logfile
    $thisServer = gwmi win32_operatingsystem
    $thisServer.psbase.Scope.Options.EnablePrivileges = $true
    $thisServer.Reboot()
    $logmsg="Install option = " + $installOption + ", RebootOption = $rebootOption"
    logger "$logmsg" $logfile
    logger "" $logfile
    logger " - Creating WU COM object" $logfile
    $UpdateSession = New-Object -ComObject Microsoft.Update.Session
    $UpdateSearcher = $UpdateSession.CreateUpdateSearcher()
    logger " - Searching for Updates" $logfile
    $SearchResult = $UpdateSearcher.Search("IsAssigned=1 and IsHidden=0 and IsInstalled=0")
    logger " - Found [$($SearchResult.Updates.count)] Updates to Download and install" $logfile
    $Updates=$($SearchResult.Updates.count)
    logger "" $logfile
    foreach($Update in $SearchResult.Updates)
    if ($Update.EulaAccepted -eq 0)
    $Update.AcceptEula()
    # Add Update to Collection
    $UpdatesCollection = New-Object -ComObject Microsoft.Update.UpdateColl
    $UpdatesCollection.Add($Update) | out-null
    if ($installOption -eq "TESTINSTALL")
    else
    # Download
    logger " + Downloading Update $($Update.Title)" $logfile
    $UpdatesDownloader = $UpdateSession.CreateUpdateDownloader()
    $UpdatesDownloader.Updates = $UpdatesCollection
    $DownloadResult = $UpdatesDownloader.Download()
    $Message = " - Download {0}" -f (Get-WIAStatusValue $DownloadResult.ResultCode)
    if ($DownloadResult.ResultCode -eq 4 )
    { $errcnt = 1 }
    logger $message $logfile
    # Install
    logger " - Installing Update" $logfile
    $UpdatesInstaller = $UpdateSession.CreateUpdateInstaller()
    $UpdatesInstaller.Updates = $UpdatesCollection
    $InstallResult = $UpdatesInstaller.Install()
    $Message = " - Install {0}" -f (Get-WIAStatusValue $InstallResult.ResultCode)
    if ($InstallResult.ResultCode -eq 4 )
    { $errcnt = 1 }
    logger $message $logfile
    logger "" $logfile
    #Indien er een fout gebeurde tijdens download/installatie -> stuur mail naar windowsteam
    if ( $errcnt -gt 0 )
    logger " - Fout tijdens de uitvoering van script -> send mail" $logfile
    $mailSubject=$MyInvocation.MyCommand.Name
    $msg = new-object Net.Mail.MailMessage
    $att = new-object Net.Mail.Attachment($logfile)
    $smtp = new-object Net.Mail.SmtpClient($smtpServer)
    $msg.From = $mailFrom
    $msg.To.Add($mailTo)
    $msg.Subject = $mailSubject
    $msg.Body = “Meer details in attachement”
    $msg.Attachments.Add($att)
    $smtp.Send($msg)
    #Moet de server herstart worden ?
    if ($rebootOption -eq "REBOOT_IF_UPDATED" )
    if ($Updates -gt 0)
    #Reboot the server when updates are installed
    boot-server
    elseif ($rebootOption -eq "REBOOT")
    #reboot the server always
    boot-server
    else
    #Do not reboot the server
    logger "Do not reboot the server" $logfile
    Log-scriptEnd $MyInvocation.MyCommand.Name $logfile
    exit 0

  • How to run others applications with abap commands

    Is there a mothed that can use it to run an application with abap statement?
    for example: how to open a text file in program with abap command?
    thank you very much.

    CALL FUNCTION '<b>WS_EXECUTE'</b>
    EXPORTING
      DOCUMENT                 = ' '
      CD                       = ' '
       <b>COMMANDLINE</b>              = ''
      INFORM                   = ' '
      <b> PROGRAM                 </b> = 'NOTEPAD'
      STAT                     = ' '
      WINID                    = ' '
      OSMAC_SCRIPT             = ' '
      OSMAC_CREATOR            = ' '
      WIN16_EXT                = ' '
      EXEC_RC                  = ' '
    IMPORTING
      RBUFF                    =
    EXCEPTIONS
      FRONTEND_ERROR           = 1
      NO_BATCH                 = 2
      PROG_NOT_FOUND           = 3
      ILLEGAL_OPTION           = 4
      GUI_REFUSE_EXECUTE       = 5
      OTHERS                   = 6
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Here...
    In the <b>CommandLine</b> you can give the path where the file is located like for Example
    C:\Test\Hello.txt.
    In the <b>Program</b> you need to give the application that you want to open that file.
    if helpful reward points...
    Regards,
    Vivekananda Varma Dandu

Maybe you are looking for

  • Opening a selection screen in display mode

    I have an ALV grid created in OOPS. Each line of this ALV has name of a report and its variant name. Here I have created a button on toolbar. When a user selects a line and clicks this button, selection screen of the selected report is to be opened i

  • How to validate Combobox items without expanding the combobox.

    Hi, I want to select the combobox item. before selecting an item I want to validate whether the item is present in the combobox list. while validating the item at for loop the combobox get expanded.  I don't want to expand it. if (children[index].Nam

  • Finder Quit on start up.

    Every time I start up the finder quits after login items have loaded. Did have kernal panics over the last few months too. Any suggestions appreciated. Macbook pro 6,2 OS 10.8.4 Here's the last report: Process:         Finder [212] Path:            /

  • What is assertion really good for?

    Yes, I read Programming With Assertions but still can't find a situation where I can use assertions. When I want to check I value, I use an if-statement or a special exception because I want to react for such a specific case in a specific manner. If

  • IMovie is behaving weird, can I uninstall it and install it back again?

    The app iMovie on my Macbook Pro is acting weird. There is even footage that is gone from my library I just don't know where it went. So, I am planning on uninstall ing the app and installing it back again. Do you think that will solve the problem ev