Declaring/using variables with barcode in EPL - variables

I am having some difficulty in using variables that I am declaring in a barcode statement using EPL (I have a zebra tlp 2844 printer).
Here is my code
N
q609
Q203,26
FK"GNLABEL"
FS"GNLABEL"
V00,3,N,"ENTER PROGRAM:"
V01,4,N,"ENTER YEAR:"
C0,6,N,+1,"-ENTER COUNTER VALUE:"
B10,10,0,3,1,3,50,B,**V00,V01"G"CO**
FE
FR"GNLABEL"
?
GNJ
2013
0
P1
When I send my file to the printer, I do not get a prompt for V00 or V01, and nothing prints out (just 1 blank label)

Looking over your code, it seems that a few things might need to be changed.
When you are recalling the form with FR, you are not specifying the form name. It will not know which form to recall without the name.
In your form, there is a ",CO" at the end of your barcode command. I believe what you are trying to do is place the counter digit at the end, C0 (I believe your code is using the capital letter O instead of the number 0). To do this, the comma should be removed.
Try using the following code:
N
q609
Q203,26
FK"GNLABEL"
FS"GNLABEL"
V00,3,N,"ENTER PROGRAM:"
V01,4,N,"ENTER YEAR:"
C0,6,N,+1,"-ENTER COUNTER VALUE:"
B10,10,0,3,1,3,50,B,"GNJ2013G"C0
FE
FR"GNLABEL"
?
GNJ
2013
0
P1
Hopefully this helps. Let me know if this solves your issue.

Related

Why can't I use FindElementByXPath on this table from a website?

