AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск Все разделы прочитаны

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 10.01.2018, 05:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,459 / 846 (79) +++++++
Регистрация: 28.10.2006
erconsult: Copy-paste automation in D365 FO with a keyboard emulator
Источник: http://erconsult.eu/blog/copy-paste-...oard-emulator/
==============

The Microsoft Dynamics Product Group in their infinite wisdom first deprecated in D365 FO the import into an arbitrary table (because entities can do many more, and they became the First Class Citizens in the development environment), then the table browser in Production (because Microsoft Support Engineers were complaining the partners did not behave).

However, the ~2600 First Class Citizens are still too few in front of the common crowd of 9000+ application tables, and Microsoft Support Engineers never execute SQL scripts against the database themselves. In absence of other mass update tools in Dynamics 365 FO, the consultant’s last resort became the clipboard: … This activity is well paid like any other consulting routine, but it is as entertaining as watching the grass grow. Most importantly, it is error prone.

Desperate times call for desperate measures. Many large partners out there have already deployed their table browser forms and SQL injection tools, but in simple cases a keyboard emulator may help. I used the program called AutoHotkey with its rich scripting language.

The below scripts are started by this program with the hotkey . They send key combinations into the browser window to perform repetitive actions. The key is your panic button to stop a script running amok. The D365 browser UI is not instantly responsive: allow for 10-100 milliseconds to enter data across different fields in one record, and 1000-1500 milliseconds on database operations of saving, deleting, or opening/closing a form. This is achieved by the “Sleep(x)” command. Even the tabulator key and combinations require some time for the JavaScript presentation layer to respond. The scripts simulate the key pressed, give some time to D365 to respond, and depress the key.

Watch it in action:

<div>http://erconsult.eu/wp-content/uploa...CopyPaste.webm
</p>Mass-deleting lines

‘Simple list’ forms in D365 FO often offer no multi select capability, and with the table browser locked, mass deletion of lines becomes a sweaty exercise for the consultant. The following script calls and confirms ‘yes, delete’ one hundred times in a loop:
; ---------Press Ctrl-J to trigger
^j::
Loop 100 {
Sleep, 500
Send, {alt down}
Sleep, 100
Send, {Del}
Sleep, 100
send, {alt up}
Sleep, 500
Send, {TAB down}{TAB up}
Send, {TAB down}{TAB up}
Send, {Space}
Sleep, 500
}
Return
; Press F1 to stop
F1::ExitApp

Copy language translations

Many master tables come with translations into the customer/supplier language: terms of payment, terms and modes of delivery, miscellaneous charges etc. Entities such as the ‘Unit translation’ only exist for a few of them. Here is the rescue: import the language text with the entity into an existing field (e.g. Description), then copy and paste it into the Translation form. The below script copies 200 payment term descriptions into the ‘en-us’ language:
^j::
Loop 200 {
Sleep, 100
; ---------Copy the content of the Description field
Send, ^a
Sleep, 200
Loop 20{
Send, {Shift Down}{Right}{Shift Up}
Sleep, 10
}
Send, ^c
Sleep, 100
; --------- Open the ribbon, 'click' Translations
Send, !m
Sleep, 100
Send, a
Sleep, 100
Send, {TAB down}{TAB up}
Send, {TAB down}{TAB up}
Send, {TAB down}{TAB up}
Send, {Space}
Sleep, 1500
; ---------Create a new record
Send, {Alt Down}
Sleep, 100
Send, n
Sleep, 100
Send, {Alt Up}
Sleep, 1000
Send, en{-}us
; ---------Paste the content, save the record
Send, {TAB down}{TAB up}
Send, {TAB down}{TAB up}
Sleep, 200
Send, ^v
Sleep, 200
Send, ^s
Sleep, 200
; ---------Close the Translation form
Send, {Escape Up}
Sleep, 200
Send, {Escape Down}
Sleep, 500
; ---------Scroll down to the next record, and repeat the cycle
Send, {LControl Down}{Down}{LControl Up}
}
Return
; Press F1 in panic
F1::ExitApp

The post Copy-paste automation in D365 FO with a keyboard emulator appeared first on ER-Consult.



Источник: http://erconsult.eu/blog/copy-paste-...oard-emulator/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
Старый 10.01.2018, 11:04   #2  
skuull is offline
skuull
Участник
Most Valuable Professional
Лучший по профессии 2014
 
699 / 752 (27) +++++++
Регистрация: 08.03.2013
Адрес: ХЗ
Капец, лучше свой table browser.
Старый 10.01.2018, 12:41   #3  
trud is offline
trud
Участник
Лучший по профессии 2017
 
1,038 / 1629 (57) ++++++++
Регистрация: 07.06.2003
Записей в блоге: 1
Цитата:
Сообщение от Blog bot Посмотреть сообщение
allow for 10-100 milliseconds to enter data across different fields in one record, and 1000-1500 milliseconds on database operations of saving, deleting, or opening/closing a form
круть
а что произойдет если операция сохранения займет больше 1500мс? скрипт может получается тоже начать данные не туда вставлять или как
Старый 10.01.2018, 13:03   #4  
EVGL is offline
EVGL
Banned
Соотечественники
Лучший по профессии 2017
Лучший по профессии 2015
Лучший по профессии 2014
 
4,445 / 3001 (0) ++++++++++
Регистрация: 09.07.2002
Адрес: Parndorf, AT
Так точно, идет в разнос.
Старый 10.01.2018, 13:22   #5  
Stitch_MS is offline
Stitch_MS
Участник
Аватар для Stitch_MS
Соотечественники
 
396 / 478 (16) +++++++
Регистрация: 27.02.2006
Адрес: Дания
Зато не будет
Цитата:
as entertaining as watching the grass grow
Старый 10.01.2018, 13:42   #6  
EVGL is offline
EVGL
Banned
Соотечественники
Лучший по профессии 2017
Лучший по профессии 2015
Лучший по профессии 2014
 
4,445 / 3001 (0) ++++++++++
Регистрация: 09.07.2002
Адрес: Parndorf, AT
Симпатичное идиоматическое выражение, правда? В немецком есть еще синонимическое "Der Farbe beim Trocknen zusehen", для которого есть прямой английский аналог "Watching paint dry".
За это сообщение автора поблагодарили: Stitch_MS (9).
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
D365 FO Ссылка на конкретную запись. Параметры URL sukhanchik DAX: Программирование 15 30.12.2017 11:44
dennis365foroperations: Yes, it’s here! The Copy configurations feature (and a look at other improvements related to Data Management) Blog bot DAX Blogs 0 12.10.2017 16:11
emeadaxsupport: How to prevent copy/paste from grids Blog bot DAX Blogs 0 16.12.2014 19:11
german_nav_developer: NAV Copy&Paste nach Excel Blog bot Dynamics CRM: Blogs 0 15.10.2010 13:40
DeniZone: Copy - paste utility Blog bot DAX Blogs 0 25.06.2009 14:05
Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск
Опции просмотра

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 21:05.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.