Differences
This shows you the differences between the selected revisions of the page.
| 2016-01-28 | 2016-03-18 | ||
| code anchor (martin) | 5.8.2 Script or .NET assembly code can be generated for file transfers. (martin) | ||
| Line 6: | Line 6: | ||
| * //Session > Generate Session %%URL%%/Code// command on the main window to generate session %%URL%% or code template for the current session. (preferred) | * //Session > Generate Session %%URL%%/Code// command on the main window to generate session %%URL%% or code template for the current session. (preferred) | ||
| * //Manage > Generate Session %%URL/Code%%// command on the [[ui_login|Login dialog]] to generate session %%URL%% or code template for the selected site. | * //Manage > Generate Session %%URL/Code%%// command on the [[ui_login|Login dialog]] to generate session %%URL%% or code template for the selected site. | ||
| + | |||
| + | To open the dialog to generate a file transfer code: | ||
| + | |||
| + | * //Transfer Settings > Generate Code// command on the [[ui_copy|Transfer Options dialog]]. | ||
| To open the dialog to generate the file %%URL%%, use: | To open the dialog to generate the file %%URL%%, use: | ||
| Line 14: | Line 18: | ||
| ===== URL Tab ===== | ===== URL Tab ===== | ||
| - | Use the //%%URL%% tab// to generate a [[session_url|session URL]] or a file URL. | + | Use the //%%URL%% tab// to generate a [[session_url|session URL]] or a file URL. The tab is not available when generating a file transfer code. |
| &screenshotpict(generateurl) | &screenshotpict(generateurl) | ||
| Line 35: | Line 39: | ||
| ===== Script Tab ===== | ===== Script Tab ===== | ||
| - | Use the //Script tab// to generate a [[scripting|WinSCP script]] template for the session. &beta_feature | + | Use the //Script tab// to generate a [[scripting|WinSCP script]] template for the session or the file transfer. &beta_feature |
| &screenshotpict(generateurl_script) | &screenshotpict(generateurl_script) | ||
| Line 42: | Line 46: | ||
| * the ''[[scriptcommand_open|open]]'' command with the [[session_url|session URL]] and all other switches needed to configure the session. | * the ''[[scriptcommand_open|open]]'' command with the [[session_url|session URL]] and all other switches needed to configure the session. | ||
| - | * a placeholder text to be replaced with [[scripting#commands|commands]]. | + | * (//When generating a code for a session//) a placeholder text to be replaced with [[scripting#commands|commands]]. |
| + | * (//When generating a code for a file transfer//) the ''[[scriptcommand_cd|cd]]'' and ''[[scriptcommand_lcd|lcd]]'' commands to navigate to the source and destination folders of the transfer and the ''[[scriptcommand_put|put]]'' or ''[[scriptcommand_get|get]]'' commands to actually transfer the files (with all needed switches to setup any non-default [[ui_transfer_custom|transfer settings]]). | ||
| + | * If you had all files selected in the source panel, a code to upload all files from the source directory will be generated. | ||
| + | * If you had only some files selected in the source panel, a code to upload only the selected files (but three at most) will be generated. If file names contain any [[file_mask#basic|file mask special characters]], they will be escaped. | ||
| * the ''[[scriptcommand_exit|exit]]'' command to end the script. | * the ''[[scriptcommand_exit|exit]]'' command to end the script. | ||
| Line 58: | Line 65: | ||
| ===== [[code]] .NET Assembly Tab ===== | ===== [[code]] .NET Assembly Tab ===== | ||
| - | Use the //.NET assembly tab// to generate a code template using [[library|WinSCP .NET assembly]] for the session. &beta_feature | + | Use the //.NET assembly tab// to generate a code template using [[library|WinSCP .NET assembly]] for the session or the file transfer. &beta_feature |
| &screenshotpict(generateurl_code) | &screenshotpict(generateurl_code) | ||
| Line 67: | Line 74: | ||
| * Create ''[[library_session|Session]]'' instance. | * Create ''[[library_session|Session]]'' instance. | ||
| * Open the session using ''[[library_session_open|Session.Open]]'' | * Open the session using ''[[library_session_open|Session.Open]]'' | ||
| - | * Include a placeholder text to be replaced with calls to ''Session'' [[library_session#methods|methods]]. | + | * //(When generating a code for a session)// Include a placeholder text to be replaced with calls to ''Session'' [[library_session#methods|methods]]. |
| + | * //(When generating a code for a file transfer)// Transfer files using ''[[library_session_putfiles|Session.PutFiles]]'' or ''[[library_session_getfiles|Session.GetFiles]]''. The ''[[library_transferoptions|TransferOptions]]'' class instance will be constructed and set up, if any non-default [[ui_transfer_custom|transfer settings]] are used. The ''[[library_operationresultbase#check|OperationResultBase.Check]]'' method will be called on results of the methods to [[library_session#results|throw an exception on any error]]. | ||
| + | * If you had all files selected in the source panel, a code to upload all files from the source directory will be generated. | ||
| + | * If you had only some files selected in the source panel, a code to upload only the selected files (but three at most) will be generated. If file names contain any [[file_mask#basic|file mask special characters]], the ''[[library_session_escapefilemask|Session.EscapeFileMask]]'' method will be called to escape them. | ||
| * Dispose the ''[[library_session|Session]]'' instance. | * Dispose the ''[[library_session|Session]]'' instance. | ||