Welcome to TalkGraphics.com
Results 1 to 9 of 9
  1. #1
    Join Date
    Aug 2004
    Location
    Belgium
    Posts
    57

    Default Get url from a textfile

    Hello,
    Is it possible to get the url-link in the web properties of an object from a text-file.
    On my local dashboard-page I have created a popup-menu to open different Gmail mailboxes.
    However, Google changes the ID-numbers of the mailboxes from time to time. So I have a textfile with the mailbox (username) and the Google ID-number (0 to 9) on one line.
    I wonder if it is possible to connect each item of my menu (each item has a web property) to one line of the textfile or if easier each item of the menu to one specific text-file with only one line containing the correct url.
    The url to use for the different gmail inboxes is always: "https://mail.google.com/mail/u/0/#inbox" where the 0 (zero) can be 0 to 9.
    Frank

  2. #2
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    17,814

    Default Re: Get url from a textfile

    Quote Originally Posted by GK5 View Post
    Hello,
    Is it possible to get the url-link in the web properties of an object from a text-file.
    On my local dashboard-page I have created a popup-menu to open different Gmail mailboxes.
    However, Google changes the ID-numbers of the mailboxes from time to time. So I have a textfile with the mailbox (username) and the Google ID-number (0 to 9) on one line.
    I wonder if it is possible to connect each item of my menu (each item has a web property) to one line of the textfile or if easier each item of the menu to one specific text-file with only one line containing the correct url.
    The url to use for the different gmail inboxes is always: "https://mail.google.com/mail/u/0/#inbox" where the 0 (zero) can be 0 to 9.
    Frank
    Frank, from what you have described, you will have a menu item and its its URL will have to change as Gmail changes the index to your mailboxes.

    You should be able to create one or a number of JS files, with a variable relating to each mailbox (var gmail_green = 5; ), etc.
    The file would have to be published to your site.
    It would be loaded with a head line such as - <script src="index_htm_files/gmail.js"></script>
    Each url would have to be a JavaScript construct of form - javascript: window.location.href='https://mail.google.com/mail/u/' + gmail_green + '#inbox';

    Any change of the data probably requires a page refresh or even clearing the local cache.

    It probably could be done dynamically through Ajax calls but this requires a lot more coding.

    Acorn
    Acorn - installed Xara software: Cloud+/Pro+ and most others back through time (to CC's Artworks). Contact for technical remediation/consultancy for your web designs.
    When we provide assistance, your responses are valuable as they benefit the community. TG Nuggets you might like. Report faults: Xara Cloud+/Pro+/Magix Legacy; Xara KB & Chat

  3. #3
    Join Date
    Aug 2004
    Location
    Belgium
    Posts
    57

    Default Re: Get url from a textfile

    TO: Acorn
    Is it possible to give me an example of such a Javascipt since I don't known anything about Javascript.
    If I have an example I can start experimenting.
    Thanks

  4. #4
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    17,814

    Info Re: Get url from a textfile

    Rather than go to the bother of adding a separate JS file, for this demo, I put the JS variables into the Page Head directly.

    I included an alert to demonstrate the resolution to the index numbers.

    JS - Gmail Accounts.xar

    Acorn
    Acorn - installed Xara software: Cloud+/Pro+ and most others back through time (to CC's Artworks). Contact for technical remediation/consultancy for your web designs.
    When we provide assistance, your responses are valuable as they benefit the community. TG Nuggets you might like. Report faults: Xara Cloud+/Pro+/Magix Legacy; Xara KB & Chat

  5. #5
    Join Date
    Aug 2004
    Location
    Belgium
    Posts
    57

    Default Re: Get url from a textfile

    Thank you very much. I'm sure this will give me the the right solution.
    Frank

  6. #6
    Join Date
    Aug 2004
    Location
    Belgium
    Posts
    57

    Default Re: Get url from a textfile

    TO: Acorn

    I've tried your example and that works fine when the JS is in the Xara File.
    I have now tried to change the concept and put the JS-file in index_htm_files which is easier for me for maintenance.
    However this is not working.

    This is what I've done:

    Header page properties:

    <script src="index_htm_files/gmail.js">
    </script>

    Object link properties:

    javascript: alert(window.location.href='https://mail.google.com/mail/u/' + gmail_blue + '/#inbox');
    javascript: alert(window.location.href='https://mail.google.com/mail/u/' + gmail_green + '/#inbox');

    gmail.js in index_htm_files:

    <script
    var gmail_green = 5;
    var gmail_blue = 3;>
    </script>

    I've put my Xara-testproject in a RAR-file but I could'nt find how to attach it.

    Frank

  7. #7
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    17,814

    Default Re: Get url from a textfile

    Quote Originally Posted by GK5 View Post
    TO: Acorn

    I've tried your example and that works fine when the JS is in the Xara File.
    I have now tried to change the concept and put the JS-file in index_htm_files which is easier for me for maintenance.
    However this is not working.

    This is what I've done:

    Header page properties:

    <script src="index_htm_files/gmail.js">
    </script>

    Object link properties:

    javascript: alert(window.location.href='https://mail.google.com/mail/u/' + gmail_blue + '/#inbox');
    javascript: alert(window.location.href='https://mail.google.com/mail/u/' + gmail_green + '/#inbox');

    gmail.js in index_htm_files:

    <script
    var gmail_green = 5;
    var gmail_blue = 3;>
    </script>

    I've put my Xara-testproject in a RAR-file but I could'nt find how to attach it.

    Frank
    Almost there Frank.

    A referenced JS file does not need the SCRIPT tags as it knows it is JavaScript.
    The file is just:

    var gmail_green = 5;
    var gmail_blue = 3;

    It might still have worked if you had copied what I had used:
    <script>
    var gmail_green = 5;
    var gmail_blue = 3;
    </script> - the closing angle bracket was in the wrong place.

    When you fin it all works, you can remove the alert() part of the Link:
    javascript: window.location.href='https://mail.google.com/mail/u/' + gmail_blue + '/#inbox';

    Acorn
    Acorn - installed Xara software: Cloud+/Pro+ and most others back through time (to CC's Artworks). Contact for technical remediation/consultancy for your web designs.
    When we provide assistance, your responses are valuable as they benefit the community. TG Nuggets you might like. Report faults: Xara Cloud+/Pro+/Magix Legacy; Xara KB & Chat

  8. #8
    Join Date
    Aug 2004
    Location
    Belgium
    Posts
    57

    Default Re: Get url from a textfile

    Thank you very much. This is working!
    Frank

  9. #9
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    17,814

    Default Re: Get url from a textfile

    Quote Originally Posted by GK5 View Post
    Thank you very much. This is working!
    Frank
    Frank, I'm glad. Come back with more questions or an update.

    Acorn
    Acorn - installed Xara software: Cloud+/Pro+ and most others back through time (to CC's Artworks). Contact for technical remediation/consultancy for your web designs.
    When we provide assistance, your responses are valuable as they benefit the community. TG Nuggets you might like. Report faults: Xara Cloud+/Pro+/Magix Legacy; Xara KB & Chat

 

 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •