Creating an auto-generating menu for fluxbox

Fluxbox is one of the best wms for linux. If there's something that could replace any desktop, with low resources consumption, still being accessible and handy, than that's Fluxbox. The thing is when you install Fluxbox for the first time you feel something is lacking. That thing is the possibility of an auto-generating menu. Of course there's
fluxbox-generate_menu
and other likewise possibilities  but they kinda fail in doing what they should.   I'm a bit new to programming and even fresher when it comes to scripting in linux but I've though of a script that could do just that as it follows:
#!/bin/bash
while true
do
men="ArchSoft"
ver=$(grep "$men" ~/.fluxbox/menu | sed 's/.*(//; s/).*//' | tail -1)
if [ $men == $ver ]
then
data="$(date +%Y-%m-%d\ %k:%M)"
data2="$(grep "$data" /var/log/pacman.log | grep installed | sed "s/\[//g; s/\].*//g" | tail -1)"
if [ "$data" == "$data2" ]
then
nr="$(grep "$data" /var/log/pacman.log | grep installed | wc -l)"
int=$(seq 1 $nr)
for i in $int
do
ch=$(grep "$data" /var/log/pacman.log | grep installed | sed 's/.*installed//g; s/(.*//g; s/ //g' | head -$i | tail -1)
chr=$(grep "$ch" ~/.fluxbox/menu | sed 's/.*(//; s/).*//' | tail -1)
chb=$(ls /usr/bin | grep "$ch" | sed "s/.*$ch.*/$ch/" | tail -1)
la=$(ls /usr/share/icons/hicolor/48x48/apps | grep $ch | sed "s/.*$ch.*/$ch/"| tail -1)
lb=$(ls /usr/share/pixmaps | grep $ch | sed "s/.*$ch.*/$ch/" | tail -1)
if [ $ch == $chb ]
then
if [ $ch == $chr ]
then
echo "there's already a menu entry"
else
if [ $ch == $la ]
then
sed -i "/^\[submenu\] ($men)$/a[exec] ($ch) {$ch} </usr/share/icons/hicolor/48x48/apps/$ch.png>" ~/.fluxbox/menu
sleep 1
fluxbox restart
elif [ $ch == $lb ]
then
sed -i "/^\[submenu\] ($men)$/a[exec] ($ch) {$ch} </usr/share/pixmaps/$ch.png>" ~/.fluxbox/menu
sleep 1
fluxbox restart
fi
fi
fi
done
fi
rdata="$(grep "$data" /var/log/pacman.log | grep removed | sed "s/\[//g; s/\].*//g" | tail -1)"
if [ "$data" == "$rdata" ]
then
nrem="$(grep "$data" /var/log/pacman.log | grep removed | wc -l)"
inrem=$(seq 1 $nrem)
for i in $inrem
do
rem=$(grep "$data" /var/log/pacman.log | grep removed | sed 's/.*removed//g; s/(.*//g; s/ //g' | head -$i | tail -1)
remr=$(grep "$rem" ~/.fluxbox/menu | sed 's/.*(//; s/).*//' | tail -1)
if [ $rem == $remr ]
then
sed -i "/$rem/d" ~/.fluxbox/menu
sleep 1
fluxbox restart
else
echo "no menu entry to remove"
fi
done
fi
else
sed -i "/^\[begin\] (Fluxbox)$/a[submenu] ($men)\n[end]" ~/.fluxbox/menu
fi
clear
sleep 7
done
Explanation:
I've used
whilde true
do
sleep 7
done
to create an endless loop where "sleep" was used so it could take a break, therefore reducing hardware consumption
men="ArchSoft"
ver=$(grep "$men" ~/.fluxbox/menu | sed 's/.*(//; s/).*//' | tail -1)
if [ $men == $ver ]
then
else
sed -i "/^\[begin\] (Fluxbox)$/a[submenu] ($men)\n[end]" ~/.fluxbox/menu
fi
This checks if the submenu where everything should automatically be added as entries  are already there, if not it creates them under the beginning of fluxbox menu script with the name ArchSoft. 
data="$(date +%Y-%m-%d\ %k:%M)"
data2="$(grep "$data" /var/log/pacman.log | grep installed | sed "s/\[//g; s/\].*//g" | tail -1)"
if [ "$data" == "$data2" ]
then
fi
this compares the actual data from the system clock with the data of the installed apps shown in pacman .log and if it finds a similar data of the installed apps it procedes to further steps
nr="$(grep "$data" /var/log/pacman.log | grep installed | wc -l)"
int=$(seq 1 $nr)
for i in $int
do
ch=$(grep "$data" /var/log/pacman.log | grep installed | sed 's/.*installed//g; s/(.*//g; s/ //g' | head -$i | tail -1)
chr=$(grep "$ch" ~/.fluxbox/menu | sed 's/.*(//; s/).*//' | tail -1)
chb=$(ls /usr/bin | grep "$ch" | sed "s/.*$ch.*/$ch/" | tail -1)
la=$(ls /usr/share/icons/hicolor/48x48/apps | grep $ch | sed "s/.*$ch.*/$ch/"| tail -1)
lb=$(ls /usr/share/pixmaps | grep $ch | sed "s/.*$ch.*/$ch/" | tail -1)
if [ $ch == $chb ]
then
if [ $ch == $chr ]
then
echo "there's already a menu entry"
else
if [ $ch == $la ]
then
sed -i "/^\[submenu\] ($men)$/a[exec] ($ch) {$ch} </usr/share/icons/hicolor/48x48/apps/$ch.png>" ~/.fluxbox/menu
sleep 1
fluxbox restart
elif [ $ch == $lb ]
then
sed -i "/^\[submenu\] ($men)$/a[exec] ($ch) {$ch} </usr/share/pixmaps/$ch.png>" ~/.fluxbox/menu
sleep 1
fluxbox restart
fi
fi
fi
done
Here  because in pacman.log, the data of installed apps is shown in this manner YY-MM-DD hh:mm I had to consider using "for do", because in a minute a lot of applications can be installed using only a single "$pacman -S apps" command. Therefore I had to add somehow every app installed in a minute, separately to ~/fluxbox/menu. If the data of the installed apps in pacaman.log was show in this manner YY-MM-DD hh:mm:ss, therefore including seconds things would had been a lot more easier and precise, but I had to find a solution to that matter, and that solution was using "for do" .
Also here it checks if the installed program shows as an executable in /usr/bin and if it has an icon in  /usr/share/icons/hicolor/48x48/apps/ or in /usr/share/pixmaps/, and only than it procedes in adding an entry to fluxbox menu for that app. This was necessary because not all programs installed, that have executables in /usr/bin are meant to be displayed as a fluxbox menu entry. Checking for an icon being a filter and at the same time something kinda useful for the overall aspect of the menu.
rdata="$(grep "$data" /var/log/pacman.log | grep removed | sed "s/\[//g; s/\].*//g" | tail -1)"
if [ "$data" == "$rdata" ]
then
nrem="$(grep "$data" /var/log/pacman.log | grep removed | wc -l)"
inrem=$(seq 1 $nrem)
for i in $inrem
do
rem=$(grep "$data" /var/log/pacman.log | grep removed | sed 's/.*removed//g; s/(.*//g; s/ //g' | head -$i | tail -1)
remr=$(grep "$rem" ~/.fluxbox/menu | sed 's/.*(//; s/).*//' | tail -1)
if [ $rem == $remr ]
then
sed -i "/$rem/d" ~/.fluxbox/menu
sleep 1
fluxbox restart
else
echo "no menu entry to remove"
fi
done
fi
This part of the script removes the data from the menu entry pretty much in the same manner it was added, so I won't give further explanations.
The Trouble:
Most applications are added and removed just fine in the fluxbox menu entry, but some like chromium are added more than once and after pacman -R app they aren't removed. The script has still a lot of flaws, most of them because I'm new to scripting, but if someone can improve it or give suggestions it would be highly appreciated. Also if anybody that finds the script worthy enough, wants to develop it as his own I have nothing against it, just tell what changes and improvements you have brought as I wanna learn too.
Also my goal is to make a daemon out of it, any suggestions in this direction would be highly appreciated.
Thanks for your time and understanding, mostly thanks to those that helped me a bit in understanding the syntax, like  @Karol & @falconindy. You rule, 'cause  you make linux  seam like one big happy family
George
Last edited by I'mGeorge (2011-06-20 19:43:08)

This is an awesome idea. I've wanted to do something like this for a little while, though not in bash...
Since I'm not great in bash, I may make one in C (for learning) or Python (ditto) and comment on your implementation.
If I understand right, you're building a menu first, then deleting parts of it as you go. Would it not be smarter to create a function for adding entries and call it only after you've decided whether an app belongs in the menu? Something like this:
function add_to_menu() {
# echo whatever to the config file
if (app is on system && has an icon somewhere in /usr/share or /opt) {
add_to_menu(foo)
Personally, I would approach this by using a definition or grouping list (so you can make submenus) and organize your apps that way. I'd probably use an sqlite db or an ini file or some other way to store the heirarchy, then generate the menu. It looks like you've already put a lot of effort into this, though, so I wish you luck on it!

Similar Messages

  • How to Create a Auto Generated number with some preceding text in Sharepoint 2010

    I am trying to create a auto generated number field in Sharepoint 2010 list item. My requirement is to have the following format number generated when new request is created in Sharepoint using form. Auto generated Ticket ID should be in the following format
    "IR13000" "IR13001" "IR13002"....... Please let me know how to get this done. I tried to use combination of default ID and Characters but its not working for new requests, its only reflecting for existing uploaded requests. I
    am trying this for taking up Ticket requests by filling up some fields in the form. Any quick help is much appreciated.
    Thanx

    Here are the steps:
    1 - Open your SharePoint site in SP Designer 2010.
    2 - Click Workflows and add a List workflow. Associate this workflow on the list where you want the Random Text to be generated.
    3 - Inside the workflow editor, select the Action "Update list item"
    4 -  Select 'Current Item'.
    5 - Click Add.. and select the field which needs to be updated with the Random Text. Make sure this column is not of type "Calculated" type, otherwise you won't see it in the list of the fields within the workflow.
    6 - Click "..." button in the next textbox which will open String Builder dialog box.
    7 - Type IR and then click 'Add or Change Lookup and select ID column from "Field from source". Hit OK.
    8 - It should look like IR[%Current Item:ID%]
    9 - Hit OK.
    10 - Save and publish the workflow. (Please note that currently this workflow is not set to auto run on creating new items. That's because we want to test it at this point of time).
    11 - Go to your list in SharePoint and create a new item. After creating, select the item and click Workflows and then run this workflow.
    12 - You should be able to see the text "IR1" in the designated column.
    13 - Once you see that it's working, go to SPD and set the workflow to run automatically on creation of the new item. Save and publish and then return to your list in SharePoint.
    14 - Create a new item there and you should see the Random value in the column.
    15 - You will also see the column in the New form. In order to remove it, go to List settings > content types > Item content type > and select Hidden for this column so that it doesn't showup in any form.
    Try it and let me know how it goes.
    Thanks,
    Ashish

  • How can i create a drop down menu for set qty in my store?

    I'm wondering how i can create a drop down menu for the qty module that sits on the individual product page. My client sells in quantities of 6 packs. I currently have the minimum order at 6 but i would like to give consumers the option for 6,12,18...and so forth. I was told that it could be accomplished? Hopefully someone can help me.

    Hi Chris -
    Thank you for your reply! I had seen your article before, and just now again attempted to follow it, but I get stuck. There are two things that I'm confused by.
    First off, toward the top, referring to the initial button, you say to add this interaction:
    ON CLICK; Play Transition to comboBox: selected
    ON ROLL OUT; Play Transition to comboBox normal if comboBox is in over state
    ON ROLL OVER; Play Transition to comboBox over if comboBox is in normal
    However, I do not see these transition options. When I select the button, the only interactions I have are to Play transistion to state, Play action sequence, Go to URL, and two for videos. So that's the first roadblock for me.
    But, trying to get passed that, I went down to the portion of the article that refers to adding interaction to the dataset items. Again, I don't get it, as I see no way to add interaction to a dataset item. When I open my design-time data menu, I do see the items, and am able to rename each item, add additional rows, and change the shape of the datalist layout. However, I see no way to add an interaction to a dataset item. I must be missing a step ... Can you help with this?
    Again, thank you!
    Amy

  • Auto generate index for FK

    Where is option like 'auto generate index for FK' in DataModeler 4.0.3?

    You need to right-click on the Browser node for the Design and select Properties.
    In the Design Properties dialog you will find the Automatic Index Generation option for FKs on the Settings > DDL page.
    David

  • Auto-Generated Number For All Users

    We're on Lync Server 2013, running a front-end pool consisting of 3 front-end servers. Users are VoIP enabled. We're seeing some inconsistent behavior while right-clicking an user and selecting the "Call" option. Even though the respective target
    users don't have an "Other" phone number set in AD, the Lync client seems to be somehow auto-generating a normalized entry and presenting this as an "Other" entry in the contextual menu that allows calls. The entry always begins with +1
    (425). Strange enough, this is the prefix used in some sample normalization rules in a Microsoft article
    here.
    Even though Dial Plans - to my understanding - shouldn't alter this (they only apply normalization rules for manually dialed numbers only), I've searched through all the normalization rules but there's none that start with +1 (425). I've also tried running
    ABSConfig, yet this tool crashes systematically on multiple machines (the Lync servers have updates dating from less than 2 months ago).
    Also - there's no normalization .txt file created in the ABFiles in the Lync Share, as in
    this article. Taking a look in the local GalContacts.db file shows the regular phone numbers, but not this one - hinting that it's something the Lync client creates on the fly. Additionally, no Lync Address Book Web Query is visible in Fiddler when browsing
    through the users' phone numbers in the Lync client.
    Adding to the problem is that some users see the "Other" entries, while others don't - eg. user X right clicks user Z and sees a wrong "Other" entry, while user Y right clicks user Z and doesn't see any wrong entry containing "Other".
    First question is what could trigger this behavior in the client ? Secondly, has ABSConfig.exe become broken by a recent update ?

    According to the 2nd article - I've created an empty Company_Phone_Number_Normalization_Rules.txt file and placed it in the Lync file share, in order to avoid any suspicion that the built-in file might be used. I've updated the address book but unfortunately
    can't restart the FE services at this time. There's no still no change in the client.
    Yet - the problem here is the numbers shown aren't present in the files making up the Lync address book inside the local user's sip profile folder.

  • Auto-Generate mail for database performace reporting.

    Hello,
    i have many server to keep an eye on for maintenance but, now the number for it is growing day by day. Its difficult for me to keep a watch on each in detail. So I have an idea to implement.
    I want to make a script which will auto generate a mail from the server & send it to my email id with all the details of database. Basically performance related details.+
    Is it possible to do so ???? I know how to send a mail with attachment, the code i will use is given below.+
    please suggest me how can i attach my performance tuning queries  output & get those things in my mail on a daily basis......
    thanks in advance .....
    DECLARE
    v_From VARCHAR2(80) := '[email protected]';
    v_Recipient VARCHAR2(80) := '[email protected]';
    v_Subject VARCHAR2(80) := 'test subject';
    v_Mail_Host VARCHAR2(30) := 'mail.mycompany.com';
    v_Mail_Conn utl_smtp.Connection;
    crlf VARCHAR2(2) := chr(13)||chr(10);
    BEGIN
    v_Mail_Conn := utl_smtp.Open_Connection(v_Mail_Host, 25);
    utl_smtp.Helo(v_Mail_Conn, v_Mail_Host);
    utl_smtp.Mail(v_Mail_Conn, v_From);
    utl_smtp.Rcpt(v_Mail_Conn, v_Recipient);
    utl_smtp.Data(v_Mail_Conn,
    'Date: ' || to_char(sysdate, 'Dy, DD Mon YYYY hh24:mi:ss') || crlf ||
    'From: ' || v_From || crlf ||
    'Subject: '|| v_Subject || crlf ||
    'To: ' || v_Recipient || crlf ||
    'MIME-Version: 1.0'|| crlf ||     -- Use MIME mail standard
    'Content-Type: multipart/mixed;'|| crlf ||
    ' boundary="-----SECBOUND"'|| crlf ||
    crlf ||
    '-------SECBOUND'|| crlf ||
    'Content-Type: text/plain;'|| crlf ||
    'Content-Transfer_Encoding: 7bit'|| crlf ||
    crlf ||
    'some message text'|| crlf ||     -- Message body
    'more message text'|| crlf ||
    crlf ||
    '-------SECBOUND'|| crlf ||
    'Content-Type: text/plain;'|| crlf ||
    ' name="excel.csv"'|| crlf ||
    'Content-Transfer_Encoding: 8bit'|| crlf ||
    'Content-Disposition: attachment;'|| crlf ||
    ' filename="excel.csv"'|| crlf ||
    crlf ||
    'CSV,file,attachement'|| crlf ||     -- Content of attachment
    crlf ||
    '-------SECBOUND--'               -- End MIME mail
    utl_smtp.Quit(v_mail_conn);
    EXCEPTION
    WHEN utl_smtp.Transient_Error OR utl_smtp.Permanent_Error then
    raise_application_error(-20000, 'Unable to send mail: '||sqlerrm);
    END;
    /

    I like your script idea.
    You can spool output to a file and mail the file to yourself.
    What OS are you running?
    On linux a simple starter script would look like this:
    #!/bin/bash
    echo `date`
    # Set the Environmental variable for TESTDB instance
    . /u01/app/oracle/dba_tool/env/TESTDB.env
    $ORACLE_HOME/bin/sqlplus -s system/<PASSWORD> <<EOF
    @/u01/app/oracle/dba_tool/TESTDB/quickaudit
    EOF
    echo `date`
    mailx -s "Check database on TESTDB" [email protected] < /tmp/quickaudit.lst
    ----------------------sample ENV file--------------------------------------
    ORACLE_BASE=/u01/app/oracle
    ULIMIT=unlimited
    ORACLE_SID=TESTDB
    export ORACLE_TERM=xterm
    ORACLE_HOME=$ORACLE_BASE/product/11.2.0
    ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
    LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
    LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
    LIBPATH=$LD_LIBRARY_PATH:/usr/lib
    TNS_ADMIN=$ORACLE_HOME/network/admin
    PATH=$ORACLE_HOME/bin:$ORACLE_BASE/dba_tool/bin:/bin:/usr/bin:/usr/ccs/bin:/etc:/usr/sbin:/usr/ucb:$HOME/bin:/usr/bin/X11:/sbin:/usr/lbin:/GNU/bin/make:/u01/app/oracle/dba_tool/bin:/home/oracle/utils/SCRIPTS:/usr/local/bin:
    export ORACLE_BASE ORACLE_SID ORACLE_TERM ULIMIT
    export ORACLE_HOME
    export LIBPATH LD_LIBRARY_PATH ORA_NLS33
    export TNS_ADMIN
    export PATH
    --------------------Starter reporting script--------------------------------------------------
    SET ECHO OFF
    SET TERMOUT OFF
    REM Revisions:
    REM Date ID Version Description
    REM -------- -- ------- ----------------------------------------------------|
    REM 10/07/05 1.0 Script to check for database issues
    SPOOL /tmp/quickaudit.lst
    SELECT SYSDATE FROM DUAL;
    SHOW USER
    SET TERMOUT ON
    SET VERIFY OFF
    SET FEEDBACK ON
    PROMPT
    PROMPT Checking database name and archive mode
    PROMPT
    column NAME format A9
    column LOG_MODE format A12
    SELECT NAME,CREATED, LOG_MODE FROM V$DATABASE;
    PROMPT
    PROMPT ------------------------------------------------------------------------|
    PROMPT
    PROMPT
    PROMPT Checking database versions
    PROMPT
    column BANNER format A64
    select * from v$version;
    PROMPT
    PROMPT ------------------------------------------------------------------------|
    PROMPT
    PROMPT
    PROMPT Checking control file(s)
    PROMPT
    column STATUS format a7
    column NAME format a68
    column IS_RECOVERY_DEST_FILE format a3
    set linesize 110
    SELECT * FROM V$CONTROLFILE;
    PROMPT
    PROMPT ------------------------------------------------------------------------|
    PROMPT
    PROMPT
    PROMPT Checking redo logs and group(s)
    PROMPT
    column member format a70
    set linesize 110
    set pagesize 30
    SELECT group#, member FROM v$logfile;
    PROMPT
    PROMPT -----------------------------------------------------------------------|
    PROMPT
    PROMPT
    PROMPT ------------------------------------------------------------------------|
    PROMPT
    PROMPT
    PROMPT Checking freespace by tablespace
    PROMPT
    column dummy noprint
    column pct_used format 999.9 heading "%|Used"
    column name format a16 heading "Tablespace Name"
    column bytes format 9,999,999,999,999 heading "Total Bytes"
    column used format 99,999,999,999 heading "Used"
    column free format 999,999,999,999 heading "Free"
    break on report
    compute sum of bytes on report
    compute sum of free on report
    compute sum of used on report
    set termout off
    set pagesize 40
    select a.tablespace_name name,
    b.tablespace_name dummy,
    sum(b.bytes)/count( distinct a.file_id||'.'||a.block_id ) bytes,
    sum(b.bytes)/count( distinct a.file_id||'.'||a.block_id ) -
    sum(a.bytes)/count( distinct b.file_id ) used,
    sum(a.bytes)/count( distinct b.file_id ) free,
    100 * ( (sum(b.bytes)/count( distinct a.file_id||'.'||a.block_id )) -
    (sum(a.bytes)/count( distinct b.file_id ) )) /
    (sum(b.bytes)/count( distinct a.file_id||'.'||a.block_id )) pct_used
    from sys.dba_free_space a, sys.dba_data_files b
    where a.tablespace_name = b.tablespace_name
    group by a.tablespace_name, b.tablespace_name;
    PROMPT
    PROMPT ------------------------------------------------------------------------|
    PROMPT
    PROMPT
    PROMPT Checking for invalid objects
    PROMPT

  • Need to auto-generate SDK for REST web service.

    My company has developed a REST API for some web services, and we'd like to provide users with a Java SDK for consuming those services.
    Our services are described by an XSD schema. On the backend, we are using JAXB to create Java classes corresponding to the schema. We create the request objects based on the parameters in the REST url, and JAXB converts our response objects from Java to XML.
    We'd like to provide our users with similar Java classes on the client side. They should be able to create the object corresponding to the request, fill in various parameters, and submit it to our web service. The SDK should automatically convert the object into a REST URL, hit the URL with a Get, read the XML response, and convert that response into Java objects.
    It seems like we should be able to auto-generate such an SDK based on our schema.
    It seems like there are several tools for doing this for SOAP web services. For example, Apache Axis has Java2WSDL and WSDL2Java.
    Can anyone recommend tools for creating client-side libraries for consuming RESTful web services? Does anyone have advice on products to avoid?

    Replying to my own post here. The WADL2Java project on java.dev seems to be more like what I need. The only user-experience I've seen on the 'net is in this forum post:
    http://forum.java.sun.com/thread.jspa?threadID=5239123&tstart=0
    Anyone else used it?

  • How do i create a drop down menu for selecting from the drop down arrow

    how can i create a drop down menu so that when i click on the arrow in the cell i can select from the menu that appears

    katiesandell wrote:
    how can i create a drop down menu so that when i click on the arrow in the cell i can select from the menu that appears
    Hi Katie,
    Welcome to Apple Discussions and the Numbers '09 forum.
    Numbers vocabulary for this feature is a "Pop-up Menu". It's available as a Cell Format, and is set and edited in the Cell Format Inspector.
    See "Using a Checkbox, Slider, Stepper, or Pop-Up Menu in Table Cells" starting on page 96 of the Numbers '09 User Guide.
    This guide, and the equally useful iWork Formulas and Functions User Guide are available for download through the Help menu in Numbers.
    Regards,
    Barry

  • How to create a Pop-up menu for an Applet

    I need to create a Pop-up menu that works like this:
    When the user move his mouse over the applet, the menu will pop up, extending beyond the bounds of the applet.
    In other words: The applet will display only the menu headings - a mouse-over should cascade a menu beneath the heading - once again: beyond the bounds of the applet.
    (Hopefully, the end result will look and work pretty much like a DHTML menu that uses <div>'s.)
    I thought of popping up a JFrame to act as the menu - however, the JFrame has its own title bar.
    Any ideas!?

    OK - I tried using a JMenuBar - and it does cascade out of the Applet box. The question is:
    How do I close the menu without clicking on the Applet box? - i.e. if the user clicks on the web-page, or simply waits a second or 2, the menu should collapse?
    Any ideas?

  • Creat Sequence / Auto generate No

    I created a from with master and detail block
    In master block I assigned a field (FRNO) autogenerated
    written the following code in pre-insert.
    declare
              v_sr number(4):=0;
         begin
              select max(frno) into v_sr from fabric_rec ;
              if v_sr is not null or v_sr<>0 then
                   :fabric_rec.frno:=v_sr+1;
              else
                   :fabric_rec.frno:=1;     
              end if;
         exception
              when no_data_found then
              :fabric_rec.frno:=1;
         end;
    it is working successfully.
    I want to also create autogenerate no in detail block
    first it check table, find Max NO then increament with it,
    if I use above code that is not working becauase when I enter first record in frist row it will fetch Max record+1 and when I will go on 2nd row if will fetch same although I need
    in first row Max+1
    and row wise increament and save in database
    Message was edited by:
    Kami

    Dear Uzair AOA
    Your code is OK. but not for my situation.
    I am using master and detail block. master in form and detial in tabular.
    in MAster block it is working proerply, but in detail block It can not. I want that check the max no from detail block and add+1 with the row, if I inserted in detail 5 row that will generate recored accrodingly.
    like. max(srno) = 5
    I inserted 5 more record in detail
    then replace with 6,7,8,9,10 like that.
    see my following code.
    I used the following code in detail block when create record
    declare
              v_sr number(4):=0;
         begin
              select max(ojobno) into v_sr from sub_fabric_rec ;
                                  if v_sr is not null or v_sr<>0 then
                   :sub_fabric_rec.ojobno:= v_sr + :SYSTEM.cursor_record;     
                        else
              :sub_fabric_rec.ojobno:=1;     
              end if;
         exception
              when no_data_found then
              :sub_fabric_rec.ojobno:=1;
         end;
    it is working but if I inserted 5 record in detail block first 2 rows Auto No are same??
    and after 2nd row other reocords working accrodingly.
    like
    16
    16
    17
    18
    19
    20 etc

  • Ability to create a dvd menu (for wedding) with "start" function?

    hi there
    i hope you can help.
    i urgently need to create some a dvd menu for a wedding. i have the picture and i wanted some kind of effect and the options to have a 'start' option...so it plays when the user presses 'start' .. is this possible to do in elements.
    i am going to have main wedding video file in a .mov file...and i wanted to to add an intro at the beginning of the video..
    can you please help? this is really stressing me out..

    Travis,
    The navigational functions in PrE's DVD-Video authoring module are very limited.
    Pretty much, one can choose a Menu Set (both a Main Menu and a Scene Selection Menu), and then with the addition of a Menu Marker, and Scene Markers, let PrE create the linear navigation. One can modify many Menu Sets, but only to a limited level.
    For more intricate navigation, I strongly recommend another program, just for the authoring. Many users sing the praises of Sony's DVD Architect, which has a much better feature-set, than does PrE. I use Adobe Encore, but it is ONLY available with PrPro, and not as a stand-alone any more.
    Steve Grisetti, our MOD here, has written a great book on DVD Architect, in the Muvipix.com series, and if you do go with that program, I highly recommend his book.
    Good luck,
    Hunt

  • Numbers-Auto Generating a numbered list in a column of cells

    Having trouble creating an auto-generating numbered list in a single column. In text inspector I choose bullets>numbers>start at 1. The first cell is filled in with a "1", but when I hit return or down arrow the 1 disappears. If I go back and type a "1" again, two "1's" appear in the same cell. I'm trying to make a table with 250 rows. Not sure what I'm missing, as I'm new to iWork.

    Numbers can fill a column or row of cells with a pattern. Type the first two numbers in the first two cells, select both cells, then click on the small circle at the lower right of the second cells & drag down to fill however many cells you want. You can see in this picture that it works for other patterns, not just consecutive numbers. I've also used it to fill across month names or dates.

  • Auto generated types and ps1xml formatting files

    Hello,
    I'm using New-WebServiceProxy to work with a web service... when I call methods of the web service powershell auto generates types, for example, things like "Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes.WebServiceProxy1_webservices_awebservicepage_asmx.TheMethodReturnObjectType"
    1. should I just use that type name in my ps1xml formatting file? I'm wondering if that will be fragile... seems fragile like 'webServiceProxy1' for example, what if there is some scenario it uses '2'? Not sure if I can count on that being consistent?
    2. I started creating custom objects and adding my own type name to them so that type name could be used in the ps1xml file. This works fine. However so far it was for web service methods that returned single instance results.. now I hit a point where I'm
    calling a web service method that will return a collection... so I'm wondering if it would be better to just use the auto generated type name  in the ps1xml or, as I would need to do in this case, actually enter a foreach loop to create a new custom object
    for every object in the returned collection? In other words, for the web service methods I've used so far for this, I simply created my custom object and write-output... for the case of the collection, I would be new-object'ing and write-output'ing within
    that foreach loop.. wondering about performance issues, or if it's just overkill when I could just put that auto generated type name in the ps1xml file and be done with it... 
    not sure if I've asked that very clearly...
    essentially, I'm wondering if it's overkill (from a resource usage perspective) to be creating these custom objects in the case of when there will be a collection, with potentially hundreds of items, when the only reason I'm doing it is for display purposes...
    if it were not an autogenerated type I would simply use the type name in the ps1xml, I'm just not sure if I can do that in this case as I don't know if that typename will *always* be the same?
    any input would be appreciated, thanks

    Hi DJC,
    I haven't rexperienced this, however, to create a .ps1xml file, these examples may be helpful for you:
    Creating a module for powershell with a format file
    discutils / utils / DiscUtils.PowerShell / DiscUtils.Format.ps1xml
    about_Format.ps1xml
    I hope this helps.

  • Auto generated selection screen in Modulepool program

    Hi Experts!!
    How to develop/Desing auto-generated screen for accepting values from the user as criteria for database selections while running a report.
    pls. guide me.
    Thanks in advance

    Use this - two FMS-
    here is the code -
    FORM extended_selection.
      DATA : t_dyn    LIKE rsdsfields OCCURS 0 WITH HEADER LINE.
    *Work Areas.
      DATA : wa_range  TYPE LINE OF rsds_trange,
             wa_ranget TYPE rsds_frange_t,
             wa_line   TYPE LINE OF rsds_frange_t,
             t_selopt  TYPE rsds_selopt_t.
    *Fields to be Put on the dynamic selection screen
      t_dyn-tablename = 'KNA1'.
      t_dyn-fieldname = 'KUNNR'.
      APPEND t_dyn.
      CLEAR  t_dyn.
      t_dyn-tablename = 'CEPC'.
      t_dyn-fieldname = 'PRCTR'.
      APPEND t_dyn.
      CLEAR  t_dyn.
      IF ( ( g_sel IS INITIAL ) OR ( t_ranges[] IS INITIAL ) ).
    *Initialize Free Selection Mode.
        CALL FUNCTION 'FREE_SELECTIONS_INIT'
             EXPORTING
                  kind                     = 'F'
             IMPORTING
                  selection_id             = g_sel
             TABLES
                  fields_tab               = t_dyn
             EXCEPTIONS
                  fields_incomplete        = 1
                  fields_no_join           = 2
                  field_not_found          = 3
                  no_tables                = 4
                  table_not_found          = 5
                  expression_not_supported = 6
                  incorrect_expression     = 7
                  illegal_kind             = 8
                  area_not_found           = 9
                  inconsistent_area        = 10
                  kind_f_no_fields_left    = 11
                  kind_f_no_fields         = 12
                  too_many_fields          = 13
                  dup_field                = 14
                  field_no_type            = 15
                  field_ill_type           = 16
                  dup_event_field          = 17
                  node_not_in_ldb          = 18
                  area_no_field            = 19
                  OTHERS                   = 20.
        IF sy-subrc NE 0.
          MESSAGE e717(db).
        ENDIF.
      ENDIF.
    *Dialog for Selection.
      REFRESH t_ranges.
      CALL FUNCTION 'FREE_SELECTIONS_DIALOG'
           EXPORTING
                selection_id    = g_sel
                title           = 'Extended Selection'(s12)
                as_window       = true
                start_row       = 5
                start_col       = 20
                tree_visible    = space
           IMPORTING
                field_ranges    = t_ranges
           TABLES
                fields_tab      = t_dyn
           EXCEPTIONS
                internal_error  = 1
                no_action       = 2
                selid_not_found = 3
                illegal_status  = 4
                OTHERS          = 5.
      IF sy-subrc NE 0.
        CHECK sy-subrc NE 2.
        MESSAGE e717(db).
      ENDIF.
    This will create a dynamic selection screen for you. For more information u can refer to the documentations of those function mdoules.
    Hope it solves ur prob.

  • Auto generate team matches

    Hi,
    I need to auto generate matches for football teams where the each football team is matched up with another to play a game.
    Each team places another team twice.
    So Match set 1 and Match Set 2
    Match set one is at "home" and Match set two is "away"
    I am not sure how to get this done so it will hold the information on the matches.

    Ok,
    I have this, but it only outputs 1 teams twice.
    $query_match_fixtures = "select m.match_id, m.date, m.time, m.report, t1.team_name, s1.score, t2.team_name, s2.score from matches m left join (matchscores s1 left join team t1 on t1.team_id = s1.team) on (s1.match_id = m.match_id) left join (matchscores s2 left join team t2 on t2.team_id = s2.team) on (s2.match_id = m.match_id) where s1.team <> s2.team group by match_id order by m.match_id";
    -- Table structure for table `matches`
    CREATE TABLE IF NOT EXISTS `matches` (
      `match_id` int(8) NOT NULL auto_increment,
      `date` date default NULL,
      `time` varchar(5) default NULL,
      `report` longtext,
      `referee_id` int(8) NOT NULL,
      `season_id` int(8) NOT NULL,
      `venue_id` int(8) NOT NULL,
      PRIMARY KEY  (`match_id`),
      KEY `referee_id` (`referee_id`),
      KEY `venue_id` (`venue_id`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=15 ;
    -- Table structure for table `matchscores`
    CREATE TABLE IF NOT EXISTS `matchscores` (
      `matchscores_id` int(8) NOT NULL auto_increment,
      `match_id` int(8) NOT NULL,
      `team` int(8) NOT NULL,
      `score` int(8) default NULL,
      PRIMARY KEY  (`matchscores_id`),
      KEY `match_id` (`match_id`,`team`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=27 ;

Maybe you are looking for

  • Adusting video input signal while capturing???

    Hello I'm running Final Cut HD and am having trouble adjusting my video input signal. Under "Clip Settings" in the Capture Tool there appear to be controls, but they are disabled and my scopes do not appear to be reading either. Any thoughts on how t

  • Hooking up mail client with Gmail

    I have a feeling that something is amiss in the way my machine is configured, but I've become frustrated because I can't find instructions to setup Apple Mail 1.3.11 (only Mail 3 is illustrated at the Google site). There are a lot of generalities giv

  • Error when doing material transfer

    hi expert, when doing material transfer from plant 0001 to plant 0002, error pops up : "maintain vendor for the customer 1234 attached to supplying plant 1234".. what should i do?? thanks

  • Run time error in all standard reports

    Hi Gurus I got a run time error in all standard reports and error as below. Unable to fulfil request for 8296200 bytes of storage space.                                                                                What happened?                    

  • Clips not working in one event.

    Hi, I have one event that doesn't work properly. When I movie through the clips the video is fine but there is no audio coming out. When I try to drag a clip into the project it doesn't show at all and the preview window shows gray. I did delete the