Adding data to a datafile on separate lines

I have multiple lines of information I need to add to a datasheet but when writing to the datasheet will overwrite the existing information. I have tried “put 1 in seq” and would not work. I typically will have all the information on one line and will go down the list fine but this time I need to add several lines to each sequence.

I have some ideas around this, but I have a few questions:

  • Are you trying to write to Excel, and if so, are you writing to it as though it was a database (Example: set myExcelDB to {type: “excel”, file: “//.xlsx”})?

  • Are you trying to create a new record with the new data or append it to the existing data?

  • Could you provide a bit more code for your “put 1 in seq” example?

Thanks,
Dave

Thanks for the response. I think we got it to work. Anne was back to the rescue. Here is what we came up with.
//Start open Scotty…do only ONCE &^(&&^(&^(&^(&^(&^(&^(&^(&^(&^
typetext windowsKey
typetext {{
“C:\Program Files (x86)\Citrix\ICA Client\SelfServicePlugin\SelfService.exe” -launch -reg “Software\Microsoft\Windows\CurrentVersion\Uninstall\bswapps-73b3f2d4@@BSWEPIC715.Epic Non-Prod Sco-1” -desktopShortcut
}}
typetext return

//This window will open and will enlarge the screen
if ImageFound(text:“Teleport”, searchrectangle: (181,44,1075,644), waitfor: 130)
click Imagelocation(text:“Teleport”, searchrectangle: (181,44,1075,644))
//once in the login screen will need to enlarge the screen
typetext altkey, spacebar
typetext “x”
end if
//Finish opening Scotty…e…e…e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.

//putting the patient names into a group and assigning tabs to them
put (“Willow/Zzrxipmaster,Casey.ept”, “Willow/Zzrxipmaster,Henry.ept”) into ptname

//tab names
put (“Casey”, “Henry”) into tabname

///////repeat loop within each patient to ca//Logging into the scotty application

//will need to select import patients once the screen is maximized
typetext altkey, “i”
wait 2
typetext “ace11”, tab
set the nextkeydelay to .05

//generic credentials will be used here
typetext “eggadtpa”, tab
typetext “eggplant”
wait .2
if ImageFound(text:“Remember”, searchrectangle: (767,561,993,697), waitfor: 1)
click ImageLocation(text:“Remember”, searchrectangle: (767,561,993,697))
end if
typetext return

// a repeat can be inserted here until all of the patients have been completed
put 0 into seq
repeat with each patient in ptname
log item seq of ptname
log item seq of tabname
wait .02

typetext controlKey, "a"
//This is where we srt pulling in the patient name information. All we need is the name the patient ept file
//will need to configure to pull from the datasheet
typetext "/epic/nonprdfiles/app/training/scotty/"&(item (seq+1) of ptname)
wait .2
typetext return


//will wait for the fix issues to appear
WaitFor 222, (text:"Fix Issues",  searchrectangle: (4,70,488,456))--will need to figure how to work this because it may take alot of time to appear
//if ImageFound(text:"Fix Issues", searchrectangle: (4,70,488,456))pture data


//setting the batch info

typetext altkey, "b"
wait 1
typetext altkey, "I"
wait 1
typetext altkey, "b"
wait 1
typetext altkey, "u"
wait 2

//--------------00000000000000000-------------0000000000000000---------------0000000000

put keepCharacters(ReadText(5,269,45,287), "0123456789") into itemnum
log itemnum

set myDB to (file:ResourcePath("MST.xlsx"), type:"excel", writeable:"Yes")
set Patientdata to table (item seq of tabname) of mydb

click (200, 400)
typetext homeKey


repeat itemnum times
	
	put "" into patient
	
	Put itemnum into patient.Item_total
	
	Put the counter into patient.Item_Num        
	log "we are on" && the counter 
	
	put readtext (443,280,646,317) into INI_NUM

log INI_NUM
put INI_NUM into patient.INI_NUM

	put readtext (450,311,1540,348) into Item_name
	log Item_name
	put INI_NUM into patient.Item_name
	
	put readtext (448,342,1538,379) into Issue_type
	log Issue_type
	put INI_NUM into patient.Issue_type
	
	put readtext (493,381,1897,419) into How_to_fix
	log How_to_fix
	put How_to_fix into patient.How_to_fix
	
	
	put readtext (441,476,588,520) into Source_ID
	log Source_ID
	put Source_ID into patient.Source_ID
	
	put readtext (439,508,562,551) into Target_ID
	log Target_ID
	put Target_ID into patient.Target_ID
	
	
	put readtext (688,468,1894,519) into Source_Name
	log Source_Name
	put Source_Name into patient.Source_Name
	
	put readtext (684,517,1883,543) into Target_Name
	log Target_Name
	put Target_Name into patient.Target_Name
	
	add record patient to Patientdata
	
	typetext downArrow
end repeat
//add 1 to seq
If ImageFound(text:"Abort", searchrectangle: (24,918,458,1079), waitfor: 1)
	click ImageLocation(text:"Abort", searchrectangle: (24,918,458,1079))
	if ImageFound(text:"Scotty", searchrectangle: (746,383,1188,648),waitfor: 1)
		typetext return
	end if
	if ImageFound(text:"Teleport", searchrectangle: (9,15,367,205), waitfor: 10)
		typetext altkey, "i"
		typetext return
	end if
end if

end repeat

//Put Anne stuff here

//Start open Scotty…do only ONCE &^(&&^(&^(&^(&^(&^(&^(&^(&^(&^

(*
set myDB to (file:ResourcePath(“MST.xlsx”), type:“excel”, writeable:“Yes”)
set Patientdata to table (item seq of tabname) of mydb
set PTTAB to table (item seq of PTtabname) of mydb

set PTLIST to (file:ResourcePath(“MSTPT.xlsx”), type:“excel”, writeable:“Yes”)*)

//open pt list-
//
set myexcelfile to (workbook (ResourcePath(“MSTPT .xlsx”)))
log myexcelfile.worksheetnames
put myexcelfile.worksheetnames into Teamslist
log teamslist

//opening scotty via citrix
typetext windowsKey
typetext {{
“C:\Program Files (x86)\Citrix\ICA Client\SelfServicePlugin\SelfService.exe” -launch -reg “Software\Microsoft\Windows\CurrentVersion\Uninstall\bswapps-73b3f2d4@@BSWEPIC715.Epic Non-Prod Sco-1” -desktopShortcut
}}
typetext return

//This window will open and will enlarge the screen
if ImageFound(text:“Teleport”, searchrectangle: (181,44,1075,644), waitfor: 130)
click Imagelocation(text:“Teleport”, searchrectangle: (181,44,1075,644))
//once in the login screen will need to enlarge the screen
typetext altkey, spacebar
typetext “x”
end if
//end of open scotty

//logging into scotty
typetext altkey, “i”
wait 2
typetext “ace11”, tab
set the nextkeydelay to .05

//generic credentials will be used here
typetext “eggadtpa”, tab
typetext “eggplant”
wait .2
if ImageFound(text:“Remember”, searchrectangle: (767,561,993,697), waitfor: 1)
click ImageLocation(text:“Remember”, searchrectangle: (767,561,993,697))
end if
typetext return

repeat with each item team of teamslist
log “working on tab” && team&&“of the MSTPT sheet”
//this is where the mst file for the patient data
set myDB to (file:ResourcePath(“MST_”&Team&".xlsx"), type:“excel”, writeable:“Yes”)
log mydb

//This opens up the tab with the list of patients
set currenttable to myexcelfile.worksheet(team)
log currenttable.cellrange ("A") &&"of MSTPT file variable = currenttable.cellrange"
put currenttable.cellrange ("A") into PTLIST1

//need to strip brackets and " off of iems of ptlist"

//need to past the full patient file name into scotty to pull the pt information
repeat with each item ptdirect of ptlist1
	put item 1 of ptdirect into ptdirect--cellrange returns list and this removes the list
	typetext controlkey, "a"
	typetext  "/epic/nonprdfiles/app/training/scotty/"&Team&"/"& ptdirect
	wait .2
	typetext return
	(*	end repeat--testing remove

end repeat–testing remove*)
//will wait for the fix issues to appear this needs to go after the ept file has been selected
WaitFor 222, (text:“Fix Issues”, searchrectangle: (4,70,488,456))–will need to figure how to work this because it may take alot of time to appear
//repeat with each item ptmaster of ptlist1
put characters (the character number of “,” within ptdirect) + 1 to (the character number of “.” within ptdirect) - 1 of ptdirect into ptname
log ptname
set pttab to ()
set pttab to table (ptname)of mydb
typetext controlKey, “a”

	//setting the batch info
	
	typetext altkey, "b"
	wait 1
	typetext altkey, "I"
	wait 1
	typetext altkey, "b"
	wait 1
	typetext altkey, "u"
	wait 2
	
	//--------------00000000000000000-------------0000000000000000---------------0000000000
	
	put keepCharacters(ReadText(5,269,45,287), "0123456789") into itemnum
	log itemnum
	
	click (200, 400)
	typetext homeKey
	
	repeat itemnum times
		
		put "" into patient
		
		Put itemnum into patient.Item_total
		
		Put the counter into patient.Item_Num        
		log "we are on" && the counter 
		
		put readtext (443,280,646,317) into INI_NUM
		log INI_NUM
		put INI_NUM into patient.INI_NUM
		
		put readtext (450,311,1540,348) into Item_name
		log Item_name
		put Item_name into patient.Item_name
		
		put readtext (448,342,1538,379) into Issue_type
		log Issue_type
		put Issue_type into patient.Issue_type
		
		put readtext (494,375,1919,455) into How_to_fix
		log How_to_fix
		put How_to_fix into patient.How_to_fix
		
		put readtext (441,476,588,520) into Source_ID
		log Source_ID
		put Source_ID into patient.Source_ID
		
		put readtext (684,470,1906,515) into Source_Name
		log Source_Name
		put Source_Name into patient.Source_Name
		
		put readtext (439,508,562,551) into Target_ID
		log Target_ID
		put Target_ID into patient.Target_ID
		
		
		put readtext (688,468,1894,519) into Source_Name
		log Source_Name
		put Source_Name into patient.Source_Name
		
		put readtext (684,517,1883,543) into Target_Name
		log Target_Name
		put Target_Name into patient.Target_Name
		
		add record patient to pttab
		
		typetext downArrow
	end repeat
	
	If ImageFound(text:"Abort", searchrectangle: (24,918,458,1079), waitfor: 1)
		click ImageLocation(text:"Abort", searchrectangle: (24,918,458,1079))
		if ImageFound(text:"Scotty", searchrectangle: (746,383,1188,648),waitfor: 1)
			typetext return
		end if
		if ImageFound(text:"Teleport", searchrectangle: (9,15,367,205), waitfor: 10)
			typetext altkey, "i"
			typetext return
		end if
	end if
end repeat

end repeat
//end of annes code