diff --git a/ufo/agents/processors/host_agent_processor.py b/ufo/agents/processors/host_agent_processor.py
index bb5424f0..965cac71 100644
--- a/ufo/agents/processors/host_agent_processor.py
+++ b/ufo/agents/processors/host_agent_processor.py
@@ -166,7 +166,10 @@ def execute_action(self) -> None:
         """
 
         # When the required application is not opened, try to open the application and set the focus to the application window.
-        if self.app_to_open is not None:
+        if (
+            isinstance(self.app_to_open, dict)
+            and self.app_to_open.get("APP", None) is not None
+        ):
             new_app_window = self.host_agent.app_file_manager(self.app_to_open)
             self.control_text = new_app_window.window_text()
         else:
diff --git a/ufo/automator/ui_control/controller.py b/ufo/automator/ui_control/controller.py
index 7db40abd..749f51ce 100644
--- a/ufo/automator/ui_control/controller.py
+++ b/ufo/automator/ui_control/controller.py
@@ -162,8 +162,9 @@ def set_edit_text(self, params: Dict[str, str]) -> str:
             args = {"text": text}
         else:
             method_name = "type_keys"
-            text = text.replace("\n", "{ENTER}")
-            text = text.replace("\t", "{TAB}")
+
+            # Transform the text according to the tags.
+            text = TextTransformer.transform_text(text, "all")
 
             args = {"keys": text, "pause": inter_key_pause, "with_spaces": True}
         try:
@@ -622,3 +623,79 @@ def name(cls) -> str:
         :return: The name of the atomic command.
         """
         return ""
+
+
+class TextTransformer:
+    """
+    The text transformer class.
+    """
+
+    @staticmethod
+    def transform_text(text: str, transform_tag: str) -> str:
+        """
+        Transform the text.
+        :param text: The text to transform.
+        :param transform_tag: The tag to transform.
+        :return: The transformed text.
+        """
+
+        if transform_tag == "all":
+            transform_tag = "+\n\t^%"
+
+        if "\n" in transform_tag:
+            text = TextTransformer.transform_enter(text)
+        if "\t" in transform_tag:
+            text = TextTransformer.transform_tab(text)
+        if "+" in transform_tag:
+            text = TextTransformer.transform_plus(text)
+        if "^" in transform_tag:
+            text = TextTransformer.transform_caret(text)
+        if "%" in transform_tag:
+            text = TextTransformer.transform_percent(text)
+
+        return text
+
+    @staticmethod
+    def transform_enter(text: str) -> str:
+        """
+        Transform the enter key.
+        :param text: The text to transform.
+        :return: The transformed text.
+        """
+        return text.replace("\n", "{ENTER}")
+
+    @staticmethod
+    def transform_tab(text: str) -> str:
+        """
+        Transform the tab key.
+        :param text: The text to transform.
+        :return: The transformed text.
+        """
+        return text.replace("\t", "{TAB}")
+
+    @staticmethod
+    def transform_plus(text: str) -> str:
+        """
+        Transform the plus key.
+        :param text: The text to transform.
+        :return: The transformed text.
+        """
+        return text.replace("+", "{+}")
+
+    @staticmethod
+    def transform_caret(text: str) -> str:
+        """
+        Transform the caret key.
+        :param text: The text to transform.
+        :return: The transformed text.
+        """
+        return text.replace("^", "{^}")
+
+    @staticmethod
+    def transform_percent(text: str) -> str:
+        """
+        Transform the percent key.
+        :param text: The text to transform.
+        :return: The transformed text.
+        """
+        return text.replace("%", "{%}")
diff --git a/ufo/automator/ui_control/openfile.py b/ufo/automator/ui_control/openfile.py
index 0fd8f345..49a51dd6 100644
--- a/ufo/automator/ui_control/openfile.py
+++ b/ufo/automator/ui_control/openfile.py
@@ -50,6 +50,7 @@ def execute_code(self, args: Dict) -> bool:
         (ps. filepath can be empty.)
         :return: The result of the execution or error.
         """
+
         self.APP = args.get("APP", "")
         self.file_path = args.get("file_path", "")
         self.check_open_status()
diff --git a/ufo/prompter/agent_prompter.py b/ufo/prompter/agent_prompter.py
index de0554af..28202f4f 100644
--- a/ufo/prompter/agent_prompter.py
+++ b/ufo/prompter/agent_prompter.py
@@ -319,7 +319,7 @@ def user_content_construction(
             if include_last_screenshot:
                 screenshot_text += ["Screenshot for the last step:"]
 
-                screenshot_text += ["Current Screenshots:", "Annotated Screenshot:"]
+            screenshot_text += ["Current Screenshots:", "Annotated Screenshot:"]
 
             for i, image in enumerate(image_list):
                 user_content.append({"type": "text", "text": screenshot_text[i]})
@@ -580,7 +580,7 @@ def user_content_construction(
             if include_last_screenshot:
                 screenshot_text += ["Screenshot for the last step:"]
 
-                screenshot_text += ["Current Screenshots:", "Annotated Screenshot:"]
+            screenshot_text += ["Current Screenshots:", "Annotated Screenshot:"]
 
             for i, image in enumerate(image_list):
                 user_content.append({"type": "text", "text": screenshot_text[i]})