Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //is supposed to convert text from one physical keyboard layout to another
- bficontents = "";
- bficontents_1 = "";
- layout_qwerty = "1234567890-=qwertyuiop[]\asdfghjkl;'zxcvbnm,./";
- layout_dvorak = "1234567890[]',.pyfgcrl/=\aoeuidhtns-;qjkxbmwvz";
- newline = "
- ";
- filename=get_open_filename("*","");
- if(filename==""){game_end();}
- fid = file_text_open_read(filename);
- while(!file_text_eof(fid)){
- bficontents += file_text_read_string(fid)+newline;
- file_text_readln(fid);
- }
- //loop through each character of the text file.
- //replace characters of qwerty layour with ones of dvorak layout
- for(i=0;i<string_length(bficontents);i+=1){
- currentchar = string_char_at(bficontents,i);
- for(n=0;n<string_length(layout_dvorak);n+=1){
- if(string_char_at(layout_dvorak,n)==currentchar){
- currentchar=string_char_at(layout_qwerty,n);
- break;
- }else if(string_char_at(string_upper(layout_dvorak),n)==currentchar){
- currentchar=string_char_at(string_upper(layout_qwerty),n);
- break;
- }
- }
- bficontents_1 += currentchar;
- }
- file_text_close(fid);
- fid=file_text_open_write(filename+"_out");
- file_text_write_string(fid, bficontents_1);
- file_text_close(fid);
- show_message("Finished reading, converting, saving.
- Length: "+string(i));
- game_end();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement