Answered step by step
Verified Expert Solution
Question
1 Approved Answer
import pyzipper import os import subprocess import json import time import tempfile from urllib.parse import quote from datetime import datetime, timezone import tkinter as tk
import pyzipper
import os
import subprocess
import json
import time
import tempfile
from urllib.parse import quote
from datetime import datetime, timezone
import tkinter as tk
from tkinter import messagebox, scrolledtext
def getuserinput:
startuserinput inputtext.get tkEND
return startuserinput
def startautomationjobtype startautomations, startinputselection, username, version:
startinputmessage 'Please select the number of the automation you wish to jobtype or choose strlenstartautomations to CANCEL.
for index, item in enumeratestartautomations:
startinputmessage findexitem
startinputmessage 'Your choice:
outputtext.inserttkEND, startinputmessage
outputtext.updateidletasks
outputtext.yviewtkEND
startuserinput getuserinput
printstartuserinput
def excecuteautomationjobtype:
# get os system username and covert it to lower
username osgetloginlower
todaysdate datetime.todaydate
formattedtodaysdate todaysdate.strftimemdYstrip
# File path to z application to unzip file with json
zpath rC:Program FilesZipzexe"
# File path to zipped folder with nodejs files and nodes packages
zippedfile rH:TESTStart.zip'
#rTESTStart.zip'
# password to zipped file
passwd 'password
# use pyzipper to read file in zipped folders as archive folder
with pyzipper.AESZipFilezippedfile, moder as archfolder:
# pass password to password above protected zipped folder
archfolder.setpasswordpasswdencodeutf
# Create a variable to TESTStartUserList js file to read
userlistnodepath 'TESTStartTESTStartUserList.js
# open js file called UserList.js from archived folder
with archfolder.openuserlistnodepath as userlist:
# read TESTStartUserList.js and covert it to dictionary
data userlist.readdecodeutf
dataresults datadatafind : data.find
dataformatted dataresults.replacereplace
replace::
# Convert string above into a json object
dataloads json.loadsdataformatted
if username not in dataloads:
outputtext.inserttkEND, 'Sorry, you are NOT AUTHORIZED to jobtype any automations'
outputtext.updateidletasks
outputtext.yviewtkEND
return
for key, value in dataloads.items:
# if the key in the userlist object above matches the os username
if key username:
# initialize values to value paired with key above
values value
version
startautomations values Cancel
startinputselection
if jobtype "start":
startautomationjobtype startautomations, startinputselection, username, version
return jobtype, startautomations, startinputselection, username, version
if jobtype "stop":
stopautomationjobtype username, formattedtodaysdate, zpath, zippedfile, passwd, version
return jobtype, username, formattedtodaysdate, zpath, zippedfile, passwd, version
root tkTk
root.titleStart or Stop Automation via UiPath Orchestrator API"
startstoplabel tkLabelroot textDo you want to start or stop an automation?"
startstoplabel.packpady
buttonframe tkFrameroot
buttonframe.packpadx pady
startbutton tkButtonbuttonframe, text "start", command lambda:excecuteautomationstart
startbutton.packsidetkLEFT, padx pady
stopbutton tkButtonbuttonframe, text "stop", command lambda: excecuteautomationstop
stopbutton.packsidetkRIGHT,padx pady
outputtextframe tkFrameroot
outputtextframe.packpady
outputtextscrollbar tkScrollbaroutputtextframe
outputtextscrollbar.packsidetkRIGHT, fill tkY
outputtext tkTextoutputtextframe height width yscrollcommand outputtextscrollbar.set
outputtext.pack
outputtextscrollbar.configcommandoutputtext.yview
inputtext tkTextoutputtextframe, height width yscrollcommand outputtextscrollbar.set
inputtext.pack
inputbutton tkButtonoutputtextframe, text"Make Selection", command getuserinput
inputbutton.packsidetkRIGHT, padx pady
root.mainloop
I am unable to use inputtext as a variable in start automation
please fix the whole code
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started