OQ Editor

بسم الله الرحمن الرحيم

OQ-Editor is specially programmed to design oq-code which is used in OpenQuran since version 1.9.10.
With oq code users can automate almost every method which is used in OpenQuran and even call hidden methods such as downloading files und playing Mp3 audio files.

OQ Editor contains (on the right side of it) all methods in an easy to learn syntax. We can call any method by double clicking the method name from the list and modify it the way we want to.
There’s also a download manager, Mp3 player, Html Designer for nice formatted comments and an easy debugger to test the code.

See some examples:

  1. Die Basmalah
  2. Saad Buchstabe
The Navigation Window

The first line of oq code must begin with the syntax:
use oq code;

OQ Code runs inside the NAV-Box of OpenQuran. That´s why its important to make difference between NAV function which consist of viewing verses by typing verse numbers beside some comments and the functions to OQ-Code.
By starting with the first method “use oq code” the navigation window will appear and run the code one command after the other.

To test these 2 differences, first we type (or copy / paste) the following code in the NAV Box:

  1. (This how to use the Nav Box
    I would like to show you the verses from 1 to 3 of sura number 1) 1:1-3 (The rest of this Sura are the verses 4 to 7) 1:4-7
  2. use oq code;
    messagebox: The following code will select the quran table of openquran database,
    If you still don´t have this table the code will download it for you and install it.
    But if you already have it the code will skip the download and installation;
    download: http://openquran.de/download/quran.txt;
    txt to data: quran.txt;
    messagebox: Ok, now we r sure, that you have the table “quran”
    The next step is selecting this table from the Translations Tab, select sura number 1 to 3 and show them in the browser;
    select translation: quran;
    show basmalah;
    select sura number: 1-3;
    show selected sura;

As we can see: the first code which handles only comments and verses, is running without the navigation window and the second code opens the navigation window to show and run all commands.
OQ Code can be saved in *.oq files for own purpose or to share with other users. This way we can prevent Tutorials and Explanations for many themes, Teach quran spelling with running audio mp3 files, share translations and many other things.

 

Commands:

 

Command Explanation
use_oq_code; The first line of oq code must begin with this syntax:
use_oq_code;
(…) [1:1-7] View Comments and verses in the browser:
(My comment) [1:1];
show_basmalah: yes | no; Include Basmalahs by viewing suras or by searches
show_basmalah: yes;
sura_info: yes | no; Include sura info by viewing suras
sura_info: yes;
go_backward; Go backward function of the browser
go_forward; Go forward function of the browser
select_all_text; Selecting all text in the browser
sort_verse_numbers; separate and view only verse numbers from the browser content
sort_only_text; separate and view only the text from the browser content without the numbers
gematrical_value_from: selection; Selects whole content of the browser and gets the gematrical value of the text
gematrical_value_from: myWord; gets the gematrical value of a given letter/word/phrase
gematrical_value_from: رفيع;
stop; Stops code and reset to start
pause: 1; Pause the code in seconds (e.g. pause the code and run after 3 seconds):
pause: 3;
messagebox: yourText; A messageBox with OK-Button for necessary hints
messagebox: Press play Button to start the tutorial;
openquran_info; Runs the info window of OpenQuran
select_sura_number: setNumber/s; Select specified sura numbers:
select sura number: 1 3 5 7;
or make a range of specified sura numbers:
select sura number: 1-9;
select_initialed_suras; Select suras which begin with special initial letters
select_uninitialed_suras; Select suras which have no special initial Letters
select_meccan_suras; Select suras which revealed in mecca
select_medinan_suras; Select suras which revealed in medina
select_odd_suras; Select odd numbered suras
select_even_suras; Select even numbered suras
show_selected_sura; After selection we can run to view the chosen sura numbers
searchbox: word;

 

Send a letter/word/phrase to the searchBox
searchbox: ص;
run_search; Runs the normal search method
run_analyze; Runs the analyses search method
search_options: Method; There are 7 methods for the search options to define:

  1. browser_content: Selects the checkBox “Browser content” in the search option tab
  2. whole_quran: Selects 1 checkBox “Whole Quran ” in the search option tab
  3. only_selected_suras: Selects the checkBox “Only selected suras ” in the search option tab
  4. match_word: Selects the checkBox “Match word ” in the search option tab
  5. case_sensitive: Selects the checkBox “Case sensitive ” in the search option tab
  6. regular_expressions: Selects the checkBox “Regular Expressions ” in the search option tab
  7. clear: Clears selection of Regular Expressions
count_search: word = 2; Searches for letter/word/phrase which occurs exactly like the given amount in every verse:
count_search:ك=2;
count_search: word > 2; Searches for letter/word/phrase which occurs more than the given amount in every verse:
count_search:ال>7;
count_search: word < 2; Searches for letter/word/phrase which occurs lesser than the given amount in every verse:
count_search:ال<7;
send_to_calc: Numbers;

 

