Differences
This shows you the differences between the selected revisions of the page.
| library_example_download_clipboard 2016-10-13 | library_example_download_clipboard 2022-06-16 (current) | ||
| Line 9: | Line 9: | ||
| <code powershell - DownloadClipboard.ps1> | <code powershell - DownloadClipboard.ps1> | ||
| # @name &Download from Path in &Clipboard | # @name &Download from Path in &Clipboard | ||
| - | # @command powershell.exe -ExecutionPolicy Bypass -STA -File "%EXTENSION_PATH%" -sessionUrl "!S" -localPath "!\" %Pause% -sessionLogPath "%SessionLogPath%" | + | # @command powershell.exe -ExecutionPolicy Bypass -STA -File "%EXTENSION_PATH%" ^ |
| - | # @description Downloads remote file from a path stored in clipboard to the current local directory | + | # -sessionUrl "!E" -localPath "!\" %Pause% -sessionLogPath "%SessionLogPath%" |
| - | # @version 3 | + | # @description Downloads remote file from a path stored in clipboard ^ |
| + | # to the current local directory | ||
| + | # @version 6 | ||
| # @homepage ~~SELF~~ | # @homepage ~~SELF~~ | ||
| - | # @require WinSCP 5.8.4 | + | # @require WinSCP 5.16 |
| # @option Pause -config pausecheckbox | # @option Pause -config pausecheckbox | ||
| # @option SessionLogPath -config sessionlogfile | # @option SessionLogPath -config sessionlogfile | ||
| Line 19: | Line 21: | ||
| param ( | param ( | ||
| - | # Use Generate URL function to obtain a value for -sessionUrl parameter. | + | # Use Generate Session URL function to obtain a value for -sessionUrl parameter. |
| - | $sessionUrl = "sftp://user:mypassword;fingerprint=ssh-rsa-xx-xx-xx@example.com/", | + | $sessionUrl = "sftp://user:mypassword;fingerprint=ssh-rsa-xxxxxxxxxxx...@example.com/", |
| [Parameter(Mandatory = $True)] | [Parameter(Mandatory = $True)] | ||
| $localPath, | $localPath, | ||
| Line 56: | Line 58: | ||
| $session.Open($sessionOptions) | $session.Open($sessionOptions) | ||
| - | Write-Host ("Downloading {0}..." -f $remotePath) | + | Write-Host "Downloading $remotePath..." |
| $session.GetFiles($remotePath, (Join-Path $localPath "*")).Check() | $session.GetFiles($remotePath, (Join-Path $localPath "*")).Check() | ||
| } | } | ||
| Line 68: | Line 70: | ||
| $result = 0 | $result = 0 | ||
| } | } | ||
| - | catch [Exception] | + | catch |
| { | { | ||
| - | Write-Host ("Error: {0}" -f $_.Exception.Message) | + | Write-Host "Error: $($_.Exception.Message)" |
| $result = 1 | $result = 1 | ||
| } | } | ||
| Line 84: | Line 86: | ||
| </code> | </code> | ||
| - | ===== Options ===== | + | ===== [[options]] Options ===== |
| The //Pause at the end// makes the script wait for a key press when it finishes. | The //Pause at the end// makes the script wait for a key press when it finishes. | ||
| - | In the //Session log file// you can specify a path to a [[logging|session log file]]. | + | In the //Session log file//, you can specify a path to a [[logging|session log file]]. |
| + | |||
| + | In the //Keyboard shortcut//, you can specify a [[custom_key_shortcuts|keyboard shortcut]] for the extension. | ||