Plus Forum E-handelsforumet Logistik Script för packsoft online

Visar 4 inlägg - 41 till 44 (av 44 totalt)
  • Författare
    Inlägg
  • #183052
    PontusAndersson
    Deltagare

    Nu har jag löst scriptet. Fick ändra lite knappnamn samt lägga in ett extra moment för att ta sig till utskriftfavoriten.

    // ==UserScript==
    // @name varubrev
    // @namespace http://www.fractalposter.com
    // @author Mikael Backlund
    // @description Varubrev
    // @include https://po.unifaun.se*
    // @include http://hallabalo.se*
    // @require http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js
    // @version 001
    // @grant GM_getValue
    // @grant GM_setValue
    // ==/UserScript==
    // Base url of page to collect addresses on.
    var customer_info_url_base = ‘hallabalo.se/din_sökväg.php’;
    // When object of this class is clicked on the above page addresses are collected
    var object_class_to_click = ‘.knapp’;
    // Pacsoft online user id
    var my_pacsoft_uid = ‘DITT PACKSOFT ID’;
    // Pacsoft online password
    var my_pacsoft_pwd = ‘DITT PACKSOFT LÖSENORD’;
    // Name on image next to favorite
    var favorite_html_name = “act_ShipmentJobFavoriteSearchActions_SearchResultEdit_RowId_19404”; //ÄNDRA DETTA PÅ RAD 66
    // Senders packsoft customer number
    var my_packsoft_customer_nr = ‘1’;

    // Class of

    with customer name etc…
    var click_class = “.knapp”;
    var customer_name_class = “.customer_name”;
    var customer_address1_class = “.customer_address1”;
    var customer_address2_class = “.customer_address2”;
    var customer_postcode_class = “.customer_postcode”;
    var customer_email_class = “.customer_email”;
    var customer_telephone_class = “.customer_telephone”;
    var customer_order_id_class = “.customer_order_id”;
    var customer_names = new Array();
    var customer_address1s = new Array();
    var customer_address2s = new Array();
    var customer_postcodes = new Array();
    var customer_emails = new Array();
    var customer_telephones = new Array();
    var customer_order_ids = new Array();

    // Attach the collect_addresses function to a object on the page with addresses
    if (window.location.href.indexOf(customer_info_url_base) > – 1) {
    $(object_class_to_click).click(collect_addresses);
    } // The login page of packsoft online
    else if (GM_getValue(‘trigger’) == ‘1’ && $(‘button[name=”act_LoginActions_Login”]’) [0]) {
    $(‘input[name=”CompanyLogin”]’).val(my_pacsoft_uid);
    $(‘input[name=”UserPass”]’).val(my_pacsoft_pwd);
    GM_setValue(‘trigger’, ‘2’);
    setTimeout(function () {
    $(‘button[name=”act_LoginActions_Login”]’).trigger(‘click’);
    }, 100);
    } // Packsoft home screen, go to my favorite named Varubrev
    else if (GM_getValue(“trigger”)== ‘2’ && document.location.href.indexOf(“Action=act_PostRedirectHomeActions_Render”) > -1) {
    GM_setValue(“trigger”, “3”);
    GM_setValue(“session_link”, document.location.href.split(“&”)[0].split(“?”)[1]);
    document.location = “webapp?”+GM_getValue(“session_link”)+”&Action=act_MenuActions_Item&Target=body&ItemHandler=ShipmentJobFavoriteSearchActions2″;
    }

    else if (GM_getValue(“trigger”)== ‘3’ && document.location.href.indexOf(“Action=act_ShipmentJobFavoriteSearchActions_Render”) > -1) {
    GM_setValue(“trigger”, “4”);
    // alert(‘Samlade kundadress.’);

    $(‘button[name=”act_ShipmentJobFavoriteSearchActions_SearchResultEdit_RowId_19404″]’).trigger(‘click’);
    }
    // Fill the first page of the form press next (do while there is addresses left)
    else if (GM_getValue(‘trigger’) == ‘4’ && GM_getValue(‘no_of_customers’) > 0 && $(‘button[name=”act_ShipmentJobEdit1Actions2_Next”]’) [0]) {
    $(‘input[name=”RECEIVERName”]’).val(GM_getValue(‘customer_names’).split(‘¤’) [GM_getValue(‘no_of_customers’) – 1]);
    $(‘input[name=”RECEIVERDeliveryAddress1″]’).val(GM_getValue(‘customer_address1s’).split(‘¤’) [GM_getValue(‘no_of_customers’) – 1]);
    $(‘input[name=”RECEIVERDeliveryAddress2″]’).val(GM_getValue(‘customer_address2s’).split(‘¤’) [GM_getValue(‘no_of_customers’) – 1]);
    $(‘input[name=”RECEIVERDeliveryZipcode”]’).focus();
    $(‘input[name=”RECEIVERDeliveryZipcode”]’).val(GM_getValue(‘customer_postcodes’).split(‘¤’) [GM_getValue(‘no_of_customers’) – 1]);
    setTimeout(function () {
    $(‘button[name=”act_ShipmentJobEdit1Actions2_Folding_FoldName_RECEIVERDeliveryZipcode$HelpNote”]’).trigger(‘click’);
    $(‘input[name=”RECEIVERDeliveryZipcode”]’).blur();
    $(‘input[name=”RECEIVERSms”]’).focus();
    $(‘input[name=”RECEIVERSms”]’).val(GM_getValue(‘customer_telephones’).split(‘¤’) [GM_getValue(‘no_of_customers’) – 1]);
    $(‘input[name=”RECEIVEREmail”]’).val(GM_getValue(‘customer_emails’).split(‘¤’) [GM_getValue(‘no_of_customers’) – 1]);
    setTimeout(function () {
    $(‘button[name=”act_ShipmentJobEdit1Actions2_Next”]’).trigger(‘click’);
    }, 400);
    }, 100);
    } // Fill the second page of the form click “lagra” (do while there is addresses left)
    else if (GM_getValue(‘trigger’) == ‘4’ && GM_getValue(‘no_of_customers’) > 0 && $(‘button[name=”act_ShipmentJobEdit2Actions2_Store”]’) [0]) {
    $(‘input[name=”ShipmentSndReference”]’).val(GM_getValue(‘customer_order_ids’).split(‘¤’) [GM_getValue(‘no_of_customers’) – 1]);
    $(‘select[name=”SenderCustNo”]’).val(my_packsoft_customer_nr);
    GM_setValue(‘no_of_customers’, GM_getValue(‘no_of_customers’) – 1);
    if (GM_getValue(‘no_of_customers’) === 0)
    GM_setValue(‘trigger’, ‘5’);
    setTimeout(function () {
    $(‘button[name=”act_ShipmentJobEdit2Actions2_Store”]’).trigger(‘click’);
    }, 100);
    } // Go to “Lagrade utskrifter”
    else if (GM_getValue(‘trigger’) == ‘5’ && $(‘button[name=”act_ShipmentJobEdit1Actions2_Next”]’) [0]) {
    GM_setValue(‘trigger’, ‘0’);
    document.location = ‘webapp?’ + GM_getValue(‘session_link’) + ‘&Action=act_MenuActions_Item&Target=body&ItemHandler=ShipmentJobSearchActions2’;
    } // This function collects addresses stores them and then opens packsoft online
    // This function is attached to a object on the page with addresses
    // It is triggered when the user clicks the object

    function collect_addresses() {
    $(‘.customer_name’).each(function (i, elem) {
    customer_names[i] = $(elem).text().replace(‘¤’, ”);
    });
    $(‘.customer_address1’).each(function (i, elem) {
    customer_address1s[i] = $(elem).text().replace(‘¤’, ”);
    });
    $(‘.customer_address2’).each(function (i, elem) {
    customer_address2s[i] = $(elem).text().replace(‘¤’, ”);
    });
    $(‘.customer_postcode’).each(function (i, elem) {
    customer_postcodes[i] = $(elem).text().replace(‘¤’, ”);
    });
    $(‘.customer_email’).each(function (i, elem) {
    customer_emails[i] = $(elem).text().replace(‘¤’, ”);
    });
    $(‘.customer_telephone’).each(function (i, elem) {
    customer_telephones[i] = $(elem).text().replace(‘¤’, ”);
    });
    $(‘.customer_order_id’).each(function (i, elem) {
    customer_order_ids[i] = $(elem).text().replace(‘¤’, ”);
    });
    GM_setValue(‘customer_names’, customer_names.join(‘¤’));
    GM_setValue(‘customer_address1s’, customer_address1s.join(‘¤’));
    GM_setValue(‘customer_address2s’, customer_address2s.join(‘¤’));
    GM_setValue(‘customer_postcodes’, customer_postcodes.join(‘¤’));
    GM_setValue(‘customer_emails’, customer_emails.join(‘¤’));
    GM_setValue(‘customer_telephones’, customer_telephones.join(‘¤’));
    GM_setValue(‘customer_order_ids’, customer_order_ids.join(‘¤’));
    GM_setValue(‘no_of_customers’, customer_names.length);
    GM_setValue(‘trigger’, ‘1’);
    window.open(‘https://po.unifaun.se’);
    }
    [/CODE][CODE]
    // ==UserScript==
    // @name varubrev
    // @namespace http://www.fractalposter.com
    // @author Mikael Backlund
    // @description Varubrev
    // @include https://po.unifaun.se*
    // @include http://hallabalo.se*
    // @require http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js
    // @version 001
    // @grant GM_getValue
    // @grant GM_setValue
    // ==/UserScript==
    // Base url of page to collect addresses on.
    var customer_info_url_base = ‘hallabalo.se/din_sökväg.php’;
    // When object of this class is clicked on the above page addresses are collected
    var object_class_to_click = ‘.knapp’;
    // Pacsoft online user id
    var my_pacsoft_uid = ‘DITT PACKSOFT ID’;
    // Pacsoft online password
    var my_pacsoft_pwd = ‘DITT PACKSOFT LÖSENORD’;
    // Name on image next to favorite
    var favorite_html_name = “act_ShipmentJobFavoriteSearchActions_SearchResultEdit_RowId_19404”; //ÄNDRA DETTA PÅ RAD 66
    // Senders packsoft customer number
    var my_packsoft_customer_nr = ‘1’;

    // Class of

    with customer name etc…
    var click_class = “.knapp”;
    var customer_name_class = “.customer_name”;
    var customer_address1_class = “.customer_address1”;
    var customer_address2_class = “.customer_address2”;
    var customer_postcode_class = “.customer_postcode”;
    var customer_email_class = “.customer_email”;
    var customer_telephone_class = “.customer_telephone”;
    var customer_order_id_class = “.customer_order_id”;
    var customer_names = new Array();
    var customer_address1s = new Array();
    var customer_address2s = new Array();
    var customer_postcodes = new Array();
    var customer_emails = new Array();
    var customer_telephones = new Array();
    var customer_order_ids = new Array();

    // Attach the collect_addresses function to a object on the page with addresses
    if (window.location.href.indexOf(customer_info_url_base) > – 1) {
    $(object_class_to_click).click(collect_addresses);
    } // The login page of packsoft online
    else if (GM_getValue(‘trigger’) == ‘1’ && $(‘button[name=”act_LoginActions_Login”]’) [0]) {
    $(‘input[name=”CompanyLogin”]’).val(my_pacsoft_uid);
    $(‘input[name=”UserPass”]’).val(my_pacsoft_pwd);
    GM_setValue(‘trigger’, ‘2’);
    setTimeout(function () {
    $(‘button[name=”act_LoginActions_Login”]’).trigger(‘click’);
    }, 100);
    } // Packsoft home screen, go to my favorite named Varubrev
    else if (GM_getValue(“trigger”)== ‘2’ && document.location.href.indexOf(“Action=act_PostRedirectHomeActions_Render”) > -1) {
    GM_setValue(“trigger”, “3”);
    GM_setValue(“session_link”, document.location.href.split(“&”)[0].split(“?”)[1]);
    document.location = “webapp?”+GM_getValue(“session_link”)+”&Action=act_MenuActions_Item&Target=body&ItemHandler=ShipmentJobFavoriteSearchActions2″;
    }

    else if (GM_getValue(“trigger”)== ‘3’ && document.location.href.indexOf(“Action=act_ShipmentJobFavoriteSearchActions_Render”) > -1) {
    GM_setValue(“trigger”, “4”);
    // alert(‘Samlade kundadress.’);

    $(‘button[name=”act_ShipmentJobFavoriteSearchActions_SearchResultEdit_RowId_19404″]’).trigger(‘click’);
    }
    // Fill the first page of the form press next (do while there is addresses left)
    else if (GM_getValue(‘trigger’) == ‘4’ && GM_getValue(‘no_of_customers’) > 0 && $(‘button[name=”act_ShipmentJobEdit1Actions2_Next”]’) [0]) {
    $(‘input[name=”RECEIVERName”]’).val(GM_getValue(‘customer_names’).split(‘¤’) [GM_getValue(‘no_of_customers’) – 1]);
    $(‘input[name=”RECEIVERDeliveryAddress1″]’).val(GM_getValue(‘customer_address1s’).split(‘¤’) [GM_getValue(‘no_of_customers’) – 1]);
    $(‘input[name=”RECEIVERDeliveryAddress2″]’).val(GM_getValue(‘customer_address2s’).split(‘¤’) [GM_getValue(‘no_of_customers’) – 1]);
    $(‘input[name=”RECEIVERDeliveryZipcode”]’).focus();
    $(‘input[name=”RECEIVERDeliveryZipcode”]’).val(GM_getValue(‘customer_postcodes’).split(‘¤’) [GM_getValue(‘no_of_customers’) – 1]);
    setTimeout(function () {
    $(‘button[name=”act_ShipmentJobEdit1Actions2_Folding_FoldName_RECEIVERDeliveryZipcode$HelpNote”]’).trigger(‘click’);
    $(‘input[name=”RECEIVERDeliveryZipcode”]’).blur();
    $(‘input[name=”RECEIVERSms”]’).focus();
    $(‘input[name=”RECEIVERSms”]’).val(GM_getValue(‘customer_telephones’).split(‘¤’) [GM_getValue(‘no_of_customers’) – 1]);
    $(‘input[name=”RECEIVEREmail”]’).val(GM_getValue(‘customer_emails’).split(‘¤’) [GM_getValue(‘no_of_customers’) – 1]);
    setTimeout(function () {
    $(‘button[name=”act_ShipmentJobEdit1Actions2_Next”]’).trigger(‘click’);
    }, 400);
    }, 100);
    } // Fill the second page of the form click “lagra” (do while there is addresses left)
    else if (GM_getValue(‘trigger’) == ‘4’ && GM_getValue(‘no_of_customers’) > 0 && $(‘button[name=”act_ShipmentJobEdit2Actions2_Store”]’) [0]) {
    $(‘input[name=”ShipmentSndReference”]’).val(GM_getValue(‘customer_order_ids’).split(‘¤’) [GM_getValue(‘no_of_customers’) – 1]);
    $(‘select[name=”SenderCustNo”]’).val(my_packsoft_customer_nr);
    GM_setValue(‘no_of_customers’, GM_getValue(‘no_of_customers’) – 1);
    if (GM_getValue(‘no_of_customers’) === 0)
    GM_setValue(‘trigger’, ‘5’);
    setTimeout(function () {
    $(‘button[name=”act_ShipmentJobEdit2Actions2_Store”]’).trigger(‘click’);
    }, 100);
    } // Go to “Lagrade utskrifter”
    else if (GM_getValue(‘trigger’) == ‘5’ && $(‘button[name=”act_ShipmentJobEdit1Actions2_Next”]’) [0]) {
    GM_setValue(‘trigger’, ‘0’);
    document.location = ‘webapp?’ + GM_getValue(‘session_link’) + ‘&Action=act_MenuActions_Item&Target=body&ItemHandler=ShipmentJobSearchActions2’;
    } // This function collects addresses stores them and then opens packsoft online
    // This function is attached to a object on the page with addresses
    // It is triggered when the user clicks the object

    function collect_addresses() {
    $(‘.customer_name’).each(function (i, elem) {
    customer_names = $(elem).text().replace(‘¤’, ”);
    });
    $(‘.customer_address1’).each(function (i, elem) {
    customer_address1s
    = $(elem).text().replace(‘¤’, ”);
    });
    $(‘.customer_address2’).each(function (i, elem) {
    customer_address2s
    = $(elem).text().replace(‘¤’, ”);
    });
    $(‘.customer_postcode’).each(function (i, elem) {
    customer_postcodes
    = $(elem).text().replace(‘¤’, ”);
    });
    $(‘.customer_email’).each(function (i, elem) {
    customer_emails
    = $(elem).text().replace(‘¤’, ”);
    });
    $(‘.customer_telephone’).each(function (i, elem) {
    customer_telephones
    = $(elem).text().replace(‘¤’, ”);
    });
    $(‘.customer_order_id’).each(function (i, elem) {
    customer_order_ids
    = $(elem).text().replace(‘¤’, ”);
    });
    GM_setValue(‘customer_names’, customer_names.join(‘¤’));
    GM_setValue(‘customer_address1s’, customer_address1s.join(‘¤’));
    GM_setValue(‘customer_address2s’, customer_address2s.join(‘¤’));
    GM_setValue(‘customer_postcodes’, customer_postcodes.join(‘¤’));
    GM_setValue(‘customer_emails’, customer_emails.join(‘¤’));
    GM_setValue(‘customer_telephones’, customer_telephones.join(‘¤’));
    GM_setValue(‘customer_order_ids’, customer_order_ids.join(‘¤’));
    GM_setValue(‘no_of_customers’, customer_names.length);
    GM_setValue(‘trigger’, ‘1’);
    window.open(‘https://po.unifaun.se’);
    }
    [/CODE]

    #185017
    Dent
    Deltagare

    @PontusAndersson 89005 wrote:

    Nu har jag löst scriptet. Fick ändra lite knappnamn samt lägga in ett extra moment för att ta sig till utskriftfavoriten.

    // ==UserScript==
    // @name varubrev
    // @namespace http://www.fractalposter.com
    // @author Mikael Backlund
    // @description Varubrev
    // @include https://po.unifaun.se*
    // @include http://hallabalo.se*
    // @require http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js
    // @version 001
    // @grant GM_getValue
    // @grant GM_setValue
    // ==/UserScript==
    // Base url of page to collect addresses on.
    var customer_info_url_base = ‘hallabalo.se/din_sökväg.php’;
    // When object of this class is clicked on the above page addresses are collected
    var object_class_to_click = ‘.knapp’;
    // Pacsoft online user id
    var my_pacsoft_uid = ‘DITT PACKSOFT ID’;
    // Pacsoft online password
    var my_pacsoft_pwd = ‘DITT PACKSOFT LÖSENORD’;
    // Name on image next to favorite
    var favorite_html_name = “act_ShipmentJobFavoriteSearchActions_SearchResultEdit_RowId_19404”; //ÄNDRA DETTA PÅ RAD 66
    // Senders packsoft customer number
    var my_packsoft_customer_nr = ‘1’;

    // Class of

    with customer name etc…
    var click_class = “.knapp”;
    var customer_name_class = “.customer_name”;
    var customer_address1_class = “.customer_address1”;
    var customer_address2_class = “.customer_address2”;
    var customer_postcode_class = “.customer_postcode”;
    var customer_email_class = “.customer_email”;
    var customer_telephone_class = “.customer_telephone”;
    var customer_order_id_class = “.customer_order_id”;
    var customer_names = new Array();
    var customer_address1s = new Array();
    var customer_address2s = new Array();
    var customer_postcodes = new Array();
    var customer_emails = new Array();
    var customer_telephones = new Array();
    var customer_order_ids = new Array();

    // Attach the collect_addresses function to a object on the page with addresses
    if (window.location.href.indexOf(customer_info_url_base) > – 1) {
    $(object_class_to_click).click(collect_addresses);
    } // The login page of packsoft online
    else if (GM_getValue(‘trigger’) == ‘1’ && $(‘button[name=”act_LoginActions_Login”]’) [0]) {
    $(‘input[name=”CompanyLogin”]’).val(my_pacsoft_uid);
    $(‘input[name=”UserPass”]’).val(my_pacsoft_pwd);
    GM_setValue(‘trigger’, ‘2’);
    setTimeout(function () {
    $(‘button[name=”act_LoginActions_Login”]’).trigger(‘click’);
    }, 100);
    } // Packsoft home screen, go to my favorite named Varubrev
    else if (GM_getValue(“trigger”)== ‘2’ && document.location.href.indexOf(“Action=act_PostRedirectHomeActions_Render”) > -1) {
    GM_setValue(“trigger”, “3”);
    GM_setValue(“session_link”, document.location.href.split(“&”)[0].split(“?”)[1]);
    document.location = “webapp?”+GM_getValue(“session_link”)+”&Action=act_MenuActions_Item&Target=body&ItemHandler=ShipmentJobFavoriteSearchActions2″;
    }

    else if (GM_getValue(“trigger”)== ‘3’ && document.location.href.indexOf(“Action=act_ShipmentJobFavoriteSearchActions_Render”) > -1) {
    GM_setValue(“trigger”, “4”);
    // alert(‘Samlade kundadress.’);

    $(‘button[name=”act_ShipmentJobFavoriteSearchActions_SearchResultEdit_RowId_19404″]’).trigger(‘click’);
    }
    // Fill the first page of the form press next (do while there is addresses left)
    else if (GM_getValue(‘trigger’) == ‘4’ && GM_getValue(‘no_of_customers’) > 0 && $(‘button[name=”act_ShipmentJobEdit1Actions2_Next”]’) [0]) {
    $(‘input[name=”RECEIVERName”]’).val(GM_getValue(‘customer_names’).split(‘¤’) [GM_getValue(‘no_of_customers’) – 1]);
    $(‘input[name=”RECEIVERDeliveryAddress1″]’).val(GM_getValue(‘customer_address1s’).split(‘¤’) [GM_getValue(‘no_of_customers’) – 1]);
    $(‘input[name=”RECEIVERDeliveryAddress2″]’).val(GM_getValue(‘customer_address2s’).split(‘¤’) [GM_getValue(‘no_of_customers’) – 1]);
    $(‘input[name=”RECEIVERDeliveryZipcode”]’).focus();
    $(‘input[name=”RECEIVERDeliveryZipcode”]’).val(GM_getValue(‘customer_postcodes’).split(‘¤’) [GM_getValue(‘no_of_customers’) – 1]);
    setTimeout(function () {
    $(‘button[name=”act_ShipmentJobEdit1Actions2_Folding_FoldName_RECEIVERDeliveryZipcode$HelpNote”]’).trigger(‘click’);
    $(‘input[name=”RECEIVERDeliveryZipcode”]’).blur();
    $(‘input[name=”RECEIVERSms”]’).focus();
    $(‘input[name=”RECEIVERSms”]’).val(GM_getValue(‘customer_telephones’).split(‘¤’) [GM_getValue(‘no_of_customers’) – 1]);
    $(‘input[name=”RECEIVEREmail”]’).val(GM_getValue(‘customer_emails’).split(‘¤’) [GM_getValue(‘no_of_customers’) – 1]);
    setTimeout(function () {
    $(‘button[name=”act_ShipmentJobEdit1Actions2_Next”]’).trigger(‘click’);
    }, 400);
    }, 100);
    } // Fill the second page of the form click “lagra” (do while there is addresses left)
    else if (GM_getValue(‘trigger’) == ‘4’ && GM_getValue(‘no_of_customers’) > 0 && $(‘button[name=”act_ShipmentJobEdit2Actions2_Store”]’) [0]) {
    $(‘input[name=”ShipmentSndReference”]’).val(GM_getValue(‘customer_order_ids’).split(‘¤’) [GM_getValue(‘no_of_customers’) – 1]);
    $(‘select[name=”SenderCustNo”]’).val(my_packsoft_customer_nr);
    GM_setValue(‘no_of_customers’, GM_getValue(‘no_of_customers’) – 1);
    if (GM_getValue(‘no_of_customers’) === 0)
    GM_setValue(‘trigger’, ‘5’);
    setTimeout(function () {
    $(‘button[name=”act_ShipmentJobEdit2Actions2_Store”]’).trigger(‘click’);
    }, 100);
    } // Go to “Lagrade utskrifter”
    else if (GM_getValue(‘trigger’) == ‘5’ && $(‘button[name=”act_ShipmentJobEdit1Actions2_Next”]’) [0]) {
    GM_setValue(‘trigger’, ‘0’);
    document.location = ‘webapp?’ + GM_getValue(‘session_link’) + ‘&Action=act_MenuActions_Item&Target=body&ItemHandler=ShipmentJobSearchActions2’;
    } // This function collects addresses stores them and then opens packsoft online
    // This function is attached to a object on the page with addresses
    // It is triggered when the user clicks the object

    function collect_addresses() {
    $(‘.customer_name’).each(function (i, elem) {
    customer_names[i] = $(elem).text().replace(‘¤’, ”);
    });
    $(‘.customer_address1’).each(function (i, elem) {
    customer_address1s[i] = $(elem).text().replace(‘¤’, ”);
    });
    $(‘.customer_address2’).each(function (i, elem) {
    customer_address2s[i] = $(elem).text().replace(‘¤’, ”);
    });
    $(‘.customer_postcode’).each(function (i, elem) {
    customer_postcodes[i] = $(elem).text().replace(‘¤’, ”);
    });
    $(‘.customer_email’).each(function (i, elem) {
    customer_emails[i] = $(elem).text().replace(‘¤’, ”);
    });
    $(‘.customer_telephone’).each(function (i, elem) {
    customer_telephones[i] = $(elem).text().replace(‘¤’, ”);
    });
    $(‘.customer_order_id’).each(function (i, elem) {
    customer_order_ids[i] = $(elem).text().replace(‘¤’, ”);
    });
    GM_setValue(‘customer_names’, customer_names.join(‘¤’));
    GM_setValue(‘customer_address1s’, customer_address1s.join(‘¤’));
    GM_setValue(‘customer_address2s’, customer_address2s.join(‘¤’));
    GM_setValue(‘customer_postcodes’, customer_postcodes.join(‘¤’));
    GM_setValue(‘customer_emails’, customer_emails.join(‘¤’));
    GM_setValue(‘customer_telephones’, customer_telephones.join(‘¤’));
    GM_setValue(‘customer_order_ids’, customer_order_ids.join(‘¤’));
    GM_setValue(‘no_of_customers’, customer_names.length);
    GM_setValue(‘trigger’, ‘1’);
    window.open(‘https://po.unifaun.se’);
    }
    [/CODE]

    Fungerar detta fortfarande?[CODE]
    // ==UserScript==
    // @name varubrev
    // @namespace http://www.fractalposter.com
    // @author Mikael Backlund
    // @description Varubrev
    // @include https://po.unifaun.se*
    // @include http://hallabalo.se*
    // @require http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js
    // @version 001
    // @grant GM_getValue
    // @grant GM_setValue
    // ==/UserScript==
    // Base url of page to collect addresses on.
    var customer_info_url_base = ‘hallabalo.se/din_sökväg.php’;
    // When object of this class is clicked on the above page addresses are collected
    var object_class_to_click = ‘.knapp’;
    // Pacsoft online user id
    var my_pacsoft_uid = ‘DITT PACKSOFT ID’;
    // Pacsoft online password
    var my_pacsoft_pwd = ‘DITT PACKSOFT LÖSENORD’;
    // Name on image next to favorite
    var favorite_html_name = “act_ShipmentJobFavoriteSearchActions_SearchResultEdit_RowId_19404”; //ÄNDRA DETTA PÅ RAD 66
    // Senders packsoft customer number
    var my_packsoft_customer_nr = ‘1’;

    // Class of

    with customer name etc…
    var click_class = “.knapp”;
    var customer_name_class = “.customer_name”;
    var customer_address1_class = “.customer_address1”;
    var customer_address2_class = “.customer_address2”;
    var customer_postcode_class = “.customer_postcode”;
    var customer_email_class = “.customer_email”;
    var customer_telephone_class = “.customer_telephone”;
    var customer_order_id_class = “.customer_order_id”;
    var customer_names = new Array();
    var customer_address1s = new Array();
    var customer_address2s = new Array();
    var customer_postcodes = new Array();
    var customer_emails = new Array();
    var customer_telephones = new Array();
    var customer_order_ids = new Array();

    // Attach the collect_addresses function to a object on the page with addresses
    if (window.location.href.indexOf(customer_info_url_base) > – 1) {
    $(object_class_to_click).click(collect_addresses);
    } // The login page of packsoft online
    else if (GM_getValue(‘trigger’) == ‘1’ && $(‘button[name=”act_LoginActions_Login”]’) [0]) {
    $(‘input[name=”CompanyLogin”]’).val(my_pacsoft_uid);
    $(‘input[name=”UserPass”]’).val(my_pacsoft_pwd);
    GM_setValue(‘trigger’, ‘2’);
    setTimeout(function () {
    $(‘button[name=”act_LoginActions_Login”]’).trigger(‘click’);
    }, 100);
    } // Packsoft home screen, go to my favorite named Varubrev
    else if (GM_getValue(“trigger”)== ‘2’ && document.location.href.indexOf(“Action=act_PostRedirectHomeActions_Render”) > -1) {
    GM_setValue(“trigger”, “3”);
    GM_setValue(“session_link”, document.location.href.split(“&”)[0].split(“?”)[1]);
    document.location = “webapp?”+GM_getValue(“session_link”)+”&Action=act_MenuActions_Item&Target=body&ItemHandler=ShipmentJobFavoriteSearchActions2″;
    }

    else if (GM_getValue(“trigger”)== ‘3’ && document.location.href.indexOf(“Action=act_ShipmentJobFavoriteSearchActions_Render”) > -1) {
    GM_setValue(“trigger”, “4”);
    // alert(‘Samlade kundadress.’);

    $(‘button[name=”act_ShipmentJobFavoriteSearchActions_SearchResultEdit_RowId_19404″]’).trigger(‘click’);
    }
    // Fill the first page of the form press next (do while there is addresses left)
    else if (GM_getValue(‘trigger’) == ‘4’ && GM_getValue(‘no_of_customers’) > 0 && $(‘button[name=”act_ShipmentJobEdit1Actions2_Next”]’) [0]) {
    $(‘input[name=”RECEIVERName”]’).val(GM_getValue(‘customer_names’).split(‘¤’) [GM_getValue(‘no_of_customers’) – 1]);
    $(‘input[name=”RECEIVERDeliveryAddress1″]’).val(GM_getValue(‘customer_address1s’).split(‘¤’) [GM_getValue(‘no_of_customers’) – 1]);
    $(‘input[name=”RECEIVERDeliveryAddress2″]’).val(GM_getValue(‘customer_address2s’).split(‘¤’) [GM_getValue(‘no_of_customers’) – 1]);
    $(‘input[name=”RECEIVERDeliveryZipcode”]’).focus();
    $(‘input[name=”RECEIVERDeliveryZipcode”]’).val(GM_getValue(‘customer_postcodes’).split(‘¤’) [GM_getValue(‘no_of_customers’) – 1]);
    setTimeout(function () {
    $(‘button[name=”act_ShipmentJobEdit1Actions2_Folding_FoldName_RECEIVERDeliveryZipcode$HelpNote”]’).trigger(‘click’);
    $(‘input[name=”RECEIVERDeliveryZipcode”]’).blur();
    $(‘input[name=”RECEIVERSms”]’).focus();
    $(‘input[name=”RECEIVERSms”]’).val(GM_getValue(‘customer_telephones’).split(‘¤’) [GM_getValue(‘no_of_customers’) – 1]);
    $(‘input[name=”RECEIVEREmail”]’).val(GM_getValue(‘customer_emails’).split(‘¤’) [GM_getValue(‘no_of_customers’) – 1]);
    setTimeout(function () {
    $(‘button[name=”act_ShipmentJobEdit1Actions2_Next”]’).trigger(‘click’);
    }, 400);
    }, 100);
    } // Fill the second page of the form click “lagra” (do while there is addresses left)
    else if (GM_getValue(‘trigger’) == ‘4’ && GM_getValue(‘no_of_customers’) > 0 && $(‘button[name=”act_ShipmentJobEdit2Actions2_Store”]’) [0]) {
    $(‘input[name=”ShipmentSndReference”]’).val(GM_getValue(‘customer_order_ids’).split(‘¤’) [GM_getValue(‘no_of_customers’) – 1]);
    $(‘select[name=”SenderCustNo”]’).val(my_packsoft_customer_nr);
    GM_setValue(‘no_of_customers’, GM_getValue(‘no_of_customers’) – 1);
    if (GM_getValue(‘no_of_customers’) === 0)
    GM_setValue(‘trigger’, ‘5’);
    setTimeout(function () {
    $(‘button[name=”act_ShipmentJobEdit2Actions2_Store”]’).trigger(‘click’);
    }, 100);
    } // Go to “Lagrade utskrifter”
    else if (GM_getValue(‘trigger’) == ‘5’ && $(‘button[name=”act_ShipmentJobEdit1Actions2_Next”]’) [0]) {
    GM_setValue(‘trigger’, ‘0’);
    document.location = ‘webapp?’ + GM_getValue(‘session_link’) + ‘&Action=act_MenuActions_Item&Target=body&ItemHandler=ShipmentJobSearchActions2’;
    } // This function collects addresses stores them and then opens packsoft online
    // This function is attached to a object on the page with addresses
    // It is triggered when the user clicks the object

    function collect_addresses() {
    $(‘.customer_name’).each(function (i, elem) {
    customer_names = $(elem).text().replace(‘¤’, ”);
    });
    $(‘.customer_address1’).each(function (i, elem) {
    customer_address1s
    = $(elem).text().replace(‘¤’, ”);
    });
    $(‘.customer_address2’).each(function (i, elem) {
    customer_address2s
    = $(elem).text().replace(‘¤’, ”);
    });
    $(‘.customer_postcode’).each(function (i, elem) {
    customer_postcodes
    = $(elem).text().replace(‘¤’, ”);
    });
    $(‘.customer_email’).each(function (i, elem) {
    customer_emails
    = $(elem).text().replace(‘¤’, ”);
    });
    $(‘.customer_telephone’).each(function (i, elem) {
    customer_telephones
    = $(elem).text().replace(‘¤’, ”);
    });
    $(‘.customer_order_id’).each(function (i, elem) {
    customer_order_ids
    = $(elem).text().replace(‘¤’, ”);
    });
    GM_setValue(‘customer_names’, customer_names.join(‘¤’));
    GM_setValue(‘customer_address1s’, customer_address1s.join(‘¤’));
    GM_setValue(‘customer_address2s’, customer_address2s.join(‘¤’));
    GM_setValue(‘customer_postcodes’, customer_postcodes.join(‘¤’));
    GM_setValue(‘customer_emails’, customer_emails.join(‘¤’));
    GM_setValue(‘customer_telephones’, customer_telephones.join(‘¤’));
    GM_setValue(‘customer_order_ids’, customer_order_ids.join(‘¤’));
    GM_setValue(‘no_of_customers’, customer_names.length);
    GM_setValue(‘trigger’, ‘1’);
    window.open(‘https://po.unifaun.se’);
    }
    [/CODE]

    Fungerar detta fortfarande?

    #185007
    SimonJ
    Deltagare

    @Dent 91783 wrote:

    Fungerar detta fortfarande?

    Det borde den. Kanske med lite modifikation. Vi kör på den eller en lite ändrad variant.

    Är det för övrigt någon som har löst ett script för dhl multishipping?

    #185400
    elitasson
    Deltagare

    Är detta verkligen bästa alternativet för att automatisera pacsoft online? Vilka andra alternativ finns för att sköta detta med ett enkelt API? Dessa transportföretag verkar göra det krångligt för sig…?

    EDIT: Ok, Unifaun som är samma som Pacsoft Online har ett OK API: https://www.unifaunonline.se/rs-docs/.

    Det går att aktivera detta API i Pacsoft Online under webbutik > Lägg till mer i systemet > Unifaun Orderkoppling – Unifaun APIConnect. Kostnad 2000 startavgift + 2000 kr / år.

    Notering för Unifauns API:
    På avsändare räcker det med att du sätter quickId. quickId ska ha samma värde som “snabbsökvärde” under Underhåll > Avsändare.

    Nu skapar vi fraktsedlar med ett knapptryck i vårt affärssystem! :D

Visar 4 inlägg - 41 till 44 (av 44 totalt)
  • Du måste vara inloggad för att svara på detta ämne.