-
All replies
-
Helpful answers
-
Oct 15, 2014 4:18 PM in response to Bernard Harteby Niel,★HelpfulCopy and paste it into a plain text field before posting it.
(114732)
-
Oct 15, 2014 4:22 PM in response to Bernard Harteby VikingOSX,★HelpfulWhen you open a new post, or reply, over in the upper right corner is the words, Use advanced editor. Click it.
Copy and paste your compiled AppleScript from the AppleScript editor directly into this window. Select all of the script, and then under Style in the toolbar, select Paragraph. This adjusts your AppleScript code so it is no longer truncated.
Of course, if there are really long lines, you may want to use the >> in the Toolbar, and pick one of the Syntax Highlighting languages to provide a horizontal scrollbar. I tend to pick Python, but plain, and others will work too.
-
Oct 15, 2014 4:32 PM in response to VikingOSXby Bernard Harte,Thanks both.
Neither is as good as the script that retained all the Script Editor indents / colour etc but now I have options.
-
Oct 15, 2014 6:07 PM in response to Bernard Harteby etresoft,I see what you mean. Xcode seems to do a better job...
tell application "Finder"
if folder "Applications" of startup disk exists then
return count files in folder "Applications" of startup disk
else
return 0
end if
end tell
-
Oct 15, 2014 6:37 PM in response to Bernard Harteby twtwtw,Something I discovered: If you look at copy/pasted applescript editor text in the forum, using the HTML option, you'll see text that looks like this:
<p style="text-indent: -41.6px;...
basically, the forum is adding a minus sign to the text-indent property so that the indentation goes in the wrong direction. So what I've taken to doing is:
- copy the applescript from the Applescript Editor into the forum text box
- switch to HTML mode
- copy the html into text wrangler (or some other text editor)
- search for '<p style="text-indent: -' and replace it with '<p style="text-indent: ' (deleting the spurious minus sign)
- copy the revised html back into the forum
When you do that, this:
tell application "System Events"
quit
end tell
becomes this:
tell application "System Events"
quit
end tell
works flawlessly.
-
Oct 21, 2014 5:10 PM in response to twtwtwby Pierre L.,Twtwtw, you’re a genius! However, I prefer another workaround, which imho gives a better layout:
1. Copy the applescript from the AppleScript Editor into a new TextEdit document.
2. Replace every tab with a few ordinary spaces (6 is nice).
3. Save the TextEdit document as a Web Page (.html) on the Desktop.
4. Double click the html document to open it in Safari.
5. Copy the script from Safari.
6. Paste the script into the “Full Editor” text box.
When you do that, you obtain this:
tell application "System Events"
quit
end tell
-
Oct 22, 2014 12:01 AM in response to twtwtwby baltwo,The only problem with that is if the values are too large (some of Apple's own scripts use text-indent: -39.3px and multiples of that for tabbing), which really spreads things out. So, unless you also change the values, you won't match what Script Editor shows. Also note that the line spacing is also spread out. I
This is from the Script Editor window:
and this is with the minus sign removed:
repeat with i from 1 to number of items in the item_list
set this_item to item i of the item_list
set this_item to (source_folder & this_item) as alias
set this_info to info for this_item
set the current_name to the name of this_info
if folder of this_info is false and ¬
alias of this_info is false then
if the button_pressed is "Prefix" then
set the new_file_name to the (the prefix_or_suffix & the current_name) as string
else
set the new_file_name to the (the current_name & the prefix_or_suffix) as string
end if
my set_item_name(this_item, the new_file_name)
end if
end repeat
27" i7 iMac (Mid 2011) refurb, OS X Yo (10.10), Mavs, ML & SL, G4 450 MP w/10.5 & 9.2.2
-
Oct 22, 2014 7:39 AM in response to baltwoby Pierre L.,And this is with my workaround:
repeat with i from 1 to number of items in the item_list
set this_item to item i of the item_list
set this_item to (source_folder & this_item) as alias
set this_info to info for this_item
set the current_name to the name of this_info
if folder of this_info is false and ¬
alias of this_info is false then
if the button_pressed is "Prefix" then
set the new_file_name to the (the prefix_or_suffix & the current_name) as string
else
set the new_file_name to the (the current_name & the prefix_or_suffix) as string
end if
my set_item_name(this_item, the new_file_name)
end if
end repeat
-
Oct 22, 2014 12:51 PM in response to Pierre L.by baltwo,Thanks, didn't try that, but that should do the trick.
-
Jan 26, 2015 12:51 PM in response to Bernard Harteby t quinn,Hi All,
Hiroto, here, has the simplest suggestion I have seen.
Uncheck this in applescript editor preferences:
copy and paste and you get this:
activate application "Safari"
tell application "Safari"
tell application "System Events" to keystroke "v" using command down
end tell
My only complaint is that I have to unbold the rest of my comments.
quinn

