scripting

Expect - get variable from screen region based on row and column

丶灬走出姿态 提交于 2019-12-20 02:12:30
问题 I'm auto-interacting with an SSH session and an ERP program using Expect. Rather than relying on a regular expression to capture a variable in my expect script would it be possible upon receiving a certain keystroke from a user to capture a screen region, say one field, into a variable in the code? Send the server some other commands and resend the field? Say an order number is contained at 6, 12, 6, 18 (where 6 is the row and 12-18 are the columns) containing my 6 digit order number. I want

Join lines based on pattern

若如初见. 提交于 2019-12-20 01:52:27
问题 I have the following file: test 1 My 2 Hi 3 i need a way to use cat ,grep or awk to give the following output: test1 My2 Hi3 How can i achieve this in a single command? something like cat file.txt | grep ... | awk ... Note that its always a string followed by a number in the original text file. 回答1: sed 'N;s/\n//' file.txt This should give the desired output when the content is in file.txt 回答2: paste -d "" - - < filename This takes consecutive lines and pastes them together delimited by the

VBScript CreateObject Google Chrome

本秂侑毒 提交于 2019-12-20 01:09:46
问题 I have this VBScript it works fine, no problem with script but I would like to open it in Chrome instead of IE. I am very very new to VB Scripting. Can someone please help me. WScript.Quit Main Function Main Set IE = WScript.CreateObject("InternetExplorer.Application", "IE_") IE.Visible = True IE.Navigate "http://gmail.com" Wait IE With IE.Document .getElementByID("login_username").value = "myuser" .getElementByID("login_password").value = "mypass" .getElementByID("frmLogin").submit End With

Counting characters in a specific text file

佐手、 提交于 2019-12-19 21:53:14
问题 I need to count the vocals, consonants and all other characters in a specific text file. I created a script that counts the vocals and consonants, but I can't figure out how to count the rest of the characters. The goal is to count ALL characters, even if they're from another language, like Icelandic characters and signs like comma, full stop and exclamation mark. Here's my current code: Clear-Host $vocal = (Get-Content C:\Users\Administrator\Desktop\POWERSHELL\testfil.txt | Select-String

Reading and writing global variables across scripts in PHP

痞子三分冷 提交于 2019-12-19 21:47:16
问题 Does PHP have global variables that can be modified by one running script and read by another? 回答1: No, by design PHP is a "share nothing" architecture, which means nothing is shared between processes running at the same time or between requests running one after another. There are ways to share data, but you have to do it explicitly. If you just want to share between 2 requests from the same user, sessions or cookies might be the way to go. If you want to share between multiple users, you

Scripting inside a Python application

有些话、适合烂在心里 提交于 2019-12-19 21:21:11
问题 I'd like to include Python scripting in one of my applications, that is written in Python itself. My application must be able to call external Python functions (written by the user) as callbacks . There must be some control on code execution; for example, if the user provided code with syntax errors, the application must signal that. What is the best way to do this? Thanks. edit : question was unclear. I need a mechanism similar to events of VBA, where there is a "declarations" section (where

Scripting inside a Python application

时光总嘲笑我的痴心妄想 提交于 2019-12-19 21:21:06
问题 I'd like to include Python scripting in one of my applications, that is written in Python itself. My application must be able to call external Python functions (written by the user) as callbacks . There must be some control on code execution; for example, if the user provided code with syntax errors, the application must signal that. What is the best way to do this? Thanks. edit : question was unclear. I need a mechanism similar to events of VBA, where there is a "declarations" section (where

Scripting and Programming [duplicate]

安稳与你 提交于 2019-12-19 19:43:50
问题 This question already has answers here : When is a language considered a scripting language? [closed] (40 answers) Closed 5 years ago . Where does Scripting ends and Programming begins? ActionScript 3 and JavaScript/JScript are so different... 回答1: The distinction was meaningful once, but the line is getting increasingly blurred to the point where I dont think it is useful today. historically, scripting languages are interpreted, programming langauages are compiled. But with the advent of VM

Debugging Groovy scripts running in a ScriptEngine from Eclipse

妖精的绣舞 提交于 2019-12-19 19:40:06
问题 I have a Groovy script which is run like this: File scriptFile = ...; ScriptEngine engine = ...; String script = FileUtils.readFileToString(scriptFile); Object evalResult = engine.eval(script, bindings); Unsurprisingly, breakpoint set in the script file doesn't trigger. What can I change to make it work? The script needs to be run in the context of the larger program (no separate launch configuration), and through a ScriptEngine , and the file is only known at runtime. 回答1: I'm using this

Validation detected dangerous client input - post from TinyMCE in ASP.NET

五迷三道 提交于 2019-12-19 18:53:26
问题 I get this error when I post from TinyMCE in an ASP.NET MVC view. Error: Request Validation has detected a potentially dangerous client input value, and processing of the request has been aborted From googling, it says to just add a validateRequest in the Page directive at the top which I did, but I STILL get this error. As you can see, below is my code in the view: <%@ Page validateRequest="false" Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc