Can't send ascii>001

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
mileswilliams
Junior Coder
Posts: 24
Joined: Sun Jun 11, 2006 9:50 am

Can't send ascii>001

Post by mileswilliams » Sat Sep 23, 2006 1:14 am

I'm in the early throws of creating a macro to interact with "Remedy" the companies ticketing system.

I can't have direct access to the remedy database so I either have to tab from field to field entering data which is slow, (as the front end is a joke), or I can get Macro scheduler to write a simple text file which will be saved as a "remedy macro" essentially opening a ticket with all the details filled in, saving about a minute for each ticket raised.

Hope you are still with me.

The problem is, looking at macros created by remedy there is a character that appears in the text file.

It looks like SOH and appears to be the character represented by ascii>1 When I get MS to putascii>1 into notepad (with the fonts set so I should see the character), I get nothing.

I created a little script to write all ascii characters from 1-1000 in notepad, hoping to see it in the list... nope,

I tried copying the character then pasting it into a MS script ...nope.

Any ideas guys ?
Need more info ?

Thanks in advance.
don't be a chicken little

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Sat Sep 23, 2006 3:28 am

If it is ascii 001 you will not see it in Notepad or other text editor. I think you need to start by looking at the Remedy macro with a hex editor (plenty of free ones on the web) which will show you exactly what is in the file.

mileswilliams
Junior Coder
Posts: 24
Joined: Sun Jun 11, 2006 9:50 am

Post by mileswilliams » Sat Sep 23, 2006 5:04 am

If I change the font of notepad I can actually see the characters as I say, it looks like SOH written in small letters diagonally down from left to right. I can view it I can copy and paste it around within notepad.... but I can't create one from scratch, and I can't get MS to write one.

Thanks for the reply.
don't be a chicken little

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Sat Sep 23, 2006 5:57 am

Yes, sounds like Ascii code 1. Have verified this with Boxer Text Editor. I can't send it to Notepad, but sending it to Boxer works:

SetFocus>Boxer*
Ascii>1

Boxer has a nice Ansi character chart feature which shows this character and others.

http://www.boxersoftware.com/
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
JRL
Automation Wizard
Posts: 3526
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Sat Sep 23, 2006 7:50 am

Back in the old days the way I used to get special characters into files was to create a file that contained only the desired character, then use the "type" command from DOS and redirect the character into the file I was building. The secret is to remove the carriage return and line feed from the file that contains the special character. The way I accomplished that was to use an editor that could write the special character (used to be PCWrite but I no longer own a copy of that) then I used a little freeware tool called change.com that would let you change the text in a file from one thing to another at the DOS command line. For example at a DOS promt you would type:

change filename 13,10 ""

That would take all instances of carriage return line feed and change them to nul. This would provide a 1 byte file with only the special character in it.

15 minute typing break.........

I just used DOS edit to write a file with ascii character 001 in it. Then I used change.com to remove the carriage return and line feed. I now have a one byte file I called ascii_001.

Using this technique in macro scheduler would be something like:

Let>RP_WAIT=1
Run>cmd /c type ascii_001 >> remedy_macro
//then, since there's no carriage return and line feed I can do a
//writeln> and the result will end up on the same line directly following
//ascii 001
WriteLn>remedy_macro,wresult,whatever the heck I want to write.


I would end up with a line in remedy_macro:

☺whatever the heck I want to write.

If you have any interest in this, PM your email to me and I'll send you a copy of change.com. Or a copy of any one byte file you want me to create. As long as the one byte is an aascii char I can make with DOS edit.

By the way to put any ascii character into DOS edit, follow this process.

- Open a DOS window
- type Edit at the command line and press enter
- press ctrl + p
- press and hold alt while you type the 3 digit ascii code of the character you want using the number pad.( You have to use the number pad)
- release alt.

You should now see your ascii character in the editor.

Hope this is helpful,
Dick

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Sat Sep 23, 2006 2:09 pm

Maybe it would be simpler to write the file with a unique character, like "~", substituted for the ascii 001 and then do a replace in the final file (vbscript).

mileswilliams
Junior Coder
Posts: 24
Joined: Sun Jun 11, 2006 9:50 am

Post by mileswilliams » Sat Sep 23, 2006 6:34 pm

Wow, thanks for the replies guys, JRL the idea you have, while very simple, and I'm sure effective, would mean that I would need this application installed on all users machines, plus there is the "idiot" factor where the ascii001 file is bound to be deleted etc. There are ways around all this but ideally, I would simply do something like :



writeln>test.txt,result,A load of text ascii>001 a load more text etc

N.B I have tried

let>p=ascii>1
writeln>test.txt,result,A load of text %p% a load more text etc


Neither works.
Maybe it would be simpler to write the file with a unique character, like "~", substituted for the ascii 001 and then do a replace in the final file (vbscript).
That would be a good workaround, but I am finding the application of the idea all but impossible... But I'll try, then post my results, see if you guys think I am on the right track.

Thanks again.
don't be a chicken little

mileswilliams
Junior Coder
Posts: 24
Joined: Sun Jun 11, 2006 9:50 am

Post by mileswilliams » Sat Sep 23, 2006 6:58 pm

Tried a stringreplace type of thing :

Code: Select all

readln>c:\test.arq,5,remmacro
Stringreplace>remmacro,ascii>1,€,newscript
writeln>c:\newtest.arq,newscript
it doesn't work.... It looks like I need to get MS to run ascii>1 first. Kind of a BODMAS thing in maths do the brackets first....

Stringreplace>remmacro,[ascii>1],€,newscript

I have no idea hopefully you will get where I am pointing.
don't be a chicken little

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Sat Sep 23, 2006 8:02 pm

I don't think the regular replace will do it, I'm pretty sure vbscript can do an ascii replace, but I'm a real beginner there so that will take me a while to figure out :(

Hmmm, I wonder if you could save ascii 1 in a file, then read it into a variable from the file and use it?

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Sat Sep 23, 2006 8:40 pm

Got it :) Thanks to a Bob Hansen post from a while ago.

VBSTART
VBEND


//generate the text


Let>mystring=sdaf^safdsfsa^
VBEval>Replace("%mystring%","^",chr(1)),newstring
MessageModal>%newstring%

johngough
Newbie
Posts: 1
Joined: Sat Sep 23, 2006 9:15 pm

Post by johngough » Sat Sep 23, 2006 9:34 pm

Miles,

What a brilliant idea. I use a similar system by the sounds of it. It sounds to me like you are trying to create Remedy macros on the fly, probably inputting several variables.

Having read some of the ideas above I gave this a try and it seems to create a file that will populate a New remedy form fairly well. Using JRL's above idea this is what I tried:

Code: Select all

Readln>C:\soh.txt,1,soh
	Let>head=soh
    Writeln>C:\AUTOMACRO.arq,result,AUTOMACRO%LF%Set-schema: TkT-TT-Main%head%stkp1.stk.orange.co.uk%LF%Form-open: %LF%Submit-display: TkT-TT-Main%LF%Form-final: new%head%800002160=%head%800002151=No%head%800002086=Yes%head%800002018=%head%800002005=Only AssignedGrp Can Update%head%800001931=1209600%head%800001869=Yes%head%800001861


etc.

where code i.e.800001869 is the ID for a particular box on the form.
See if it works for you

mileswilliams
Junior Coder
Posts: 24
Joined: Sun Jun 11, 2006 9:50 am

Post by mileswilliams » Sat Sep 23, 2006 9:49 pm

me_again

Spot on !!!

Code: Select all

VBstart
VBend



Let>mystring=sdaf^safdsfsa^
VBEval>Replace("%mystring%","^",chr(1)),newstring
writeln>c:\test.txt,result,newstring
I made a slight adjustment as you can see to write to file, but you have solved my little problem.

Out of curiosity is chr(1)) the ascii>1 ie. chr(23)) would be ascii>23 ?

Thanks for your replies, another happy customer.
don't be a chicken little

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Sat Sep 23, 2006 10:08 pm

Pretty cool huh?

Out of curiosity is chr(1)) the ascii>1 ie. chr(23)) would be ascii>23 ?

Yes!

mileswilliams
Junior Coder
Posts: 24
Joined: Sun Jun 11, 2006 9:50 am

Post by mileswilliams » Sat Sep 23, 2006 11:03 pm

Cheers, if you lived in Wales, I'd buy you a beer.
don't be a chicken little

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts