ShareShortcuts

Copy Between What

hunter9888x
Fork “Copy Between What”

Built something new on top of this Shortcut? Share it as a fork: it becomes a Shortcut of your own, which you manage, and both pages link to each other so hunter9888x gets credit.

  1. 1Get the Shortcut and change it in the Shortcuts app. Give it a name of its own.
  2. 2Share it from the Shortcuts app and copy the iCloud link.
  3. 3Come back here, paste the link and describe what is different, e.g. “Added a step that uses Apple Intelligence to personalise the text.”
Downloads
63K
Saved
1
Actions
66
Category
Utilities
Version
2.1
Language
EN

Copy between a specific text or symbol

Then deletes the text or symbol between what was copied

Option to create a folder & option to save too

Adds one empty line between matches

& option to have no empty lines

However, when you specifically search for metacharacters such as .[{()\^$|?*+, you need to escape them with backslash \, so they can be recognized.

For example, if you need to find ., type \. in the search field.

Example: I specify

( on left side & ) on right side

(some text) than it would delete ( )

& save some text To a file

Created by me

What's New

Version 2.1

Better version

Version History
2.1 Jan 20, 2020

Better version

2.0 Jan 6, 2020

Adds empty line

1.0 Jan 6, 2020

First release

What it does

66 actions
  1. Choose from Menu
    copy between what
  2. Choose from Menu
    both sides of text
  3. Ask for Input
    Look For what on left & right side of text
  4. Set Variable
    Both sides of text
  5. Get File
  6. Repeat with Each
  7. Get Name
  8. Set Variable
    Name
  9. Get Text from Input
  10. Set Variable
    Get text
  11. Match Text
  12. Text
  13. Set Name
  14. Choose from Menu
    both sides of text (save)
  15. Ask for Input
    Look For what on left & right side of text
  16. Set Variable
    Both sides of text
  17. Get File
  18. Repeat with Each
  19. Get Name
  20. Set Variable
    Name
  21. Get Text from Input
  22. Set Variable
    Get text
  23. Match Text
  24. Text
  25. Set Name
  26. Save File
  27. Stop This Shortcut
  28. Choose from Menu
    two different sides of text
  29. Ask for Input
    Look for what on left side of text
  30. Set Variable
    Left side of text
  31. Ask for Input
    Look for what on right side of text
  32. Set Variable
    Right side of text
  33. Get File
  34. Repeat with Each
  35. Get Name
  36. Set Variable
    Name
  37. Get Text from Input
  38. Set Variable
    Get text
  39. Match Text
  40. Text
  41. Set Name
  42. Choose from Menu
    two different sides of text (save)
  43. Ask for Input
    Look for what on left side of text
  44. Set Variable
    Left side of text
  45. Ask for Input
    Look for what on right side of text
  46. Set Variable
    Right side of text
  47. Get File
  48. Repeat with Each
  49. Get Name
  50. Set Variable
    Name
  51. Get Text from Input
  52. Set Variable
    Get text
  53. Match Text
  54. Text
  55. Set Name
  56. Save File
  57. Stop This Shortcut
  58. Choose from Menu
    create folder
  59. Ask for Input
    Set folder name to use
  60. Set Variable
    New folder
  61. Create Folder
  62. Show Result
  63. Stop This Shortcut
  64. Create Folder
  65. Save File
  66. Show Result

View as code
Beta

Every action of this Shortcut written out as Cherri, a programming language for Shortcuts. Great for learning how it works.

#include 'actions/text'
#define color purple
#define glyph magicWandAlt


menu "copy between what " {
item "both sides of text":
	prompt("Look For what on left & right side of text")
	@BothSidesOfText
	const File = getFileFromFolder(, "")
	for _ in File {
		getName(@RepeatItem)
		@Name
		getText(@RepeatItem)
		@GetText
		containsText(@GetText, "\{@BothSidesOfText}.*\{@BothSidesOfText}")
		const Text = "{}"
		setName(Text, @Name)
	}
item "both sides of text (save)":
	prompt("Look For what on left & right side of text")
	@BothSidesOfText
	const File = getFile("")
	for _ in File {
		getName(@RepeatItem)
		@Name
		getText(@RepeatItem)
		@GetText
		containsText(@GetText, "\{@BothSidesOfText}.*\{@BothSidesOfText}")
		const Text = "{}"
		setName(Text, @Name)
	}
	const SavedFile = saveFilePrompt(RepeatResults)
	stop()
item "two different sides of text":
	prompt("Look for what on left side of text")
	@LeftSideOfText
	prompt("Look for what on right side of text")
	@RightSideOfText
	const File1 = getFile("")
	for _ in File1 {
		getName(@RepeatItem)
		@Name
		getText(@RepeatItem)
		@GetText
		containsText(@GetText, "\{@LeftSideOfText}.*\{@RightSideOfText}")
		const Text1 = "{}"
		setName(Text1, @Name)
	}
item "two different sides of text (save)":
	prompt("Look for what on left side of text")
	@LeftSideOfText
	prompt("Look for what on right side of text")
	@RightSideOfText
	const File1 = getFile("")
	for _ in File1 {
		getName(@RepeatItem)
		@Name
		getText(@RepeatItem)
		@GetText
		containsText(@GetText, "\{@LeftSideOfText}.*\{@RightSideOfText}")
		const Text1 = "{}"
		setName(Text1, @Name)
	}
	const SavedFile1 = saveFilePrompt(RepeatResults1)
	stop()
item "create folder":
	prompt("Set folder name to use")
	@NewFolder
	createFolder(@NewFolder)
	show("New folder is /Shortcuts/{@NewFolder}")
	stop()
}
createFolder("copy between what")
saveFile("copy between what", MenuResult, true)
show("In folder /Shortcuts/copy between what")
Open in Cherri Playground Decompiled with cherri 2.3.0 (GPL-2.0). May need small fixes before it compiles.

Ratings & Reviews

Write a Review
–
out of 5
★★★★★
★★★★
★★★
★★
★
0 ratings

No reviews yet. Be the first to share what you think!

Advertisement

More by hunter9888x

See All

You Might Also Like

See All
Advertisement