[CS3 JS] How to Create a Timer?

Within InDesign I need to be able to fire a periodic process to examine links from a JavaScript script. I have my own script running in its own engine.
I can't figure out how to create a timer that will run in the background and call the appropriate callback function periodically.
I've created a little process like this:
* Sleeps for waitTime milliseconds then calls the callBack function.
function timer(callBack, waitTime) {
$.writeln("timer(): callBack=" + callBack + ", waitTime=" + waitTime);
if (waitTime == undefined) waitTime = 2000;
$.writeln("timer(): sleeping for " + waitTime + "...");
$.sleep(waitTime);
$.writeln("timer(): awake, calling callBack");
try {
return callBack();
} catch (e) {
$.writeln("timer(): Exception from callBack.exec(): " + e);
return undefined;
function myCallBack() {
return Window.confirm("Callback called", true, "Continue looping");
while (true) {
if (!timer(myCallBack)) break;
And this works in the sense that my timer runs, but it runs as a blocking process, which is not what I want.
Is there something I'm missing or is this simply not possible in CS3 JavaScript? A search on "timer" in the InDesign forums didn't reveal anything, nor did the InDesign JavaScript Guide nor the Scripting Tools Guide.
Thanks,
Eliot

1. Download and install Active Page Item Developer Toolkit.
http://www.rorohiko.com/wordpress/indesign-downloads/active-page-item-developer/
You'll have a demo period for 20 days or a month, I don't remember exactly.
2. Create a new document, open 'Active Page Item Developer' panel (Windows menu).
3. Copy the script from my previous post, draw an object - e.g. a rectangle and with the object selected enter 'idle' into Event Filter field, then press Tab and paste the script into the largest field.
You'll see an alert appearing every 10 seconds and the cursor flickering.

Similar Messages

  • How to create a Time Dimension

    Hi
    This is regarding a new topic which i could not find the answer in this forum.
    Actually i want to create a time dimension to populate my source data which is in date/time format.
    can anyone please reply back reagrding how to create a time dimension in ODI???
    regards
    Gourisankar

    Hi Gourisankar,
    I am not aware of time dimension. But when i searched in metalink i got the below note. I am not sure whether it will help you or not but still a small contribution. :)
    The note as follows,
    To create new time dimensions, run the following SQL instructions :
    * Example to generate a calendar between 1999-01-01 and 2007-12-31 one row per day
    SELECT to_date('1999-01-01','YYYY-MM-DD')+rownum
    FROM DUAL
    CONNECT BY
    ROWNUM<=to_date('2007-12-31','YYYY-MM-DD')-to_date('1999-01-01','YYYY- MM-DD');
    * Example for generating a calendar random number
    SELECT DBMS_RANDOM.VALUE
    FROM DUAL
    CONNECT BY ROWNUM<=1000000;
    May be you can create a VIEW out of this query ,reverse it and use that as a source in your interface.
    Try this and let me know.
    Thanks,
    G
    Edited by: Gurusank on Dec 22, 2008 4:19 PM

  • How to create countdown timer with sound

    Any ideas on how to create a minute and seconds countdown timer that would play a sound and then redirect you to another page?

    Hi,
    There is no out of the box solution to do so in Muse at the moment. If you can get your own code, you can add it to your site using "Insert HTML" feature.
    Regards,
    Aish

  • How to create automatic timer process in BPM?

    Can anyone tell me how to create an automatic timer process in BPM?
    Can I just create an manual process, and drag the timer event into the swam lane, can connect the timer to the service and then to the end event?
    Thank you

    Hi,
    You can make use of Global Automatic activity to kick off your process at a particular time. Place a Global Automatic activity in your process and right click on the Global Automatic activity and select Properties --> General --> Global Automatic Type: Automatic Schedule, Automatic Schedule: <Configure with your requirement>.
    Else you can make use of due transition/timer activity to get your task done.
    Bibhu

  • How to create real time chart with candle stick for displaying Open, High, Close, Low values from BSE/NSE EOD data

    Please help with sample windows form C#.Net Example

    Hi Goutam,
    Please refer to the following link with examples: http://www.codeproject.com/Questions/234865/create-real-time-chart
    Hope this helps you!
    Regards,
    Mitch!

  • How to create a time counter without using Sleep()?

    I want to create a time counter that would count from 120 minutes and down. I thought about using Sleep() but I have found out that Sleep() is not accurate (so maybe the countdown would take 122 minutes instead of 120 minutes!). What other alternatives do
    I have?
    Note that I want to count 1 second at a time, because I want to show the countdown progress to the user in seconds.

    The next experiment still uses Sleep and waits for approximately 12 seconds, displaying the time each second. However it is probably too overcomplicated compared to time polling:
    const
    int SECONDS_TO_WAIT =
    12;
    ULARGE_INTEGER ul_end;
    FILETIME ft;
    GetSystemTimeAsFileTime( &ft );
    ul_end.LowPart = ft.dwLowDateTime;
    ul_end.HighPart = ft.dwHighDateTime;
    ul_end.QuadPart += 10LL *
    1000 *
    1000 * SECONDS_TO_WAIT;
    for( ;; )
    FILETIME ft;
    GetSystemTimeAsFileTime( &ft );
    ULARGE_INTEGER ul;
    ul.LowPart = ft.dwLowDateTime;
    ul.HighPart = ft.dwHighDateTime;
    if( ul.QuadPart >= ul_end.QuadPart )
    break;
    SYSTEMTIME st;
    FileTimeToSystemTime( &ft, &st );
    Sleep( 1000 - st.wMilliseconds );
    GetSystemTime( &st );
    if( st.wMilliseconds >
    500 )
    FILETIME ft;
    SystemTimeToFileTime( &st, &ft );
    ULARGE_INTEGER ul;
    ul.LowPart = ft.dwLowDateTime;
    ul.HighPart = ft.dwHighDateTime;
    ul.QuadPart += 10LL *
    1000 *
    1000;
    ft.dwLowDateTime = ul.LowPart;
    ft.dwHighDateTime = ul.HighPart;
    FileTimeToSystemTime( &ft, &st );
    // show the time
    SystemTimeToTzSpecificLocalTime( NULL, &st, &st );
    printf( "%02i:%02i:%02i\n", st.wHour, st.wMinute, st.wSecond

  • How to create a time counter

    Hello expertsl,
    I have a new challenge on board.
    I have a form that is automatically popped up. Now on the form, i need to insert a timer that as soon as it pops out, the timer starts and then i have to enter some data in the form and as soon as i press the save button, the timer records the time count and then stores it in a table.
    Any suggestion are the most welcome...
    Thank you

    As Hoek said, this is not a Forms forum.
    However, the problem is not really unique to Forms and a timer itself is not needed.
    A timer is a kernel object that fires at specific intervals and each time around executes a callback routine. This allows one to update or process at specific intervals.
    You do not need a timer as you are interested in time elapsed - which means that on the creation of the form you need to get the current time. When the save button is clicked you again get the current time. The data that you are interested in is the time difference between these two.
    Remember that timers are expensive objects to create ito kernel resources. Some operating systems limit the total number of timers that can be created. In general, it is not a good idea to create a timer unless it is the best technical solution for the problem. And you do not need a timer determine a time elapse. You simply need code in the constructor of the form and code in the save events of the form. Nothing more.

  • How to create a time event without having user interface freeze

    Hi,
    I am new to labwindows and i am trying to create a time event where every hour for 24 hours i want my program to write somethign in excel. 
    I tried using function Delay and SyncWait and those functions freezes up the user interface.
    Any tips/help will be appreciated.
    Thank You
    Solved!
    Go to Solution.

    Many, if not most, CVI developers wind up implementing a delay function for themselves that periodically, during the delay, wakes up and processes events so that the GUI isn't frozen.
    The idea is to break the wait or delay up into pieces, and process system events in between each piece.
    A timer works too, you can try the async timer that Wolfgang mentioned, it runs a bit better and on a separate thread, so it lets you do what you normally would with the main thread and the GUI, yet still get timer function.   If you use a smart delay, you still wind up doing nothing a great deal of the time, and events are only processed periodically.

  • How to create a timer in forms with out using pjc

    Any body help me rgarding this matter..
    plez..

    That i know but how i assign this timer in an objects..like text bos or dispplay item????

  • How to create sharepoint timer job, which will run at farm level

    Hi ,
    I want to create SharePoint timer job which will access all site collections list from farm and give count of list items of each list and trigger email if count exceeded 4000 items.
    Thanks,
    Ganesh Pawar

    try these links:
    https://social.msdn.microsoft.com/Forums/en-US/75ccf7c0-13b2-4330-aaf2-355f107026a1/rest-services-error-are-a-specific-list?forum=sharepointcustomizationprevious
    https://social.msdn.microsoft.com/Forums/en-US/75ccf7c0-13b2-4330-aaf2-355f107026a1/rest-services-error-are-a-specific-list?forum=sharepointcustomizationprevious
    https://social.msdn.microsoft.com/Forums/en-US/75ccf7c0-13b2-4330-aaf2-355f107026a1/rest-services-error-are-a-specific-list?forum=sharepointcustomizationprevious
    https://social.msdn.microsoft.com/Forums/en-US/75ccf7c0-13b2-4330-aaf2-355f107026a1/rest-services-error-are-a-specific-list?forum=sharepointcustomizationprevious
    Please mark as answer if you find it useful else vote for it if it is close to answer..happy sharepointing

  • [CS3 JS] How To Create Hyperlinks In InCopy?

    I have a client that wants to be able to author hyperlinks in InCopy, both links to named targets as well as links to URLs.
    It appears that the InCopy scripting object model does not include the hyperlink-related objects from the InDesign model, even those those objects can be found in an INCX document if a link is created within an InCopy article within InDesign.
    I'm trying to figure out what the best/quickest solution is given that I can't do it using scripting. I have already implemented a hyperlink creation dialog that emulates the InDesign New Hyperlink dialog.
    Unfortunately, I cannot assume or require that the InCopy users have InDesign installed. If I did I could just create a temporary InDesign doc that linked the InCopy article, create the link there, then save and update the InCopy article.
    Given that, I'm not sure how best to go about this.
    The ideas I've come up with so far are:
    1. Don't create real hyperlinks but use Note objects to capture the hyperlink source and target information. This would satisfy the client's requirement to be able to transform the links on conversion of the InCopy data to XML but wouldn't result in working InDesign hyperlinks.
    2. Modify the INCX document directly to add the appropriate hyperlink objects then reload it as part of the hyperlink creation process. Ugly but should work.
    3. Use XML markup in InCopy to represent the hyperlinks. I don't like this as much as the Note option because it's less obvious to authors what's going on and is easier for authors to mess up accidentally when they are editing.
    4. Implement a full-on InCopy plugin. This is really beyond my current capabilities and the scope of the project.
    5. Log a bug against InCopy to request that the hyperlink objects be added to the API. (Probably not going to give me a result in the time I need, even if it's an appropriate thing to do.)
    6. ???
    Is there some trick or back-door mechanism I've missed that I can use through InCopy scripting?
    Thanks,
    Eliot Kimber
    Really Strategies, Inc.

    I did this from the advanced menu to make all hyperlinks work. All I got were boxes around my links that are not clikcable to the web page.
    Now I cannot undo this.

  • How to create Union Time Pool using accruals ???

    Hi,
    My client has a unique requirement of creating a Union Time Pool i.e. at the begining of each year the client will have 'X' amount of hours assigned to the pool. Employees under Union Contract will then be eligible to take any leave hours from that time pool as long as they are approved by there supervisor. Now, if we create an element pertaining to the special leave based on Time Pool, then an entry can be made at timecard level and the number of hours remaining can be determined.
    But, this pool is not employee based hence the Hours remaining calculation for the Time Pool is irrespective of any assignment rather its organization/GRE based. How do we implement this using Accruals?
    The client wants to view the balances in the Time Pool within the system. How can that be achieved?
    I understand Accruals Caculation and balances is totally assignment based, how can that be made for GRE/Organization based?
    Any help or suggestions will be highly appreciated.
    Thanks,
    Ujjal

    Hi,
    This is a really interesting scenario.. what are you trying to do
    1. Find a place where the common pool details can be entered at the start of the year
    2. The accrual process should deduct from this pool
    3. On accrual balance for the union should be displayed.
    let us evaluate what are things that cannot be used
    1. Elements can be initialized as the leave pool is for a group of people whereas elements are for an assignment
    2. Balances cannot be used for same reason
    so what are the options that we have..
    1. Store the pool in a lookup that can be created based on a bg or gre (use dff) and use the date fields of the lookup to simulate date track feature in HRMS. This way you would be able to enter values for every year for every bg / gre. Also enable another dff segment to store the balance leave in the pool. This field can be hidden.
    2. You can refer lookup in the accrual rules and evaluate the pool for processing the leave
    3. Customize the form / page to display the remaining pool from based on the person's detail and the lookup. This customization could be complicated instead you can maintain a dff in person/ asg table and write a custom process that will populate the pool balance for all people.
    This one of the suggestion I can give you.. there could be other options that you can evaluate.. but its not going to be simple..
    I hope this helps you.
    Regards,
    Vikash

  • How to create a time table by Automator

    I want to create a new calendar by using Automator. It is a time table.
    In the time table, there are Day 1 - Day 6.
    For example,
    https://files.me.com/lawhei/442uc1
    so on.
    It starts from 1/9/2010 and end on 1/7/2011.
    h represent holiday, no event needs to be created. The date of holiday is provided by the school.
    The problem that I am facing now is I can filter out the holiday but I don't know how to pass the dates to next action. The provided iCal actions are suck. How can I write my own action? Or do you guys have any suggestions for me to create such calendar?

    I just want to check I understand your issue.
    You have 1 WebI document which has 2 objects on it. One is a table and the other is a graph of the same values.
    You are linking to the graph using openDocument. However, you want to pass values from tableA (selected row values) into the graph.
    Is this correct?
    Regards
    Alan

  • How to create one time pop-up window?

    I'd like to have a pop-up window called "how to use this app" show up just one time; the first time a user opens the folio to read it for instruction but then not appear again after it is closed. How could I do this? Thanks.

    I have not tried the "alert-box technique" yet.
    I have found code that will only display for first time visitors. How would I add an image to the below code with a link to a website?
    newwin=open("yourpage.htm", "dispwin",
    "width=350,height=350,scrollbars=no,menubar=no");

  • How to create a time column

    hi all
    i have a table to define the users
    i want to add a new two columns that define the time which the user can login in that time defined in the table of the user
    and every time the user login , it will check the login time with the time interval defined in the user table
    what are the data types of the 2 columns interval_from and interval_to
    or
    how can i implement that without a trigger on the database

    What Forms version are you using? If you are using Forms 10g you will need to set your Forms item datatype to "DATETIME" otherwise the Format Mask magoo suggests will only show zeros (0) for the time. If you are using Forms 6i, then just the format mask is needed. If you are using Forms 9i, I suggest you check if Forms 9i supports the DATETIME data type (it has been too long since I've used 9i and I don't have it installed where I could check).
    Hope this helps.
    Craig...
    If my response or the response of another was helpful, please mark it accordingly

Maybe you are looking for

  • Satellite A110: Graphic card is only at 64MB after traditional 1.70 Bios update

    Hi!! I have toshiba satellite A110. I've upgraded my bios to 1.70 version but now my video card is only at 64MB. What can I do to make my video card back to 128mb or where can I find the traditional bios update for this version of bios.Thanks

  • A single monitor for two computers

    Can I connect both my new Mac mini and my old PC to a singe monitor?

  • I think I'm doing this wrong

    What is the proper way to handle session management from page to page in a JSF application? Specifically, I want to check if the user is logged in before I allow a page to load. I've seen various jsp scriptlet solutions and the use of SendRedirect()

  • Macbook Pro Late 2013 SDXC Card Wont Read In Boot Camp

    My Macbook will happily read SDXC 64GB Card whilst in OSX, no matter what the format. However. When i switch to windows 7 bootcamp, the card no longer reads, whether the card is in FAT32 or exFAT formats I've tried reinstalling the latest bootcamp su

  • Proft center and business area

    hai, I have created each branch as business area. Based on that we can able to take p&l report business area wise. Same business area is also the profit center. So is it required to create profit center which will show the same result of P&L.(busines