Script making text binary
have an Automator script that is doing something funky and I was wondering if someone can tell me what I am doing wrong. What the script does, is:
1. Filters an IRC chat log so that it is broken into 3 hours (2PM, 3PM, 4PM)
2. It then combines the three hour logs into a single text file
3. Next it renames the file to chat_today's date.zip
4. Then it zips the file as archive.zip
5. Next it renames it to chat_today's date.zip
6. It then uploads the zip to an FTP server
7. Then the IRC chat as a whole (all hours) is zipped and archived
8. Original "whole" chat log is then moved to the trash as is the individual hour text files and the uploaded zip
My problem is that when you download the zip file and view the text on a Mac it looks fine, however, if you view the same file on a PC it puts in extra binary spaces and wants to use the "big endian" format if viewed in Word.
Here is an example of what I mean: http://leoville.tv/chatlogs/chat_20060430.zip
PDF of the script: http://www.dslreports.com/r0/download/1004769~239f9bacc1353186425116afaae3c6e5/V ersion%202--Get%20KFI%20Chat%20Logs.zip
MacBook Pro & Mac Mini (G4) Mac OS X (10.4.5)
Michael,
if you look at the log file with a HEX Editor, you will see the following:
FE FF 02 DB 02 C7 00 00 00 41 00 00 00 70 ...
This means that the file was originally Unicode (UTF-16) but was interpreted as MacRoman and then converted to Unicode, resulting in everything being duplicated:
• FE FF is the Unicode byte-order mark which was added in the conversion - this is fine
• 02 DB is the UTF-16 equivalent of the character FE in MacRoman, 02 C7 is the equivalent of FF - which means you had a Unicode byte-order mark before but it got interpreted as MacRoman and converted to Unicode again
• 00 00 00 41 is the Unicode equivalent of 00 41 (which is Unicode already and denotes the character "A") interpreted as MacRoman
Looking at the work flow and playing around in Automator a little, it seems as if it does not allow you the flexibility to specify file encodings so you might have to use an AppleScript or shell script within your workflow - you could use AppleScript to extract the paragraph from the original file and write to a new file and then zip that new file or use a little shell script which does it all (use "sed" to extract everything between the date and the next new paragraph and then pipe the output to "zip")
Andreas
Similar Messages
-
4s with latest software update will not power off, text will only vibrate, iPod only works with earphones. When I sync it with iTunes it works until power save mode starts, then back to not powering down, making text sounds, or playing iPod out loud.
The Basic Troubleshooting Steps are:
Restart... Reset... Restore from Backup... Restore as New...
Restart / Reset
http://support.apple.com/kb/ht1430
Backing up, Updating and Restoring
http://support.apple.com/kb/HT1414
If you try all these steps and you still have issues... Then a Visit to an Apple Store or AASP (Authorized Apple Service Provider) is the Next Step...
Be sure to make an appointment first... -
Making text a 3d repousse object is easy enough, but if I add filters to the text, select it and then try to make a repousse object FROM the selection, the text gets rendered in 3d, but
there is no hole between letters like O and P and A. Is there anyway I can cut holes into these letters? If not then how else can I make 3d text with filters on them?
Any help would be greatly appreciated, ThanksSee if this helps:
http://forums.adobe.com/message/4238532#4238532 -
I am trying to open a page in IE-tab using javascript like this, <script type="text/javascript"> window.location.href = "chrome://coralietab/content/container.html?url=0,myurl" ;</script>.Error occured : [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMLocation.href]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame ::myurl :: load :: line 234" data: no] I have IE-Tab plug-in installed..when I open the same link manually in mozilla,it works fine and page gets opened in Ie-tab.
The only way this might be possible is by using the HostContainer object
to access the HTML page and do it from there. -
Help Making Text Picture Frames
I came across this neat design feature, and I am not too sure how to go about creating this element because I am new to Illustrator. Still, I figure this is either a PS or an Illustrator feature. Whatever the case, how can I go about making text that incorporates picture frames as seen in the words "Road Trip" (and if there are any videos out there that would be great).
I think what you are asking is how to make images appear through type.
If you want to make a single image appear through a word, all you need to do is to position the (live) type on top of the image, select type and image and hit Cmd/Ctrl+7. This makes the type into a clipping mask.
Alternatively, if you want each letter to contain a separate image, outline the type, ungroup (preferably) and make each letter into a clipping mask over its own image.
There are other ways but this is the easiest.
Here are two examples:
The top one is live type masking a single image.
The bottom one is outlined type masking two images. In this case you will need to make compound paths, one for each set of letters, WES and TMAN ISLANDS. Each compound path masks its own image. -
New to bash scripting; making script to change laptop CPU governor
I've got an old laptop and I like to be able to change the governor between performance and ondemand depending on whether or not I've got the laptop plugged in. I'd really like to be able to do this from a shortcut on the desktop, so I decided to try making a bash script that used Zenity dialogs to accomplish this.
I think it turned out pretty much how I'd like, however the error handling on getting the root password authenticated is pretty broken. I'm not sure how exactly I should go about it.. I think that the long timeout that occurs when you enter a wrong password for su is causing problems. Is there a better way of doing this? I don't use sudo, and I'd really prefer to avoid it and stick to using su if at all possible.
#!/bin/bash
#This script will supply a Zenity dialog with the option to change the laptop's governor.
#It will use a Zenity dialog to acquire the root password from user for autorization to change the governor.
#Set up some variables we will use.
optionPerformance="FALSE"
optionOndemand="FALSE"
#Read the current state of the governor.
currentGovernor=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)
#Change the variables we previously set up to reflect current state of governor. This will be used to determine which option is pre-selected in the Zenity dialog we will create.
if [ $currentGovernor = 'performance' ]
then optionPerformance="TRUE"
fi
if [ $currentGovernor = 'ondemand' ]
then opitonOndemand="TRUE"
fi
#Set up Zenity dialog which allows user to select the governor they want active. The currently active governor will be selected by default.
#User's input will go to the wantedGovernor variable for future use.
wantedGovernor=$(zenity --list --text "Select which governor you want to make active:" --radiolist --column "" --column "Options" $optionPerformance "performance" $optionOndemand "ondemand")
#Check to see if user clicked Cancel button.
if [ $? = 1 ]
then exit 0
fi
#Did user select the already active profile? If so, simply report that and exit.
if [ $wantedGovernor = $currentGovernor ]
then
newGovernor=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)
zenity --info --text "Governor is already set to $newGovernor.\n\nNo changes were made."
exit 0
fi
#Now that we know what the user wants, let's do it.
#We will use cpupower to change the governor. This will require root privileges, so we will use Zenity to get the root password from user and pipe it into su. (Is this the best way?)
zenity --title "Password for root:" --password | su -c "cpupower frequency-set -g $wantedGovernor"
#Check to see if user clicked Cancel button.
if [ ${PIPESTATUS[0]} = 1 ]
then exit 0
fi
#Check to see if user entered incorrect root password.
if [ ${PIPESTATUS[1]} = 1 ]
then
zenity --error --text "Incorrect root password.";
exit 1
fi
#Now that we've made the change, let's check the current state of the governor again so that we can report it to the user and they can verify success.
newGovernor=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)
zenity --info --text "Governor is now set to $newGovernor."
Last edited by gilmoreja (2015-01-26 21:49:19)Thanks for the advice, Awebb. I looked into gksu but I didn't like how it offered to save the root password in gnome-keyring. I found an alternative, ktsuss, and decided to go with that instead.
I'll post the finished script here, for anyone who is ever interested in such a thing:
#!/bin/bash
#This script will supply a Zenity dialog with the option to change the laptop's governor.
#It will use a Zenity dialog to acquire the root password from user for autorization to change the governor.
#Set up some variables we will use.
optionPerformance="FALSE"
optionOndemand="FALSE"
#Read the current state of the governor.
currentGovernor=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)
#Change the variables we previously set up to reflect current state of governor. This will be used to determine which option is pre-selected in the Zenity dialog we will create.
if [ $currentGovernor = 'performance' ]
then
optionPerformance="TRUE"
fi
if [ $currentGovernor = 'ondemand' ]
then optionOndemand="TRUE"
fi
#Set up Zenity dialog which allows user to select the governor they want active. The currently active governor will be selected by default.
#User's input will go to the wantedGovernor variable for future use.
wantedGovernor=$(zenity --list --text "Select which governor you want to make active:" --radiolist --column "" --column "Options" $optionPerformance "performance" $optionOndemand "ondemand")
#Check to see if user clicked Cancel button.
if [ $? = 1 ]
then exit 0
fi
#Did user select the already active profile? If so, simply report that and exit.
if [ $wantedGovernor = $currentGovernor ]
then
newGovernor=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)
zenity --info --text "Governor is already set to $newGovernor.\n\nNo changes were made."
exit 0
fi
#Now that we know what the user wants, let's do it.
#We will use cpupower to change the governor. This will require root privileges, so we will use ktsuss to get that.
ktsuss cpupower frequency-set -g $wantedGovernor
#Now that we've made the change, let's check the current state of the governor again so that we can report it to the user and they can verify success.
newGovernor=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)
zenity --info --text "Governor is now set to $newGovernor." -
SAP SCRIPT Header text and Item text not printing in customized PO
Hello Experts,
I have copied the standard MEDRUCK to ZMEDRUCK and customized the form according to the requirement.
I want to print the header text and Item text in my form.
For Header text I have used :
/: INCLUDE &EKKO-EBELN& OBJECT EKKO ID F01
Problem 1: The text what I enter in header text is flowing only when I hit on print preview without saving the form. Once I save the SAP SCRIPT and click on print preview the field is appearing blank. I also tried to print the form, but the field is appearing blank even on the print out.
Problem 2: For item text the field is concatenation of EBELN & EBELP. Can anyone suggest me how to concatenate and fetch the text in item text.Hi,
Im getting an error in my subroutine pool for i_xtline which is to fetch ITEM TEXT., It says its not a in any internal table nor defined as data. How can I proceed further. I have pasted my code below. Please check and revert ASAP
PROGRAM ZMEDRUCK_SUBP1.
TABLES: EKPO, EKKO.
FORM fetch_table_data TABLES in_tab STRUCTURE itcsy
out_tab STRUCTURE itcsy.
data xname like THEAD-TDNAME.
data i_xtline like xtline.
clear i_xtline.
refresh i_xtline.
CONCATENATE EKPO-ebeln EKPO-ebelp INTO v_item_text.
MOVE v_item_text to ITEMTXT.
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
id = F01
language = EN
name = ITEMTXT
object = EKPO
ARCHIVE_HANDLE = 0
LOCAL_CAT = ' '
IMPORTING
HEADER =
tables
lines = i_xtline
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. -
Error while uploading script form text file to SAP system
hi
i down loaded a SAP Script from production server to local test file using RSTXSCRP
it get downloaded successfully but when i am uploading it to development server it is giving ERROR as :
Transport object FORM ZIV_MEDRUCK_PO is being processed
Language vector used: DE
Original language was set to E
ERROR: Save with SAVE_TEXT(FORM ZIV_MEDRUCK_PO SAP DEF ) failed
Text ID DEF 1 for text object FORM 2 does not exist
001 fatal error(s) occurred during import
ERROR: Invalid start marker: instead of H
ERROR: Invalid start marker: instead of H
please help .Hi ,
The text used in the previosu script is not in language en or proabably the standard text is not existent at the application server .
Create the same text first then try uploading it it shold work.
Regards,
Nisrin. -
SAP SCRIPT: Header text not printing - Custom Purchase Order.
Hello Experts,
I have used the standard MEDRUCK and copied to ZMEDRUCK. I want the PO header text to print in my form.
I have used subroutine-pool and called it in the form.
Here is my subroutine
FORM fetch_table_data TABLES in_tab STRUCTURE itcsy
out_tab STRUCTURE itcsy.
TABLES EKKO.
DATA: BEGIN OF header OCCURS 0,
ld_txt1(163),
ld_txt2(163),
ld_txt3(163),
END OF header.
DATA: li_lines LIKE STANDARD TABLE OF tline WITH HEADER LINE,
ID like THEAD-TDID,
TNAME LIKE THEAD-TDNAME,
TDOBJECT like THEAD-TDOBJECT.
DATA HTEXT LIKE EKKO-EBELN.
* HTEXT = EKKO-EBELN.
READ TABLE in_tab WITH KEY EKKO-EBELN.
if sy-subrc = 0.
TNAME = in_tab-value.
ENDIF.
TNAME = EKKO-EBELN.
*CONCATENATE EKPO-ebeln EKPO-ebelp INTO v_item_text.
*MOVE v_head_text to HNAME.
CALL FUNCTION 'READ_TEXT'
EXPORTING
* CLIENT = SY-MANDT
id = 'F01'
language = 'E'
name = TNAME
object = 'EKKO'
* ARCHIVE_HANDLE = 0
* LOCAL_CAT = ' '
* IMPORTING
* HEADER = TNAME
tables
lines = li_lines
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
* WRONG_ACCESS_TO_ARCHIVE = 7
* OTHERS = 8
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CLEAR out_tab.
out_tab-VALUE = TNAME.
CONDENSE out_tab-VALUE.
MODIFY out_tab TRANSPORTING VALUE WHERE NAME = 'TNAME'.
ENDFORM.
And my script in the form is
PERFORM FETCH_TABLE_DATA IN PROGRAM ZMEDRUCK_SUBP2
USING &EKKO-EBELN&
CHANGING &TNAME&
ENDPERFORMpar RECEIVED FROM M/S &TNAME&
The header text is still not flowing in my form.
What mistake i'm I doing here ?
How can I resolve this ?
Pls help !Hi,
Data is li_lines internal table. 1st you have to read the text form the internal table line by sy-tabix.
At last you have to concatenate these variable into the out tab value.
you can use the following code
ORM fetch_table_data TABLES in_tab STRUCTURE itcsy
out_tab STRUCTURE itcsy.
TABLES EKKO.
DATA: BEGIN OF header OCCURS 0,
ld_txt1(163),
ld_txt2(163),
ld_txt3(163),
END OF header.
DATA: li_lines LIKE STANDARD TABLE OF tline WITH HEADER LINE,
ID like THEAD-TDID,
TNAME LIKE THEAD-TDNAME,
TDOBJECT like THEAD-TDOBJECT.
DATA HTEXT LIKE EKKO-EBELN.
READ TABLE in_tab WITH KEY EKKO-EBELN.
if sy-subrc = 0.
TNAME = in_tab-value.
ENDIF.
ALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
id = 'F01'
language = 'E'
name = TNAME
object = 'EKKO'
ARCHIVE_HANDLE = 0
LOCAL_CAT = ' '
IMPORTING
HEADER =
tables
lines = li_lines
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8
IF sy-subrc 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
data : f_lines TYPE i,
DESCRIBE TABLE li_lines LINES f_lines.
data: lstr type String,
lstr1 type string,
lstr2 type string,
lstr3 type string,
lstr4 type string.
read table li_lines index 1.
lstr = li_lines
condense lstr.
clear li_lines
read table li_lines index 2.
lstr1 = li_lines
condense lstr.
clear li_lines
read table li_lines index 3.
lstr2 = li_lines
condense lstr.
clear li_lines
if f_lines GT 3.
ead table li_lines index 4.
lstr3 = li_lines
condense lstr.
clear li_lines
ead table li_lines index 5.
lstr4 = li_lines
condense lstr.
clear li_lines
endif.
data : v_text type text.
concatenate lstr1 lstr2 lstr3 lstr4 into v_text separate by ' '.
CLEAR out_tab.
READ TABLE out_tab WITH KEY name = 'TNAME'.
out_tab-value = v_text
MODIFY out_tab INDEX sy-tabix.
Regards
Nayan Kumar -
Hello,
Does anyone no how to add links to a flash page step by step.
I'm realy not sure how and how to make them link to another page?
I thank you in advance,
VinceTo add link to a button, do the following:
1- Create a button, which could be you text converted to a
button
2- Access the Action Script panel in the script assist mode
(find its button in the top of the Action panel)
3- choose getURL action from the left menu (find it in Global
Functions> Broswer/Network> getURL)
4- In th URL field, write the URL you would like you button
to go to.
And to make you text a link, you can do the following:
1- Write the text you would like to be a link
2- in the text properties panel, write your URL in the URL
field
Hope this helps -
SAP Script: Include text in MAIN window prints outside MAIN window margins
Hi,
We're facing a peculiar issue. We call a text element in the MAIN window of an SAP Script form using FM WRITE_FORM.
The element has 2 includes.
The problem is that when the content of any of the 2 includes is large enough, the include text prints overflows outside the MAIN window margins on the first page and into the area of the footer window of the same page. It does not automatically flow to the next page MAIN window.
We have checked that the MAIN window and FOOTER window margins do not overlap. Infact they are quite far from each other.
We have tried stuff like using a forced PROTECT, change the para format etc, but nothing solves the problem.
Does anyone have any idea?You do not need to use the subroutine READ_ORDER_TEXT to get another text name because you already have it: TMP_TXNAM2 .
Pass this value back to your SAPscript, and it is okay.
Or you can even check the text object is empty or not, if no text is found, print 2 empty lines:
still use your subroutine to read the text, if no line is found, set TMP_TXNAM2 to empty, otherwise, no change,
In SAPscript, check the value is empty or not, then print 2 empty line or the text object... -
Script making Flash 9 running slow Error
Hey guys i have a site that manage uploads for our content
providers, but when you run the flash movie and you start uploading
a file, somewhere is the middle of the upload, a message pops
saying that a script in the movie is making the flash player to run
slow, and thta you computer may turn unresponive, after googling
for this error i find out that my script may have a infinitive loop
or function, i've been tryint to find the error on my scrip but
with no luck, here is the code, if anyone have a chance to take a
look will be appreciate it. thanks in advance.Can you repost your code so that it is displayed line by line
rather than one long line? -
SAP Script absolute text positions
HI everyone,
I am kind of new to SAP Script and I have some trouble defining correct positions of text.
The point is the following:
I got a lot of boxes, frames and so on with fixed positions.
Every of these boxes and frames create a kind of table with a fixed amount of lines (for instance 5 lines each table).
For instance
Box1
Customer
cust1
cust2
Box2
discount
dis1
dis2
I create the boxes by using variable windows fix on the page. The text needs to be written at the main window as I do not know the exact amount of lines (max 5, but can be less). For example, if I can only receive 1 instead of 5 customers, the text for discounts will not be placed at the dicount table correctly. How can I solve this problem? I can not write multiple lines of text in variable windows by using a loop. If I am writing the text at the main window the start of these texts will not be static and absolute?
Greetings from Berlin
Robert
Edited by: RQuade on Nov 29, 2010 11:13 PMYou can both write text lines and draw boxes within the MAIN window processing. Check the help files for the BOX and POSITION commands for the box positioning. You may want to google the SAPScript Made Easy Guide and download it as well.
-
Hi Experts,
In a classical ABAP report we make use of
write:/20 'Text'.
to print text from the 20th column. Can we do something similar in a SAP Script Page Window. I have a box and lines drawn. Now I want the text to start exactly after the vertical line(column). Is there a way to do in SAP Script.
Regards
Abdullah.Hi
You can do one thing. you can straight away write the field
&BSEG-SGTXT&
in two lines straight with offset.
in the first line T1 &BSEG-SGTXT+0(25)&
In second line T1 &BSEG-SGTXT+25(25)&
first write like this and see, is it printing or not.
Reward all helpfull answers
Regards
Pavan -
Hello. I have a few simple things that I want to know how to do in Illustrator with Java script so that I can easily automate it. I have looked at examples of scripts but most are too large and doing too many things for me to understand. If you can answer any one of these please do so.
1) How to determine the font size of text without having text selected? All fonts in my files should be the same size so this may require just testing the first text found, possibly by just scrolling through all of the objects until text is found. I would like to have the font size to be set to a variable that I can use it later.
2) How to set all text in document to a given font size and type? Let's say Helvetica, 6pt.
3) How to convert all text to black? I have some files that begin with gray text but I would like to take a whole document, scroll through each text and convert them all to black.
2) How to select everything and transform-scale? I would like to know how to scale with and without strokes and effects in script.
4) How to select everything and center it both horizontally and vertically?
6) How to insert the file name without extension and put into bottom right corner?
7) How to embed an unopened file and put into bottom left corner?
8) How to add a stroke of 1 px to inside edge of document?
Thanks for any help you can give.This is probably NOT the fastest of methods of dealing with text but should be the easiest to understand… Should get you started.
#target illustrator
var docRef = app.activeDocument;
with (docRef) {
// Get a swatches color object by name
var myColor = swatches.getByName('Black').color;
// Get a text font object by name
var myFont = textFonts.getByName('Helvetica');
// Loop thru stories
for (var i = 0; i < stories.length; i++) {
// Then loop thru characters
for (var j = 0; j < stories[i].characters.length; j++) {
// Change character Attributes
stories[i].characters[j].characterAttributes.size = 6;
stories[i].characters[j].characterAttributes.fillColor = myColor;
stories[i].characters[j].characterAttributes.textFont = myFont;
Maybe you are looking for
-
Actual cost is not seen in the variance calculation KKS2
Hi I did variance calculation of a Production order ( after telco) . Its a co - product. The target cost , actual cost and allocated cost fields are present after execution. Now the actual cost field is blank and so the va
-
Determine number of resources affected by "transition in"
If a MPR/Workflow is kicked off based on resources transitioning into a set, is there a way to determine how many records were transitioned in? E.g. the existing set already contains 50 resources and after the transition in, it contains 60. I basical
-
How to assign single responsibity to all the applications user?
how to assign single responsibity to all the applications user? Thanks in advance
-
One Monitor per mailbox?
I have a Windows switcher client coming from Eudora (yuck) to hopefully Apple Mail. For years he's had two email accounts using two instances of (Windows) Eudora, one on each of two monitors so he can glance between the two accounts constantly. I was
-
Error 1009 when run on different server
My app has a master detail layout populated by remote calls to cfcs. A cfc returns a query for the master list and that part works fine. After the master list is populated or when selecting any row in the master list another cfc is called to return a