I am currently working with webscraping on vba using selenium and chromedriver.
I log in a website (the website is, unfortunately, unreacheable due to a login necessity, but it's https://monitoring.csisolar.com/login), and within the main page, there is a general table with a bunch of info.
I used "inspect element" and identified the table object as in the image:
print of the found element, the table is highlighted
When I select "copy xpath", I get this: "//*[#id="mCSB_67_container"]/table"
Naturally, I set the command like this:
Set tabela = driver.FindElementByXPath("//*[#id="mCSB_67_container"]/table") 'Seleciona a tabela pelo java
If tabela Is Nothing Then
MsgBox "Não encontrado"
Else
tabela.AsTable().ToExcel (ActiveSheet.Cells(1, 1)) 'Cola a tabela na planilha (aba) onde está o botão
End If
but nothing is printed on excell.
I did the same thing in other similar sites (solarweb.com) and it went very well, but the table object had a id and class defined, while the one above has no attributes named (as seen on the print)
I know this question is not very clarified, but please comment below if there's something that can help you understand and I will gladly edit my question
Whatever is under the hood is creating dynamic ids. Your goal is to find selectors that don't change. Then use them to navigate down the DOM until you get to your table. In your small excerpt I don't see anything that's screaming unique id that never changes. If you only have one table visible you could just find it like this:
driver.findElement(By.cssSelector("table"));
mCSB_67_container seems to be a dynamically created id value i.e. this is not a fixed id value.
I'm not sure (need to see the actual page with dev tools), but you can try using this XPath instead:
Set tabela = driver.FindElementByXPath("//div[contains(#class,'mCustomScrollBox']//table")
Sometimes, it is hard locate the element,
if it is static table and dynamically updating values page. better right click and copy xpath given by chrome. that works efficiently. instead writing looping logic.
enter image description here
What is being tried on the question does not work because that table element is a dynamic object, so it's "id" and "class" attributes are not constant and cannot be referecend.
So, thanks to #Prophet and #David M, I discovered that I should be looking for a static reference instead, a part of the site's interface that wasnt dynamic, and then use that to reference said table.
The element I used was the division that contained the element, which had an ID of "plantList". Here's a screenshot of how I found this element:
In red, an arrow pointing to the table element, and in green, an arrow pointing to the statc element that I used to reference
From this point on, I just make my way through every other element until I reached the table. the final line is something like this:
Set canadian = driver.FindElementByXPath("//*[#id=""plantList""]/div[3]/div[1]/div[1]/div[2]/div[1]/div[1]/table") 'Seleciona a tabela pelo java
If canadian Is Nothing Then
MsgBox "Não Encontrado"
Else
canadian.AsTable().ToExcel (ActiveSheet.Cells(1, 1)) 'Cola a tabela na planilha (aba) onde está o botão
End If

In Adobe Acrobat Javascript, how can I force a page to become "editable" before a certain part of a script acts upon it?

What I'm trying to do: Iterate over each page in a PDF, and extract the number of words on each page.
What is happening instead: The code below will return 0 words for any page that has not become "editable". Although I have selected for all pages to become editable at once, Adobe will not maintain the editability of a page for very long after I have left that page. Side note: It also seems to cap how many pages I can have "editable" at once. This is a problem because right now I'm working with a 10 page selection of a pdf file. This same code will have to work with a 120+ page pdf. Please click 'Edit PDF'-->'Scanned Documents'-->'Settings' to see what I mean by "editable". I have already selected the option to have all pages become editable at once.
What I've tried so far: I've tried various ways to get Acrobat to make the page being iterated upon the "active one" so that it would become editable. I've tried manually setting the page number after each iteration of the for loop, and including an artificial delay like with the h variabled for loop in the sample code. I've tried looking for some sort of method that determines which page is the "active one" but I've had no luck so far.
CurrDoc = app.activeDocs[0]
CurrDoc.title;
NumPagesInDoc = CurrDoc.numPages;
console.println("Document has "+NumPagesInDoc+" pages");
for (j=0; j<NumPagesInDoc; j++)
{
NumWordsOnPage = CurrDoc.getPageNumWords(j);
CurrDoc.pageNum = j;
for(h=0; h<10000;h++); //<--I've tried adding in delays to give time so that
//Acrobat can catch up, but this hasn't worked.
console.println("Page number: "+j+" has this number of words: "+ NumWordsOnPage);
};
Output:
Document has 10 pages
Page number: 0 has this number of words: 309
Page number: 1 has this number of words: 0
Page number: 2 has this number of words: 0
Page number: 3 has this number of words: 0
Page number: 4 has this number of words: 0
Page number: 5 has this number of words: 0
Page number: 6 has this number of words: 0
Page number: 7 has this number of words: 0
Page number: 8 has this number of words: 0
Page number: 9 has this number of words: 158
true
Note: Different pages might work on the output at different times depending on which pages I've clicked on most recently before running the script.
Any guidance or help would be greatly appreciated. Thank you for your time.
So. I'm still not entirely sure what the issue is, but I've found a way to get acrobat to function most of the time.
Before clicking the "make all pages editable" option, zoom all the way out until you can see all the pages in the document. For whatever reason, when I did this, it would seem to refresh something about the settings and once again make all the pages editable. This even seemed to work when I opened a totally different pdf and pressed "make all pages editable" even without zooming out.

Unable to identify Web object in UFT for webpage?

SystemUtil.Run "iexplore.exe", "https://www.jetairways.com/EN/IN/Home.aspx"
wait (7)
Set traverse=Browser("Jet Airways: Airlines").Page("Jet Airways: Airlines")
traverse.WebEdit("placeholder:=From").Click
traverse.Link("acc_name:= This link will open Popup window for airport selection. ").WebElement("innerhtml:=All Airports","innertext:=All Airports","outerhtml:=<strong>All Airports </strong>").Click
traverse.WebTabStrip("html id:=ToC").Link("innerhtml:=Africa","innertext:=Africa").Click
Set oDesc = Description.Create
oDesc( "micclass" ).value = "Link"
oDesc( "href" ).value = "https://www.jetairways.com/EN/IN/Home.aspx#"
Set rc=Browser("creationtime:=0").Page("micClass:=page").ChildObjects(oDesc)
msgbox rc.count
UFT is not bale to identify the link, lets say, Johanesber or Port Elizabeth,etc
This is actually not working. Have tried many ways .
Can some one help me fix this?
The following code works for me, I cleaned up some of the spaces (and simplified the description a bit). I don't understand what you were trying to accomplish with the last lines of your script (counting the links).
I think the problem you were facing was probably to do with the fact that when you use descriptive programming (either inline with := or using a Description object), the values are used as regular expressions and not as plain strings. This means you have to escape regular expression characters (in this case ( and )) or else the values won't match.
Set traverse=Browser("Jet Airways: Airlines").Page("Jet Airways: Airlines")
traverse.WebEdit("placeholder:=From").Click
traverse.Link("acc_name:=This link will open Popup window for airport selection.").WebElement("html tag:=strong").Click
traverse.WebTabStrip("html id:=ToC").Link("innerhtml:=Africa","innertext:=Africa").Click
traverse.Link("innertext:=Port Elizabeth \(PLZ\)").Click ' Note \( and \)
Try to write the link object and the pop up window object in two different lines
traverse.Link("acc_name:= This link will open Popup window for airport selection. ")
traverse.WebElement("innerhtml:=All Airports","innertext:=All Airports","outerhtml:=<strong>All Airports </strong>").Click
also try to use Regex if the property values contains spaces or symbols.

Octave printf does not output when followed by ginput

I am trying to make a prompt for the user to select from the figure (plot).
When I run it with the code below, the prompt doesnt display until i click on the figure, after which the prompt displays and the code continues. In fact, no call to printf (or disp) that is called before the ginput call displays until i select the figure.
printf("Select part\n"); % (disp also doesnt work properly)
[xinput,yinput] = ginput(1);
The purpose of the prompt is to alert the user to move to the figure, so naturally it needs to display before selecting the figure.
I can add an extra redundant input call between the two which forces the printf to display in the console. eg input("Press Enter"). but this is an inconvenient solution.
Strangely, if you run just the code above it does work normally. But when running in the remainder of the program it displays the issue. So it may be a difficult one to debug. Also, running it one line at a time in the full code using the debugger works properly, displaying the prompt before selecting the figure.
Just to add to the confusion. When running this part of the program in a loop, the first instance doesnt display the prompt correctly, but every other instance it works.
Thanks
EDIT:
The following code reliably fails (for me) in the same way my full program fails; (edited again to simplify)
figure(1);
input_test = input("press 1: ");
switch input_test
case 1
while true
clc;
printf("Left click to get coords or right click to finish\n");
[xinput,yinput,mouse_button] = ginput(1)
if mouse_button == 3
break
endif
endwhile
endswitch
It appears it has something to do with the line;
input_test = input("press 1: ");
If I replace this with
input_test = 1;
it works properly.
I dont know what is the reason for this, and I cannot remove the input request from this location.
Thanks Roger, you were correct, I did find a solution.
Using
fflush(stdout)
before the 'ginput' call solves the problem.
Found this in the 'input' help;
"Because there may be output waiting to be displayed by the pager,
it is a good idea to always call 'fflush (stdout)' before calling
'input'. This will ensure that all pending output is written to
the screen before your prompt."

Autohotkey: Save variable into forum field

I am trying to write an autohotkey script to fill an online forum using COM. My problem is that the username is incremented by numbers, so ideally I want to loop the script to fill the form 5 or 6 times.
Here is the autohotkey part I am struggling with:
number := 28
username = user%number%
wb.document.all.getElementById(username).value := "username" ;HERE IS THE PROBLEM
number++
I have tried %username%, username without quotes, and with single quotes, and nothing seem to be working.
any ideas?
Thanks for your help.
First thing that popped out to me was all in you, I see Joe DF asked if you had tried without?
Second thing is you shouldn't have ""'s around your Variable.
If you are doing multiple assignments you can enclose them in ()'s like so:
:= (UserName "`n" Address "`n" PhoneNumber "`n" SocialSecurity)
If you are having problem's with a document not fully being loaded you can implement a custom loading routine like so:
wb.Navigate("Yourwebsite")
GoSub loading
.
.
.
loading:
ComObjError(false) ;turn off com errors
While value = "" {
value := wb.document.getElementsByClassname("somethingHere") [0].innerText
Continue
}
ComObjError(true)
Return
Without seeing more of your code and the website you are trying to work with, it will be difficult to help you further.
It worked... turns out it was the sleep time for the form to load. form was slower than Sleep 100 for some reason. Now, the form loads, but it is only taking 1 field. so password and email are not being filled.