Reputation: 55
Created a script for price update on Purchasing Orders (PO's).
A problem occurs if price I'm trying to update is already same on the PO. Then there is nothing to save and Information popup windows appears saying "No data change". Here is where the script stops working as recording of the script is based on that new price is different and it can be saved.
I tried to add if statement to the code but it's not working. It doesn't save when the new price is different and it needs to be saved. It always chooses Enter and Else statement is not utilized.
session.findById("wnd[0]/tbar[0]/btn[11]").press 'Save on Menu bar
If session.ActiveWindow.Name = "wnd[1]" Then
If session.findById("wnd[1]").text = "Information" then
session.findById("wnd[1]/tbar[0]/btn[0]").press 'If popup and it's only Information type press Enter
objSheet.Cells(i, 3).Value = "No data changed" 'Information that no change has been done
Else
session.findById("wnd[1]/usr/btnSPOP-VAROPTION1").press 'Save in the popup window
objSheet.Cells(i, 3) = "Updated" 'Information that the new price has been updated
End if
Upvotes: 0
Views: 4017
Reputation: 55
By removing If session.ActiveWindow.Name = "wnd[1]" Then
the script works as it should
If session.findById("wnd[1]").text = "Information" then
session.findById("wnd[1]/tbar[0]/btn[0]").press 'If popup and it's only Information type then press Enter
objSheet.Cells(i, 3).Value = "No data changed" 'Information that no change has been done
Else
session.findById("wnd[1]/usr/btnSPOP-VAROPTION1").press 'Save in the popup window
objSheet.Cells(i, 3) = "Updated" 'Information that the new price has been updated
End if
Upvotes: 1