<p>I have a user script that would be much more useful if it could dynamically change some of its execution dependent on what the user wanted.  Passing simple switches would easily solve this problem but I don't see any way to do it.</p>
<p>I also tried embedding a keyword in the script name, but <em>Xcode</em> copies the script to a guid-looking filename before execution, so that won't work either.</p>
<p>So does anyone know of a way to call a user script with some sort of argument? (other that the normal <code>%%%var%%%</code> variables)</p>
<hr />
<h3>EDIT:</h3>
<p>User scripts are accessible via the script menu in Xcode's menubar (between the Window and Help menus).  My question is not about &quot;run script&quot; build phase scripts.  My apologies for leaving that somewhat ambiguous.</p>

[{'answer_id': 47544, 'author': 'MyztikJenz', 'author_id': 4233, 'author_profile': 'https://Stackoverflow.com/users/4233', 'pm_score': 0, 'selected': False, 'text': '<p>User scripts are accessible via the script menu in Xcode\'s menubar (between the Window and Help menus).  Wasn\'t sure what else to call them.  What I\'m asking about are not "run script" build phase scripts.</p>\n'}, {'answer_id': 47619, 'author': 'vt.', 'author_id': 3905, 'author_profile': 'https://Stackoverflow.com/users/3905', 'pm_score': 0, 'selected': False, 'text': '<p>I suppose you could do something like this:</p>\n\n<pre><code>#!/bin/bash\nresult=$( osascript &lt;&lt; END\ntell app "System Events"\n  set a to display dialog "What shall be the result?" default answer ""\nend tell\nreturn text returned of a\nEND\n)\n# do stuff with $result\n</code></pre>\n'}, {'answer_id': 47689, 'author': 'Chris Hanson', 'author_id': 714, 'author_profile': 'https://Stackoverflow.com/users/714', 'pm_score': 2, 'selected': True, 'text': "<p>You can't pass parameters to user scripts — instead, user scripts operate on the context you're working in (e.g. the selected file, the selected text, etc.).</p>\n\n<p>You should use the context to determine what the user really wants.</p>\n"}, {'answer_id': 2581443, 'author': 'jkyle', 'author_id': 263199, 'author_profile': 'https://Stackoverflow.com/users/263199', 'pm_score': 0, 'selected': False, 'text': '<p>There are built in utility scripts that allow you to prompt the user and capture the reply.</p>\n<p>You could prompt for a string, for example, then based on that perform a certain task.</p>\n<p>The String prompt is:</p>\n<pre><code>STRING = `%%%{PBXUtilityScriptsPath}%%%/AskUserForStringDialog &quot;DefaultString&quot; &quot;DefaultWindowName&quot;`\n</code></pre>\n<p>If you notice, you\'re just calling an applescript they wrote using a static path. You could write your own applescript dialog and place it there if you want and bypass the need for cumbersome osascript syntax. There are others (for files, folders, applications, etc)</p>\n<p><a href="http://developer.apple.com/mac/library/documentation/DeveloperTools/Conceptual/XcodeWorkspace/310-User_Scrips/user_scripts.html" rel="nofollow noreferrer">User Scripts Documenation</a></p>\n'}]
['https://Stackoverflow.com/questions/47483', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4233/']