Applescript Help for TextEdit
I want to be able to select each paragraph from a long rtf file and save it in another document.
Say my doc has 25 paragraphs and I want to get 25 different documents containing each different paragraph.
Any Help?
Thanks
tell application "TextEdit"
repeat with aParagraph in paragraphs of document 0 as list
set newDoc to make new document at end of documents
set text of newDoc to aParagraph
end repeat
end tellThis assumes the document you want to extract from is the frontmost document.
Also, you should use the [Applescript|http://discussions.apple.com/forum.jspa?forumID=724] forum under Mac OS X Technologies.
Similar Messages
-
Applescript help for Exporting Playlist
I have two Imac...... my business mac at a resturant/bar for djing and my home Imac for purchasing and orgainizing my music collection.
I frequently replace music audio and video files for better quality versions,
This is causing me headaches because at work we might have a lot of smartlists which are based on ratings and other tags. I need to get the tags from the old files imported into the updated versions of those files.
I found this script which looks like it may solve my problem but I need help fine tuning it for my needs.
This script takes as input a Music.txt file created with iTunes' File > Export command. It then applies the song ratings found in this file to the same songs in the current iTunes library. The song name, artist, and album must match; otherwise, the rating will not be affected. If they do match, the current rating will be replaced.
IMPORTANT: Before running this script, the Music.txt file must be encoded as UTF-8. To do so, simply open Music.txt in TextEdit (or a similar editor) and re-save the file with UTF-8 encoding.
set the_file to Flix Media/Flix Music/All Media/Music.txt
set music_lines to read the_file using delimiter {return}
display dialog "This script may take a very long time to run, depending on the size of your iTunes library. (Processing a 2000-song library required approximately 20 minutes on a 2.5 GHz MacBook Pro.)" & return & return & "Do you still want to continue?"
-- Split the line at tab stops
set text item delimiters to ASCII character 9
-- Start at 2 instead of 1 to skip the header line
repeat with i from 2 to count music_lines
set music_line to item i of music_lines
set music_fields to every text item of music_line
if length of music_fields is 27 then
set the_name to item 1 of music_fields
set the_artist to item 2 of music_fields
set the_album to item 4 of music_fields
set the_rating to item 26 of music_fields
tell application "iTunes"
set the_tracks to (file tracks of library playlist 1 whose name is the_name and artist is the_artist and album is the_album)
repeat with the_track in the_tracks
set the rating of the_track to the_rating
end repeat
end tell
end if
end repeat
Problem 1
What am I doing incorrect with my file path? My computer has a separate partition called Flix Media
This is what I typed :
set the_file to Flix Media/Flix Music/All Media/Music.txt
but it errors out on Flix Media.
The original script had this:
set the_file to choose file
Problem 2
I would like to automate this script to run at night. (I have a few scripts that need to run at night prior to this.)
Is there any way to save the music.text file with an applescript, then re-open it in a textEdit and re-save it as a UTF-8 format?
It this could be done then the running of this script could follow.
Any help or ideas would be greatly appriciated....
RonI just figure what was wrong with my file path.
set the_file to "Volumes/Flix Media/Flix Music/All Media/Music.txt"
So all I need is help with problem 2.
Thanks.....
Ron -
AppleScript: Waiting for a user to enter user name and password
I'm currently working on an AppleScript designed to automate binding a computer to Active Directory and another script to install a login certificate. While you can create a UNIX shell script for the Active Directory binding, I found that you have to have your user name and password in the script itself and this system will be deployed by multiple people.
So instead I'm doing an GUI Automation AppleScript of Directory Utility. What I'd like to do is have the script to wait for the admin user (who will be remoting in by ARD) to enter their Network user and password, click okay and then continue the script to quit the program and then run a self-destruct (which I'd also appreciate any advice about doing in AppleScript)
Here's the script so far, which I've set up successfully:
activate application "Directory Utility"
tell application "System Events"
click text field 1 of row 1 of table 1 of scroll area 1 of group 1 of group 1 of window "Directory Utility" of application process "Directory Utility"
click button 1 of group 1 of group 1 of window "Directory Utility" of application process "Directory Utility"
click text field 2 of sheet 1 of window "Directory Utility" of application process "Directory Utility"
keystroke "EXAMPLE.COMPANY.com"
click UI element 3 of sheet 1 of window "Directory Utility" of application process "Directory Utility"
click radio button "Administrative" of tab group 1 of sheet 1 of window "Directory Utility" of application process "Directory Utility"
click checkbox "Allow administration by:" of tab group 1 of sheet 1 of window "Directory Utility" of application process "Directory Utility"
click button 1 of tab group 1 of sheet 1 of window "Directory Utility" of application process "Directory Utility"
click row 1 of table 1 of scroll area 1 of tab group 1 of sheet 1 of window "Directory Utility" of application process "Directory Utility"
keystroke "GroupExamplePS NA"
click button 1 of tab group 1 of sheet 1 of window "Directory Utility" of application process "Directory Utility"
click row 2 of table 1 of scroll area 1 of tab group 1 of sheet 1 of window "Directory Utility" of application process "Directory Utility"
keystroke "GroupExampleNA"
click button 1 of tab group 1 of sheet 1 of window "Directory Utility" of application process "Directory Utility"
click row 3 of table 1 of scroll area 1 of tab group 1 of sheet 1 of window "Directory Utility" of application process "Directory Utility"
keystroke "GroupExampleNATemps"
click button 1 of tab group 1 of sheet 1 of window "Directory Utility" of application process "Directory Utility"
click row 4 of table 1 of scroll area 1 of tab group 1 of sheet 1 of window "Directory Utility" of application process "Directory Utility"
keystroke "GroupExampleTeam 1"
click button 1 of tab group 1 of sheet 1 of window "Directory Utility" of application process "Directory Utility"
click row 5 of table 1 of scroll area 1 of tab group 1 of sheet 1 of window "Directory Utility" of application process "Directory Utility"
keystroke "GroupExampleTeam 2"
click button 1 of tab group 1 of sheet 1 of window "Directory Utility" of application process "Directory Utility"
click row 6 of table 1 of scroll area 1 of tab group 1 of sheet 1 of window "Directory Utility" of application process "Directory Utility"
keystroke "GroupExampleTeam 3"
click button 1 of tab group 1 of sheet 1 of window "Directory Utility" of application process "Directory Utility"
click row 7 of table 1 of scroll area 1 of tab group 1 of sheet 1 of window "Directory Utility" of application process "Directory Utility"
keystroke "GroupExampleDesktop Admins"
click button 1 of tab group 1 of sheet 1 of window "Directory Utility" of application process "Directory Utility"
click row 8 of table 1 of scroll area 1 of tab group 1 of sheet 1 of window "Directory Utility" of application process "Directory Utility"
keystroke "GroupExampleDomain Admins"
click button "Bind…" of sheet 1 of window "Directory Utility" of application process "Directory Utility
<<WAIT LINE HERE FOR NETWORK ADMIN AND AND PASS, THEN USER WILL CLICK OKAY, THEN CONTINUE SCRIPT>>
<<QUIT ACTIVE DIRECTORY>>
<<SELF-DESTRUCT>>
end tell
It isn't a real command prompt like if you're changing System Preferences or something. It's a specialized prompt specifically for Directory Utility. However, I do need to know how to make AppleScript wait for a password for a standard Password Prompt for adding a certificate to the login keychain through Keychain Access. I've also done pretty much the same thing as above for that script.
Any tips would be GREATLY appreciated.Yeah, I know GUI Scripting is not the best way, but I couldn't find a successful variable system for the following script. The other issue is that I'd prefer to send this by ARD and have ARD ask for a User Name and Password, but I've found there's no way to do that. Then again, I can't send the AppleScript purely remotely either.
What I mean by self-destruct is simply I only want the Active Directory binding script to run once upon login to the primary admin user and then delete itself so it doesn't get run again. The login certificate script I want to run once on each new user who logs in (so I'll likely be putting it in the "User Template") and then delete itself so it doesn't run the next time they log in. I can't figure out any way to hit those buttons through a shell script.
Here's the original UNIX shell script: (This is what I'm using temporarily until I figure out a solution that doesn't require my user name and password to be embedded)
#! /bin/bash
MACNAME=$(scutil --get ComputerName)
dsconfigad -add "CORP.DOMAIN.NET" \
-username USER \
-password PASS \
-computer $MACNAME \
-mobile disable \
-mobileconfirm disable \
-localhome enable \
-useuncpath enable \
-shell /bin/bash \
-ou OU=Macs,CN=Computers,DC=corp,DC=DOMAIN,DC=net \
-force \
-localpassword "PASSWORD" \
-groups "GROUPS"
And here is the Certificate Installation AppleScript
activate application "Keychain Access"
tell application "Finder" to open POSIX file "/FolderName/Certificate.crt"
delay (3)
tell application "System Events" to tell process "Keychain Access"
click button "Add" of window "Add Certificates"
click button "Always Trust" of group 3 of sheet 1 of window "Keychain Access"
end tell
Thanks for the help. I really appreciate it. This is a rather new field for me and most of my knowledge comes from Google Searches and about a billion tabs trying to find answers. -
HT2523 What languages are available for TextEdit?
What languages are available for TextEdit?
I've updated the list to add the remaining CS6 Help PDFs:
Illustrator is now available in Français, Deutsch, Japanese (日本語).
Fireworks, Bridge, and Extension Manager are available in Français only.
No additional PDF languages will be added for Illustrator and Photoshop. -
Setup custom table for textedit
how can you set up a custom table for textedit? I have a custom sap table for user to enter a project.
ie.
field data element Datatype length
projectnum zprojectnum char 8
projectid zprojectid char 4
projectname zprojectname char 20
projectdesc ? ? ?
how would you set this up so that project desc can have unlimited length?
also where is the text store and how to store the textedit?There are three important parameters that we will require while dealing with long texts.
TEXT ID
TEXT OBJECT
TEXT NAME
Usually TEXT ID will ST and TEXT OBJECT will be TEXT unless you have created some other values for the same. Now coming to the TEXT NAME, this could be your unique key of the data for which you want to maintain the long text.
If you don't have single unique column, you can concatenate two or three columns and store the long text against that using the SAVE_TEXT function.
While reading the text, the same columns will have to concatenated and use it the READ_TEXT function.
Regards,
Ravi
Note : Please mark all the helpful answers and close the thread if the issue is resolved. -
Creating search help for a field in AdHoc Query
Hi
We have created an infoset based on LDB PCH.
(The infoset contains object type O only).
For the object-id field the users want search help when choosing this field for selection.
Using "start via selection screen" does not give a good solution.
Can anyone explain how I can create search help for fields in an infoset?
Regards
KirstenHi
We have created an infoset based on LDB PCH.
(The infoset contains object type O only).
For the object-id field the users want search help when choosing this field for selection.
Using "start via selection screen" does not give a good solution.
Can anyone explain how I can create search help for fields in an infoset?
Regards
Kirsten -
Need to restrict values in F4 help for Batch Characteristic
Hi,
I need to restrict values in F4 Help for a batch characteristic based on values entered for another characteristic. I could not find any BADI or Exit for this purpose. There is a BADI CACL_VALUE which is triggered after an entry is selected from dropdown list but nothing when we press F4. I thought of using Object Dependency but I need to write a programming logic for the requirement. Please let me know if there is any way to write program in Object Dependency or any other way for this requirement.
Regards,
NikhilHi nikhil simha,
first of all, find out which search help is called.
[Hierarchy of the Search Help Call|http://help.sap.com/saphelp_nw70/helpdata/en/0b/32e9b798da11d295b800a0c929b3c3/frameset.htm]
may help you.
If you know the search help, you may enhance it, but first of all you should check the where-used-list and make sure that the search help shows the requested behavior only in the context where you want it to.
If it is your own program, you may be better off to create your own search help and define the triggering fields as search help interface input fields. Then you can use the values to filter results.
Regards
Clemens -
Search Help for Vendor Feild not getting populated in the Screen Element
Hi Everyone,
In transaction Miro, I get a POP-UP for Invoicing Party i.e. Vendor and Users required a custom search help.
The Search help for Vendor(LIFNR) is KRED_C and i appended a Z search help under this.
Now that the search help exists and I can drill down the values too but when i select/choose any value, that value is not getting populated in Screen feild.
is there any validation I need to do for this.
Please suggest me... I checked SDN there are many things but i couldn't figure out wat i need to do and where I need to modify.
Regards,
RajDear Hema,
Could you please tell me how many internal tables you are using to store the data for display.
I observerd that you have lt_stock and lt_mat2 declared in the part of the program
>DATA: lv_stock TYPE lty_stock.
>DATA: ltmat2 TYPE TABLE OF lty_mat.
you have displayed above, however you are also using ls_stock and lv_stock .
>IF p_ztotal = ' '. "line
>WRITE 18 ls_stock-matnr.
>WRITE 38 lv_stock-strgr.
>
>ELSEIF ztotal = 'S'. "subtotal
>WRITE: 15 ls_stock-nrmit.
>WRITE 32 lv_stock-dispo.
>WRITE 43 lv_stock-fevor.
>ELSE. "total
>WRITE: 15 'TOTAL'(016), ls_stock-prgrp.
>
>ENDIF.
Are those for displaying some other information?
Also the problem of display you are facing can also be because there are no records to be displayed which satisfies the selection criteria.
Best Regards,
Rajesh.
Please reward points if found helpful. -
Search help for SKAT-SAKNR OR SKAT-SAKNR is not working
Hi All,
I have created a Search Help for F4 in a dialog program for SKAT-SAKNR OR SKAT-SAKNR. While i click F4 on that field, it displays blank values.
Here is the module:
module HELP_FOR_SAPGL_ACC input.
CLEAR t_SAPGL.
SELECT SAKNR TXT20
FROM SKAT
INTO CORRESPONDING FIELDS OF TABLE t_SAPGL UP TO 1000 ROWS
WHERE SPRAS = SY-LANGU.
WHERE L_GL_ACC = v_FIELD_VALUE-FIELDVALUE.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
DDIC_STRUCTURE = ' '
RETFIELD = 'SAKNR'
PVALKEY = ' '
DYNPPROG = PROGNAME
DYNPNR = DYNNUM
DYNPROFIELD = 'SKA1-SKANR'
STEPL = 0
WINDOW_TITLE =
VALUE = ' '
VALUE_ORG = 'S'
MULTIPLE_CHOICE = ' '
DISPLAY = ' '
CALLBACK_PROGRAM = ' '
CALLBACK_FORM = ' '
MARK_TAB =
IMPORTING
USER_RESET =
TABLES
VALUE_TAB = t_SAPGL
FIELD_TAB =
RETURN_TAB =
DYNPFLD_MAPPING =
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endmodule.
In the above code I am selecting 1000 rows from SKAT table and in the Search Help Popup it is also displaying 1000 rows but all are blank.
Please help me.
Regards,
AvaneetHi check my weblog on search help exit codeing..
https://wiki.sdn.sap.com/wiki/x/du0
\* Prepare for output
CALL FUNCTION 'F4UT_RESULTS_MAP'
TABLES
shlp_tab = shlp_tab
record_tab = record_tab
source_tab = lt_result
CHANGING
shlp = shlp
callcontrol = callcontrol
EXCEPTIONS
illegal_structure = 1
OTHERS = 2.
IF rc = 0.
callcontrol-step = 'DISP'.
ELSE. -
I have problem with buying in games , I got the massage that the purchased can not be completed , please contact iTunes support.. I need help for my case please
http://www.apple.com/support/itunes/contact/
-
Search help for date field in Editable ALV
Hello Friends,
I am using editable alv using 'reuse_* '.
I have used date as input field. While creating fieldcatlog also i have declared dat as a mkpf-budat.
But i am not getting serach help for date in output.
Is it possible with reuse or i have to go by object oriented ?Hi,
Just pass the Edit option of the fieldcatalog for those specific fields...
fcat-edit = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-cprog
i_callback_pf_status_set = 'PF_STATUS_SET'
i_callback_user_command = 'USER_COMMAND' "<---- pass this
i_callback_top_of_page = 'TOP'
is_layout = it_layout
it_fieldcat = it_fcat
i_default = 'X'
i_save = 'A'
it_events = it_event
TABLES
t_outtab = it_final
EXCEPTIONS
program_error = 1
OTHERS = 2.
*& Form USER_COMMAND
* text
* -->R_UCOMM text
* -->RS_SELFIELD text
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE r_ucomm.
WHEN '&DATA_SAVE'. "<-------check this
PERFORM save_data.
ENDCASE.
ENDFORM. "USER_COMMAND -
How to create a F4 help for a report selection screen field
hi,
can any one guide me to create F4 help for a field in a selection screen in a report program,plz give me a sample codehi,
Here are the following ways
1.with the help of match code objects we can create the F4 Functionality for Field.
Syntax is :
PARAMETERS: p_org LIKE t527x-orgeh MATCHCODE OBJECT zorg.
2. One more thing is we can do it with Search Help's also.
3. Even we can do it HELP Views also.
Help Views:
You have to create a help view if a view with outer join is needed as selection method of a search help
The selection method of a search help is either a table or a view. If you have to select data from several tables for the search help, you should generally use a database view as selection method. However, a database view always implements an inner join. If you need a view with outer join for the data selection, you have to use a help view as selection method.
All the tables included in a help view must be linked with foreign keys. Only foreign keys that have certain attributes can be used here. The first table to be inserted in the help view is called the primary table of the help view. The tables added to this primary table with foreign keys are called secondary tables.
The functionality of a help view has changed significantly between Release 3.0 and Release 4.0. In Release 3.0, a help view was automatically displayed for the input help (F4 help) for all the fields that were checked against the primary table of the help view. This is no longer the case in Release 4.0.
As of Release 4.0, you must explicitly create a search help that must be linked with the fields for which it is offered (see Linking Search Helps with Screen Fields ).
Existing help views are automatically migrated to search helps when you upgrade to a release higher than 4.0.
A help view implements an outer join, i.e. all the contents of the primary table of the help view are always displayed. You therefore should not formulate a selection condition for fields in one of the secondary tables of the help view. If records of these secondary tables cannot be read as a result of this selection condition, the contents of the corresponding fields of the secondary table are displayed with initial value.
<REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Feb 15, 2008 3:15 PM -
Reg : F4 help for custom fields in ALV report
hi friends..
in my internal table i have fields including 1 custom field..
DATA : BEGIN OF i_final OCCURS 0,
pernr LIKE p0000-pernr,
begda LIKE p0000-begda,
plans LIKE ZPOSITION-plans, (custom)
werks LIKE pspar-werks,
end of i_final.
i want to display this i_final table in alv. for that i genetrate one fieldcatalog
PERFORM fcat USING:
'I_FINAL' 'PERNR' 'P0000' 'PERNR' '15' 'X' '',
'I_FINAL' 'BEGDA' 'P0000' 'BEGDA' '10' 'X' '',
'I_FINAL' 'PLANS' 'ZPOSITION' 'PLANS' '8' 'X' '',
'I_FINAL' 'WERKS' 'PSPAR' 'WERKS' '14' 'X' ''.
in custom table zposition, i maintain serch help for custom field "PLANS".
then i used reuse_alv_grid_display.. for all the std fields along wit custom fields
i got f4 all std fields but for my custom i am not getting the f4 help
how can i get the F$ help for this custom fields Zposition-plans..
plz give some ideaHi
In that Ztable against the field
PLANS give the check table name as <b>T528B</b>
then it will automatically give the search help
or you can create your own search help(elementary) and add to that field
Reward if useful
regards
Anji -
How to add a search help for a field in alv?
HI!Everyone ,
i want to add a search help created by myself for one field in alv,
and i want to use this function "HELP_VALUES_GET_WITH_TABLE".
can anyone help me ?
thanks!HI,Vijay.
My code like this :
PERFORM build_fcat.
PERFORM build_objects.
PERFORM layo_build.
PERFORM set_drdn_table .
CALL METHOD alv_grid->set_table_for_first_display
EXPORTING
i_structure_name = 'STU_S'
is_layout = s_layo
CHANGING
it_outtab = itab_out
it_fieldcatalog = i_fcat
."Period
IF sy-subrc <> 0.
EXIT.
ENDIF.
for example, there is a field 'UNAME' IN Structure 'STU_S',
i want to add a search help for 'UNAME'.
the 'UNAME' is not users in SAP R/3 , i want to add some data by myself or from a table . -
How to add search help for field in ALV object
Hello,
In a program, we use ALV object ( container) to create a liste like : field1, field2 .. but when display we do not have search help for this . Could you please help me how to add match code in this case for field 1 and field2, We use set_table_for_first_display
Thanks,Hi,
when you define your field catalogue you can create data elements with search help in se11 and use them for field 1 and field 2.
But maybe it is enough to use data elements belonging to a domain with a value help and to set field F$AVAILABL in the field catalogue or to fill the name of the field CHECKTABLE.
Regards,
Klaus
Maybe you are looking for
-
Need sample pgm to delete entries
Hi experts , iam some prblm with transaction data .. so i want to delete these entries fro the table . what my question is ?? A program should take input from flat file consisting of same structure as of table XYZ table . NOW IT HAS TO DELETE ALL T
-
I am having issues with Quicktime. It would not open, so I tried to "delete" it and re-intall. When I did that, it would not let me install it and I got a message saying it could not install because I already had it. So, I guess what I need to know
-
Reading CSV file, populating text fields, saving each as image to folder
I need to generate a bunch of images by reading a CSV file of records, populating various text fields over an image and then saving each iteration as a new image in a folder. Is Illustrator the best solution to this problem? And if so can someone hel
-
Print Button not working properly in form
Hi Experts, I have modified one form everything fine but i faced one problem. when ever enter the item details in form then (print button is there)press the print button it will be give pdf file data properly coming, again if i modify the item detail
-
ISE v1.1.1 Network Setup Assistant errors
Hello Everyone. I've been having some difficulties with ISE v1.1.1 while setting up and testing the SISE course. It's setup so that BYOD users can self-service a guest account with the ISE and register their device. After that the Network Setup Assis