Sends any number to the calculator box:
send_to_calculator: 1234567890;
send_to_calc: selection; sends the browser content to the calculator
calc_options: Method; There are 6 methods for the calc options to define:

  1. clear: Uncheck all selected options for the calculator
  2. only_sura_numbers: Select this option to calculate only sura numbers:
    1:1 2:1 3:4 4:6 ….
  3. only_verse_numbers: Select this option to calculate only verse numbers:
    1:1 2:1 3:4 4:6 ….
  4. set_counts_before: Select this option to set a sequence number beginning with 1 before every verse or sura:
    11 21 34 46 ….
  5. set_counts_after: Select this option to set a sequence number begriming with 1 after every verse or sura:
    11 12 43 64 ….
  6. calc_options: usual; Select this option to use the calc for usual calculations such as:
    1+2+3-2*2+6*2 // Resul 14
run_calculator: R; Runs the calculation with one of the 5 methods
+ (Plus)
(Minus)
* (Multiplication)
/ (Division)
R (Remainder)
run_calculator: *;
set_divider_to: 19; The default number for calculations in OpenQuran is 19. We can change it to what ever we want:
set_divider_to: 7;
if_no_file: fileName; Check out if the file exists by the user:
if_no_file: myAudioFile.mp3;
download: Url; If the condition “if no file” is true, we can prevent the url of the file to download
download: http://www.openquran.de/myAudioFile.mp3;
The downloaded file will be saved in the folder “downloads” of openquran
save_as: fileName; We can give the file a specified name to make it unique in the users folder “downloads” of “openquran”:
save_as: openquran001.mp3;
open_oq: fileName; Close current navigation window and opens a new one with the defined file. The defined file has to be an *.oq file and exists in the folder “downloads” of openquran:
open_oq: next_Tutorial.oq;
play_audio: audioFileName; Runs the audio file:
play_audio: openquran001.mp3;
pause_audio; Pauses audio file
stop_audio; Stops the audio file and resets to start
if_audio_position: setNumber; A condition to run any command when the playing audio file reaches a specified position
if_audio_position: 6555; [1:1];
This will view verse 1:1 when the audio reaches position 6555
set_audio_position: setNumber; After the command “play audio” we can jump at a specified position:
play_audio: openquran001.mp3;
set_audio_position: 19355;
if_no_translation: translationName; Check if the user has the translation we need
if_no_translation: quran;
download: http://openquran.de/download/quran.txt;
txt_to_data: translationFile; Include the translation file to the database of the user:
txt_to_data: quran.txt;
select_translation: translationName; If the user has the translation we require, we can unselect all others and leave only this one selected:
select_translation: quran;
commandsDefinition[int]{ …. } With this function we can define many commands and give them a specified number. This way we can add this bunch of commands when ever we need them by calling “commandNr” with its function number:
commandsDefinition[1]{
search_options: clear;
search_options: regular_expressions;
search_options: whole_quran;
run_analyze;
stop;
}
commandNr: number; Calling the commands which defined in commandsDefinition[1]{…}
commandNr:1;
Comments And Verses

To view single verses or a range of verses we use square bracket [] and type the verse numbers inside:
[1:1 2:1 3:1-7 6:1-19];
To include comments between verses, we use parenthesis ( ):
(This is verse 1 to 3 of sura 1) [1:1-3] (The rest of sura 1 is the verses 4 to 7) [1:4-7];
We can also use HTML tags in comments:
[1:1] (

A big SALAM

);

 

Use of Parenthesis and Semicolons

To write comments it is necessary to set the text between parenthesis as explained in the upper table. Within the parenthesis we are not allowed to use them again or to use Semicolons ( ; ). But! some times we need the usage of these 2 signs in our comments which is done easily by including a Backslash ( \\ ) right before the sign:

(

Including \\(Paren1sis\\) and \\(Semicolons\\) in our comments

)

 

Use of Comments Designer

The Comments Designer is specially created for designing long comments and send them back to the Editor at the selected point as HTML Code.

To start a new Comment in the Designer all we need is to set the cursor in the right place and choose from the menu Edit=>Comments Designer or press Ctrl+H

If you have a comment and you would like to edit, than set the cursor inside (between the brackets) and press Ctrl+H. In this case oq Editor will select the whole comment by it self and send it to the Designer.

when you finish press Alt+S or choose from the menu File=>sendAndClose. The Designer will build the HTML code with your comment between brackets and send back to oqEditor.

(This is a test comment);

Hint: If you use brackets or semicolons inside your comment than you have to set the backslash before every bracket and semicolon or you´ll get errors. Example:

(This is a \\(test\\) comment\\; for the right syntax);

If you are working in the Designer mode, the backslash wll be automatically generated in your code, so you don´t need to do any more changes

Easy Debugger

To control all of steps of the oq code for the right syntax we click on the green arrow or press F5 to debug it.

On the lower part of the editor we can see all steps one after another in a descending way

We close the debug window and reset it by clicking on the button “Reset” in the down left side of the editor