I am trying to use Nitro PDF Reader from the command line.
This was working correctly, but I am now getting an error Internal : Could not execute code stage: Ambiguous match found.
Passing null values also produces this error.
Code:
timedOut = False
Dim startTime as Date = Date.Now
Dim info as New ProcessStartInfo(appn)
If args <> "" Then info.Arguments = args
If dir <> "" Then info.WorkingDirectory = dir
Using proc As Process = Process.Start(info)
timedOut = Not proc.WaitForExit( _
CInt(timeout.TotalMilliseconds))
End Using
Issue looked to be caused by another action with similar code. There was an action called Run Process until Ended. I then duplicated to have a second which was called Run Process.
This was causing the error.
Related
Below is my workflow inbox content
STEP 1: ln HTML table, the user can approve or reject WBS by checked radio
STEP 2: When user click confirm, then the workflow will update status for each WBS that shown in the table.
Purpose:
I need to get the user's action from step 1.
For now I've enhanced SAPEVENT and make it called my Function Module.
In my function function module I can use 'SAP_WAPI_READ_CONTAINER' properly but I cannot use 'SAP_WAPI_WRITE_CONTAINER' to write the value to workflow.
There was error msg 900 occurs.
Please see my code below:
DATA: LT_CONTAINER TYPE STANDARD TABLE OF SWR_CONT,
LT_MSG_LINES TYPE SAPI_MSG_LINES,
LT_MSG_STRUC TYPE SAPI_MSG_STRUC.
DATA: LV_RETCODE TYPE SY-SUBRC.
*** Get workflow container by using 'SAP_WAPI_READ_CONTAINER' ***
CALL FUNCTION 'SAP_WAPI_READ_CONTAINER'
EXPORTING
WORKITEM_ID = IV_WORKITEMID
IMPORTING
RETURN_CODE = LV_RETCODE
TABLES
SIMPLE_CONTAINER = LT_CONTAINER
MESSAGE_LINES = LT_MSG_LINES
MESSAGE_STRUCT = LT_MSG_STRUC.
*** then I change data inside LT_CONTAINER as my requirement below ***
REPLACE |type="submit" id="ALLAPPV"| IN TABLE LT_CONTAINER[]
WITH |type="button" id="ALLAPPV" hidden|.
*** use SAP_WAPI_WRITE_CONTAINER in order to write value to workflow container but it return error msg 900 ***
CALL FUNCTION 'SAP_WAPI_WRITE_CONTAINER'
EXPORTING
WORKITEM_ID = IV_WORKITEMID
DO_COMMIT = 'X'
OVERWRITE_TABLES_SIMPLE_CONT = 'X'
IMPORTING
RETURN_CODE = LV_RETCODE
TABLES
SIMPLE_CONTAINER = LT_CONTAINER
MESSAGE_LINES = LT_MSG_LINES
MESSAGE_STRUCT = LT_MSG_STRUC.
Hi under my bitbake file I want to stop the execution of certain tasks and want compile function to be executed every time. For this, I have done the following changes.
do_compile[nostamp] = "1"
do_clean[noexec] = "1"
do_cleanall[noexec] = "1"
do_cleansstate[noexec] = "1"
do_fetch[noexec] = "1"
do_patch[noexec] = "1"
do_unpack[noexec] = "1"
And it worked perfectly fine. I was able to stop the execution of tasks like clean, cleanall, cleansstate, fetch, patch and unpack. Also, I was able to make sure that the compile task runs every time.
However, I want to put some restrictions on the same. I want to make sure that noexec and nostamp on relevant task only applies when DEVMODE variable is set to 1. Psuedo code as follows.
if DEVMODE == 1 then
do_compile[nostamp] = "1"
do_clean[noexec] = "1"
do_cleanall[noexec] = "1"
do_cleansstate[noexec] = "1"
do_fetch[noexec] = "1"
do_patch[noexec] = "1"
do_unpack[noexec] = "1"
endif
How to achieve the same in a bitbake file? I have tried this and this links but I am not able to craft a working if condition.
NOTE: Am ok using BB_ENV_EXTRAWHITE, but am not able to code a working if condition for the bitbake file.
Use python anonymous function could work for you.
python () {
#add "export DEVMODE=1" under conf/setenv
#add DEVMODE under BB_ENV_EXTRAWHITE variable under conf/setenv
if d.getVar("DEVMODE", True) == "1":
d.setVarFlag("do_compile", 'nostamp', "1")
}
Or set directly:
do_compile[nostamp] = "${#'1' if d.getVar('DEVMODE') == '1' else '0'}"
I am trying to create test runner python file, that executes the pytest.exe in particular testcase folder and send the results via email.
Here is my code:
test_runner.py:
try:
command = "pytest.exe {app} > {log}".format(app=app_folder, log = log_name)
os.system(command)
except:
send_mail()
I use the following code in conftest.py to add screenshots to pytest-html report.
In conftest.py:
#pytest.mark.hookwrapper
def pytest_runtest_makereport(item, call):
pytest_html = item.config.pluginmanager.getplugin('html')
outcome = yield
report = outcome.get_result()
extra = getattr(report, 'extra', [])
if pytest_html:
xfail = hasattr(report, 'wasxfail')
if (report.skipped and xfail) or (report.failed and not xfail):
test_case = str(item._testcase).strip(")")
function_name = test_case.split(" ")[0]
file_and_class_name = ((test_case.split(" ")[1]).split("."))[-2:]
file_name = ".".join(file_and_class_name) + "." + function_name
Issue is, when I run the command "pytest.exe app_folder" in windows command prompt it is able to discover the test cases and execute them and get the results. But when I call the command from .py file either using os.command or subprocess it fails with the following exception:
\conftest.py", line 85, in pytest_runtest_makereport
INTERNALERROR> test_case = str(item._testcase).strip(")")
INTERNALERROR> AttributeError: 'TestCaseFunction' object has no attribute
'_testcase'
Can anyone please help me to understand whats happening here? or any other way to get the testcase name?
Update:
To overcome this issue, I alternatively used the TestResult object from pytest_runtest_makereport hook to get the test case details.
#pytest.mark.hookwrapper
def pytest_runtest_makereport(item, call):
outcome = yield
report = outcome.get_result()
In the above example, report variable contain the TestResult object. This can be manipulated to get the testcase/class/module name.
you can use shell=True option with subprocess to get the desired result
from subprocess import Popen
command='pytest.exe app_folder' #you can paste whole command which you run in cmd
p1=Popen(command,shell=True)
This would solve your purpose
Before opening the word document
i want to check whether same document is opened already or not.
If opened then i want to close
app.documents.open(as_doc_name)
You can try this
IF ole_myobject.Documents.Count >= 1 THEN
ls_doc_name = ole_myobject.ActiveDocument.Name
END IF
Here you have help of its operation:
http://www.java2s.com/Code/VBA-Excel-Access-Word/Word/Checkthecurrentdocumentcount.htm
The code works. The following example will help you understand how to develop it:
Declare Instance Variables:
OLEObject ole_myobject
Event Open():
ole_myobject = CREATE OLEObject
ole_myobject.connecttonewobject("word.application")
Code in buttom:
String ls_doc_name
String as_doc_name
String as_path_name
Long ll_ActiveDocument
as_path_name = "C:\"
as_doc_name = "Prueba.doc"
ole_myobject.visible=1
ll_ActiveDocument = ole_myobject.Documents.Count
IF ll_ActiveDocument >= 1 THEN
Ls_doc_name = ole_myobject.ActiveDocument.Name
END IF
if Ls_doc_name = as_doc_name THEN
ole_myobject.ActiveDocument.close(0)
end if
ole_myobject.documents.open(as_path_name + as_doc_name)
Remember "ole_myobject.ActiveDocument.close(0)" does not close Word, it only closes the document but the Word application continues to run.
I have an Excel template file . Based on the Excel version, I would like to SaveAs as Temp.xlsm through Matlab.
Here is the code I am using to save the template file :
if(XLversion >= 12.0)
Workbook = invoke(Excel.Workbooks,'Open',tempxls);
tempxls1 = [pwd '\utils\temp.xlsm'];
Workbook.SaveAs(tempxls1,1);
tempxls = tempxls1;
extn = 'xlsm';
end
The code is working fine. However when I try to open the file, I get the following error :
However, when the save the temp.xls to temp.xlsm through SaveAs menu, it opens without any error.
Any idea what could be the error in the code or If I am missing something.
Thanks
Can you try the following code please and comment. You may call this sub-routine to save the as the file.
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim FileNameVal As String
If SaveAsUI Then
FileNameVal = Application.GetSaveAsFilename(, "Excel Macro-Enabled Workbook (*.xlsm), *.xlsm")
Cancel = True
If FileNameVal = "False" Then 'User pressed cancel
Exit Sub
End If
Application.EnableEvents = False
If Right(ThisWorkbook.Name, 5) <> ".xlsm" Then
ThisWorkbook.SaveAs Filename:=FileNameVal & ".xlsm", FileFormat:=xlOpenXMLWorkbookMacroEnabled
Else
ThisWorkbook.SaveAs Filename:=FileNameVal, FileFormat:=xlOpenXMLWorkbookMacroEnabled
End If
Application.EnableEvents = True
End If
End Sub
Reference: