Closing FTP connection

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
jsmyong55
Newbie
Posts: 18
Joined: Thu Aug 29, 2013 4:14 am

Closing FTP connection

Post by jsmyong55 » Thu Aug 29, 2013 4:18 am

Hi guys,

I am new to MS. I have just created an FTP connection to send files over using this command:

Code: Select all

FTPPutFile>ftpAddress,test,123,21,%FileLocation%,%newfoldername%,%newfname%,I

I managed to send the file over to the root folder. How do I close the ftp connection after the file is sent? I am using Filezilla as a test FTP server.

User avatar
Marcus Tettmar
Site Admin
Posts: 7391
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Thu Aug 29, 2013 5:36 am

You don't need to, it already has closed. The FTP functions open, do their thing and then close again.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

jsmyong55
Newbie
Posts: 18
Joined: Thu Aug 29, 2013 4:14 am

Post by jsmyong55 » Sat Aug 31, 2013 4:11 pm

I see. Thanks Marcus.

Another thing, I want to display a result using Dialog Boxes with 2 buttons that say "Show log" and "OK". The result box would be using label i presume.

Eg. The dialog box would display "Total records entered are X records" or "An error has occured. Please check Log for info.". The user will then be able to select Show Log which will open a log or OK to close the box.

So far I have,
IF>%NoOfRecords%>0
msg="Total records entered are %NoOfRecords% records"
ELSE
msg="An error has occured. Please check Log for Info"

How do I design that dialog box?

Thanks heaps.

User avatar
Rain
Automation Wizard
Posts: 550
Joined: Tue Aug 09, 2005 5:02 pm
Contact:

Post by Rain » Sat Aug 31, 2013 5:06 pm

Hi jsmyong55,
I hope this points you in the right direction.

Code: Select all


Dialog>Dialog1
object Dialog1: TForm
  Left = 315
  Top = 123
  HelpContext = 5000
  BorderIcons = [biSystemMenu]
  Caption = 'CustomDialog'
  ClientHeight = 81
  ClientWidth = 295
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = True
  ShowHint = True
  OnTaskBar = False
  PixelsPerInch = 96
  TextHeight = 13
  object Label1: TLabel
    Left = 16
    Top = 8
    Width = 49
    Height = 13
  end
  object MSButton1: tMSButton
    Left = 16
    Top = 40
    Width = 75
    Height = 25
    Caption = 'Show Log'
    TabOrder = 8
    DoBrowse = False
    BrowseStyle = fbOpen
  end
  object MSButton2: tMSButton
    Left = 112
    Top = 40
    Width = 75
    Height = 25
    Caption = 'OK'
    TabOrder = 9
    DoBrowse = False
    BrowseStyle = fbOpen
  end
end
EndDialog>Dialog1

AddDialogHandler>Dialog1,MSButton1,OnClick,ShowLog
AddDialogHandler>Dialog1,MSButton2,OnClick,ExitScript
AddDialogHandler>Dialog1,,OnClose,ExitScript

Show>Dialog1,


SRT>ShowLog

  IF>%NoOfRecords%>0
    //Display Log message by setting Label1 caption
    SetDialogProperty>Dialog1,Label1,Caption,"Total records entered are %NoOfRecords% records"
  ELSE
    //Display Log message by setting Label1 caption
    SetDialogProperty>Dialog1,Label1,Caption,"An error has occurred. Please check Log for Info"
  ENDIF

END>ShowLog

SRT>ExitScript
  //Exit Script when dialog is closed or OK button is clicked
  Exit>1
END>ExitScript

jsmyong55
Newbie
Posts: 18
Joined: Thu Aug 29, 2013 4:14 am

Post by jsmyong55 » Sat Aug 31, 2013 5:36 pm

This is awesome. Thanks Rain. Repped.

Is there a simpler way to create a timeout for this dialog box other than doing it like this?

Code: Select all

    Let>timeout=5
    GoSub>MsgTimeout

    SRT>MsgTimeout
    Let>tick=0
    Label>timeloop
    Wait>1
    Let>tick=tick+1

    IfWindowOpen>Macro Scheduler Message
      if>tick<timeout>timeloop
      else
         CloseWindow>Macro Scheduler Message
      endif
    endif
    END>MsgTimeout


Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts