Programming

53K

Solutions

41K

Contributors

Programming includes both the specifics of the language you’re using, like Visual Basic, .NET, Java and others, but also the best practices in user experience and interfaces and the management of projects, version control and development. Other programming topics are related to web and cloud development and system and hardware programming.

Hello,
I am looking for a vbscript to find files with filenames of a certain length within one folder
and
another vbscript to delete files with filenames of a certain length within one folder
0
Hello experts,

I have in my AutoHotkey/Hotstring file multiple hotstrings that sendinput date.

I would like to convey them into a single hotstring and modulate them through a GUI.

The idea is the following:

 20200218_042035.png
Could you please help me to:

Set up the process behind to sendinput based on the selection.
I attached current version.

Thank you for your help.
DatesGui.ahk
1
Hi
I am willing to test face recognition on a sample set of images, to check their quality. The basic idea is to have around 1000 images of people and send the to the app and the test if a specific image is there or not. But I would like to avoid any programming.

Does anyone know an app that I could use?
0
C#: Please explain relationship between "async" and "await"

I generally see how this code works:

https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/async/

but need a better understanding of when to use both "async" and "await" together. I was a little confused by the transition of one paradigm to the the better paradigm in this one example...so, a simple explanation would be helpful.

Thanks.
0
I have a Barcode scanner Datalogic wich connects to usb with a dedicated driver wich  generates e.g.   COM5   as port
in my software i read by second COM5 and when data arrives get  it in  sofar no problem use to do this for 25 years on real rs232 ports ,hard to find these days

My problem is that Windows(10)   e.g. after one off their ''great'''updates at nigh the usb connection as sample on COM4 instead of keeping COM5  sets

So i need some script/commandline/utilliy wich i can call when needed instead of opening config/devices/ports(Com & LPT)  to see what the new port is
 Port has always same name   Barcode Scanner(COMx)    so from a listing to create somehow I can see if at one moment COM5 went to COM4
all i have to do then is in software close 5  reopen 4
program  is  VB6
usbnames.png
0
Hello experts,

The following AutoHotkey script allows me to list files and folders based on folder reported.

;====================================
;Gui: list files and folders attributes
;====================================

^+f::
Gui,Add,Text,xm,Select folder for file listing:
Gui,Add,Edit,vFolderPath w400
Gui,Add,Text,,Select folders to process:
Gui,Add,Radio,Checked vRecurse,&Recurse
Gui,Add,Radio,x+10,&NoRecurse
Gui,Add,Text,xm,Select information to put in file listing:
Gui,Add,Radio,Checked vFileInfo,&Filename (without path)
Gui,Add,Radio,x+10,Filename with &Path
Gui,Add,Button,xm gButtonOKFilesFoldersListing Default,&OK
Gui,Add,Button,x+10 gButtonCancelFilesFoldersListing,&Cancel
Gui,Show,,File Listing
Return

ButtonOKFilesFoldersListing:
Gui,Submit
If (SubStr(FolderPath,0,1)!="\")
  FolderPath:=FolderPath . "\"
FormatTime,CurrentDateTimeFilesFolders,,yyyyMM
TempFile:=FolderPath . CurrentDateTimeFilesFolders . "_listing.txt"
FileList:=""
If (Recurse=1)
{
		LoopMode:="FDR"
}
Else
{
		LoopMode:="FD"
}
FileList:=""
Loop,Files,%FolderPath%*.*,%LoopMode%
{
  If (FileInfo=1)
		{
    FileList:=FileList . A_LoopFileName . "`n"
  }
		Else
		{
    FileList:=FileList . A_LoopFileFullPath . "`n"
		}
}
Msgbox,,,LoopMode:%LoopMode% `nFileInfo:%FileInfo%
Clipboard:=FileList
ClipWait,2 ; wait for information to appear on clipboard
If (ErrorLevel=1)
{
		MsgBox,4144,Error,No text appearing after 2 seconds
		Return
}
Sort,FileList
FileDelete,%TempFile%

Open in new window

1
Hello,
I want to find the largest prime of a given number.
This is my solution.
I don't like my solution because I change the variable i in the for loop.
Is there an better solution?


public class LargestPrime {

    public static int getLargestPrime(int number){
        if(number<=1){
            return -1;
        }
        int lpn=number;
        for(int i=2;i<=number;i++){
            if(number%i==0){
                lpn=i;
                number/=i;
                i=i-1;
            }
        }
        return lpn;
    }

    public static void main(String[] args) {
       System.out.println(getLargestPrime(16));
    }
}

Open in new window

0
Hello experts,
I am trying to set up a file listing through an AutoHotkey GUI.
Here are the requirements:
Through a GUI report folder path in which will be generated the file.
List files in a new file and open it.
The final need is to add the following new features:
-File name and file full path differentiation
-Immediate and recurse differentiation
I am quite sure that the best approach for this is radio. However prior to propose something I would like to know:-
-If code structure is ok or should I review it.
-What is the best option to create the 2*2 differentiation.
Functions with switch case?
The differentiation is based on the:
Loop, Files, %FolderPath%\*.*, FD, R ; for recurse, blank for immediate
FileList = %FileList%% A_LoopFileName %`n; for file name
FileList = %FileList%% A_LoopFileFullPath %`n; for file full path

I am aware that I need to do some file tuning and add the controls. However I will do it following your recommendations.

I attached my initial version.

Thank you for your help.
AppendFilesList.ahk
1
I have a FIREBIRD  data base connected by OBDC

Using VB6 i can call  customer data wich is in 2 tables located

first call    SELECT * FROM stammkunde where KUNDENNR = '         7'
will return  only the name  and phone and of customer and email in that table
and a second key     ADRKUNDID  value  to use in next call  

to make second call to other tabel  stammadresse
SELECT * FROM stammadresse  where  ADRESSID  =  ADRKUNDID



 this second table stammadresse contains

STRASSE  from   (stammadresse    street
PLZ            (from  (stammadresse    Zip
ORT           (from  (stammadresse    City
etc.

I need to update in both table the here showed fields with new data
please advise teh syntax for both SQL 's   to realize this update in VB6
Thanks
0
Hi all,

I have a vulnerability that is preventing my frontend's automated build.

I did a npm update and bower update, this caused new versions of dependencies to be included in my package.json and bower.json, all fine.

If I try the build the dependency error is still showing in two different locations:
node_modules/polymer-cli/node_modules/handlebars/dist/handlebars.js - v4.1.2

and

node_modules/bower/lib/node_modules/handlebars/dist/handlebars.js - v4.0.10

I don't understand why those versions were not updated even if I specifically requested the latest version for polymer-cli and bower.
I've searched everywhere in the codebase but I couldn't find any reference to those versions to update them.

Can you please help?
0
Hello experts,

I am trying to find a mechanism through AutoHotkey=>Gui to repeat reported text based on iterations.
Here is my attempt:

Gui, Add, Text,,Text to iterate:
Gui, Add, Text,, Number of iterations:
Gui, Add, Edit, vTextReported ym  ; The ym option starts a new column of controls.
Gui, Add, Edit, vIterationsReported
Gui,Add,Button,xm gButtonOKEx Default,&OK
Gui,Add,Button,x+10 gButtonCancelEx,&Cancel
Gui, Show,, Iterate text
Return

ButtonOKEx:
Gui, Submit
Loop, Parse, TextReported, `n, `r
{
	TextReported2:=A_LoopField . "`n"
}
TextReported3:=RepeatText(TextReported2, IterationsReported)
MsgBox,,,%TextReported3%
Clipboard:=TextReported3
ClipWait,2 ; wait for information to appear on clipboard
If (ErrorLevel=1)
{
	MsgBox,4144,Error,Information did not appear on clipboard after two seconds
	Return
}
ButtonCancelEx:
Gui,Destroy
Return

;====================================
;Function used to repeat string
;====================================

RepeatText(string,times)
{
	loop %times%
		output .= string
		return output
}

Open in new window


Could you please provide some advice on the following:
1.Is there a better approach to repeat text? If so could you please help me to set up a function
2.Controls to set up can be related to text reported. If TextReported="" return? and if IterationReported is not numeric return? For the second I need a check through var is type as reported at:
here
or another approach is better?
3.I would like to modulate the repeat action with two options, repeat text at the same line or in a new line ie : TextReported2:=A_LoopField . "`n" to have text repeat in another line or through TextReported2:=A_LoopField .  A_Space to have it in the same line. Gui Radio is the best option to cover this need?
4.If you have some advice on the AutoHotkey structure reported above, please let me know.

Thank you in advance for your help.

Regards,
Luis.
1
Hi, I am an old programmer so that's why I will ask a question that can be considered dummy for the modern colleagues.

I have an idea on a system I would like to develop, know everything that is required functionally and know how would it be done... In the old days (html, sql, etc.)

But I am fully aware the technologies have changed, and changed a lot! So I need an advise on what modern technologies to use.

These are my questions:
1. Allow users to connect from anywhere on internet.: So I supposed It should be a cloud based system.
2. Programming lang: This worries me the most! If I develop a system in C#.Net with SQL server, is it easy to move it to the cloud? or Should I develop with Azure SQLfrom the beginning?
3. If I develop the software for the Microsoft Cloud, is it easy to use it in other cloud platforms like Amazon o Google? or should I have to develop in different languages?
4. Is there a programming lang I can use to develop once and use it for Microsoft Cloud, Amazon and Google platfomrs, also?
5. Is it recommended to use C#.Net for the cloud?
0
hello, all

i have an existing ( a little incomplete ) api that allows to send asynchronous calls to a remote resource ( a mysql server over raw sockets without any of the php extensions should that matter ) which allows to send multiple parallel queries to the sql server over regular selectable streams. i know some mysql extensions allow that. i need a regular stream because i want to use other stream resources in the same select loop.

i was thinking i might derive one or several tcp wrapper(s), partly because i'd like a simpler api, and partly because i just happen to like the idea of fopen()ing an sql query to a server

unfortunately, it does not seem that any mechanism would allow a stream_select() call to work properly with such custom wrappers and there is zero use for my api unless it is stream_select()able. it is currently. but not through a wrapper.

nevertheless, some of php's builtin wrappers are properly selectable

is that somehow feasible  with some builtin php mechanics i am unaware of ?
do these wrappers simply push data to descrete files or descriptors in separate threads and let the kernel handle the select, epoll, or whatever mechanism ? ( which is what i would guess )

thanks for sharing your knowlege.

please do not discuss how usefull/useless that is : this is besides the point unless you know of a way to miraculously grab the derived stream resource from mysqli, pdo, or whatever resource

i am obviously also interested in an existing …
0
Hello experts,

I set up the following AutoHotkey script in order to retain or remove lines from a clipboard based on string reported in the GUI.

+^r::
AddTextEditWidth:=400
Gui,Add,Text
Gui,Add,Text,xm,Which operation to you want to performed?
Gui,Add,Radio,Checked vWhichOp xm,Retain
Gui,Add,Radio,x+20,Remove
Gui,Add,Text
Gui,Add,Text,xm,Enter the string related to retain or remove operation (or click Cancel not to add text):
Gui,Add,Edit,vAddTextRetainRemove xm w%AddTextEditWidth%
Gui,Add,Text
Gui,Add,Button,xm gButtonAddTextRetainRemoveOK Default,&OK
Gui,Add,Button,x+10 gButtonAddTextRetainRemoveCancel,&Cancel
Gui,Show,,Add text
Return

ButtonAddTextRetainRemoveOK:
Gui,Submit
Gui,Destroy
Send, ^c
ClipWait,1
If (ErrorLevel=1)
{
  MsgBox,4144,Error,No text appeared on clipboard after initial Ctrl+c and waiting for one second
  Return
}
Else
ReferenceString:=AddTextRetainRemove
NewClipboardVar:=""
Loop,Parse,Clipboard,`n,`r
If (WhichOp=1) 
{
  If InStr(A_LoopField, ReferenceString)
    NewClipboardVar:=NewClipboardVar . A_LoopField . "`n"
}
Else
{
  If InStr(A_LoopField, ReferenceString)
    Continue
    NewClipboardVar:=NewClipboardVar . A_LoopField . "`n"
}
LastChar:=SubStr(NewClipboard,0,1) ; see if last char is CR or LF
If ((LastChar="`r") or (LastChar="`n"))
{
  StringTrimRight,NewClipboard,NewClipboard,1 ; last char is CR or LF - remove it
  LastChar:=SubStr(NewClipboard,0,1) ;  see if new last char is CR or LF
  If ((LastChar="`r") or (LastChar="`n")) ;
    

Open in new window

1
how to set a value to registry in Vb6
got a error on setting a value to registry syntax

  'Change the keyboard type and show it
    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) 'Handles Button6.Click
        'Change the Registry entry for the required keyboard
        My.Computer.Registry.SetValue("HKEY_CURRENT_USER\Software\ComfortSoftware\hvk", "KeyboardName", "Name of your chosen keyboard")
        'Open the keyboard
        Dim hWnd As Integer
        hWnd = FindWindow("TFirstForm", "hvkFirstForm")
        Call PostMessage(hWnd, WM_CSKEYBOARD, 1, 0)
    End Sub
keybod-set.png
0
listing in vb6 with errorTrying to get some calls running in VB6 to use Postmessage  Function
This is a call to the functions in a program wich now i can now only use bij shelling to commandline ,
like   Shell "J:\VIRT_KEYBORD\MOVETOPKB  ", vbHide
Utillity from  https://hot-virtual-keyboard.com/

According their on-site manal  should be possible to do like this


Const WM_CSKEYBOARD = &H400 + 192
Const WM_CSKEYBOARDMOVE = &H400 + 193
Const WM_CSKEYBOARDRESIZE = &H400 + 197
 
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Integer
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hWnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, _
         ByVal lParam As Integer) As Integer



    'Move Hot Virtual Keyboard in Visual Basic; Move it first then show itresponse helpdesk    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) ' Handles Button3.Click
        Dim hWnd As Integer
        hWnd = FindWindow("TFirstForm", "hvkFirstForm")
        PostMessage(hWnd, WM_CSKEYBOARDMOVE, 200, 200)
        PostMessage(hWnd, WM_CSKEYBOARD, 1, 0)
    End Sub

But calls to postmessga gives in Editor red syntax status
Support desk from supplier could not help me out on this

please see the attachd file from program listing and response helpdesk wich does not sove my problem

Thanks for help
0
Hello experts,

The following AutoHotkey allows me to add line number based on selection.

;====================================
;Add line numbers at the beginning of each line
;====================================
#If (!WinActive("ahk_exe excel.exe"))
^+l:: ; Ctrl+Shift+L - as always, make it whatever you want
SkipBlankLines:=True
MsgBox,4131,Do you want to number blank lines?,Press YES to number the blank lines`n`nPress NO not to number the blank lines`n`nPress CANCEL to exit/quit (not do any numbering)
IfMsgBox,Cancel
  Return
IfMsgBox,Yes
  SkipBlankLines:=False
Sleep, 50
Send, ^c
Sleep, 50
ClipWait,1
If (ErrorLevel=1)
{
  MsgBox,4144,Error, No text appearing after one second
  Return
}
LineNum:=0
ClipboardVar:=Clipboard
UpdatedLines:=""
Loop,Parse,ClipboardVar,`n,`r
{
  If ((A_LoopField="") and (SkipBlankLines))
    LineNumOut:=""
  Else
  {
    LineNum:=LineNum+1
    LineNumOut:=LineNum . "."
  }
  UpdatedLines:=UpdatedLines . LineNumOut . A_LoopField . "`n"
}
LastChar:=SubStr(UpdatedLines,0,1) ; see if last char is CR or LF
If ((LastChar="`r") or (LastChar="`n"))
{
  StringTrimRight,UpdatedLines,UpdatedLines,1 ; last char is CR or LF - remove it
  LastChar:=SubStr(UpdatedLines,0,1) ;  see if new last char is CR or LF
  If ((LastChar="`r") or (LastChar="`n")) ;
    StringTrimRight,UpdatedLines,UpdatedLines,1 ; new last char is CR or LF - remove it
}
Clipboard:=UpdatedLines
Sleep, 50
Send, ^v
Return
#If

Open in new window


I would like to take as a reference to cover the following need:
1.Display a msgbox or a Gui with two options: 1 add string at the beginning 2 at the end
2.Display a second inputbox to report the string to add
3.Insert the string and replace the selection by revised text
Example:
1.I select the following text:
Text text
Text text
Text text
2.I Select 1 for adding text at the beginning
3.I enter the following string: 20200203_163112
4.The previous text will be replaced as following:
20200203_163112Text text
20200203_163112Text text
20200203_163112Text text

If you have questions, please contact me.

Thank you for your help.
0
Hi Experts,

I have the following code to avoid users entering "N/A" on a required field.

Now would like to add restriction of saving just space characters.

Thanks

$(":input[required]:visible").on("change", function() {
    var id = $(this).attr("id");
    var isName = id.indexOf("Last_Name")>0 || id.indexOf("First_Name")>0;
    var rgx =  isName ? /.*?N.*\/.*A/gi : /.*?N.*?A/gi;
    if($(this).val().length<6 && rgx.test($(this).val()) ) {
        $(this).val("");
        alert("N/A is not a valid input");
        var that = $(this);
        setTimeout(function(){
            that.focus();
        },350);
    }
});

Open in new window

0
Hello experts,

I have the following AutoHotkey to open my AutoHotkey file.

;====================================
;Open AutoHotkey file
;====================================
#If (!WinActive("ahk_exe excel.exe") or (!WinActive("ahk_exe SciTE.exe")))
+F2::
AhkFile:=A_ScriptFullPath
If (FileExist(SciTE1))
  Run, "%SciTE1%" "%AhkFile%"
Else
If (FileExist(SciTE2))
  Run, "%SciTE2%" "%AhkFile%"
Else
  MsgBox,4112,Error,Neither SciTE exists on your system.
Return
#If

Open in new window


I don't understand why the restriction is not applied when I launch the script from excel or SciTe.

The restriction works when I launch the AutoHotkey script from excel:

;====================================
;Open AutoHotkey file
;====================================
#If (!WinActive("ahk_exe excel.exe"))
+F2::
AhkFile:=A_ScriptFullPath
If (FileExist(SciTE1))
  Run, "%SciTE1%" "%AhkFile%"
Else
If (FileExist(SciTE2))
  Run, "%SciTE2%" "%AhkFile%"
Else
  MsgBox,4112,Error,Neither SciTE exists on your system.
Return
#If

Open in new window


Thank you for your help.
0
Hello Experts,

The following AutoHotkey function allows to select files attributes / components.
GetSelectedFile(hwnd:="",FileComponents:=1,GetDate:=1) {
; this function by sinkfaze: https://www.autohotkey.com/boards/viewtopic.php?f=6&t=77#p395
  WinGet, process, processName, % "ahk_id" hwnd := hwnd? hwnd:WinExist("A")
  WinGetClass class, ahk_id %hwnd%
  if  (process = "explorer.exe")
    if  (class ~= "Progman|WorkerW") {
      ControlGet, files, List, Selected Col1, SysListView321, ahk_class %class%
      Loop, Parse, files, `n, `r
        ToReturn .= A_Desktop "\" A_LoopField "`n"
    }
    else  if (class ~= "(Cabinet|Explore)WClass") {
      for window in ComObjCreate("Shell.Application").Windows
        if  (window.hwnd==hwnd)
          sel :=  window.Document.SelectedItems
      for item in sel
      {
        FileFullPath:=item.path
        If (FileComponents=1)
          FileParts:=FileFullPath
        If (FileComponents=2)
          SplitPath,FileFullPath,,,,FileParts
        If (FileComponents=3)
          SplitPath,FileFullPath,FileParts
        If (GetDate>1)
        {
          ToReturn .= DateParse(item.ModifyDate) . A_Tab . FileParts . "`n"
          If (GetDate=2)
            Sort,ToReturn ; GetDate=2 --> modified date sorted ascending
          Else
            Sort,ToReturn,R ; GetDate=3 --> modified date sorted descending
        }
        else
          ToReturn .= FileParts "`n" ; GetDate=1 --> no date/sort
      }
    }
    return  

Open in new window

0
Hello experts,

The following AutoHotkey related to the article: https://www.experts-exchange.com/articles/29416 allows me to copy link to clipboard.

F5::
WinGetTitle,ActiveTitle,A ; get title of active window
IfInString,ActiveTitle,Mozilla Firefox ; check if active window is Firefox
 ShortcutKey:="a" ; send letter "a", Firefox shortcut for Copy Link Location
Else ; it is not Firefox
IfInString,ActiveTitle,Google Chrome ; check if active window is Chrome
 ShortcutKey:="e" ; send letter "e", Chrome shortcut for Copy Link Address
Else ; it is not Chrome
IfInString,ActiveTitle,Internet Explorer ; check if active window is IE
 ShortcutKey:="t{Enter}" ; send letter "t", IE shortcut for Copy Shortcut, but also needs Enter
Else ; it is not IE
IfInString,ActiveTitle,Opera ; check if active window is Opera
 ShortcutKey:="e" ; send letter "e", Opera shortcut for Copy Link Address
Else ; it is not Opera
{
 MsgBox,4112,Error,Active window is not a supported browser.
 Return ; 4112 above means put dialog on top and give it the red X (error/stop) icon
}
Clipboard:="" ; empty the clipboard
MouseClick,Right ; right-click at current mouse location
Sleep,60 ; wait for 60 milliseconds to make sure context menu is there
SendInput,%ShortcutKey% ; send shortcut to copy link
ClipWait,2 ; wait at most 2 seconds for short link to appear in clipboard
If (ErrorLevel=1) ; ErrorLevel set to 1 when wait period expires
{
 

Open in new window

0
Hello experts,

The following AutohotKey scripts allows me to copy files attributes based on selected files
;====================================
;Copy files attributes
;====================================

+F1::
Gui,Add,Radio,Checked vComponents xm,FileNoPathWithExt
Gui,Add,Radio,x+20,FileNoPathNoExt
Gui,Add,Radio,x+20,FileFullPath
Gui,Add,Button,xm Default,&OK
Gui,Add,Button,x+20,&Cancel
Gui,Show,,Copy to Clipboard
Return

ButtonOK:
Gui,Submit
Gui,Destroy
If (!WinActive("ahk_class CabinetWClass"))
{
  MsgBox,4144,Error,Active window is not Windows/File Explorer
  Return
}
AllFileComponents:=""
SelectedFiles:=GetSelectedFile("",False)
If (SelectedFiles="")
{
  MsgBox,4144,Error,No files are selected in Windows/File Explorer
  Return
}
Switch Components
{
  Case 1:
  Loop,Parse,SelectedFiles,`n,`r
  {
    FileFullPath:=A_LoopField
    SplitPath,FileFullPath,FileNoPathWithExt
    AllFileComponents:=AllFileComponents . FileNoPathWithExt . "`n"
  }
  Case 2:
  Loop,Parse,SelectedFiles,`n,`r
  {
    FileFullPath:=A_LoopField
    SplitPath,FileFullPath,,,,FileNoPathNoExt
    AllFileComponents:=AllFileComponents . FileNoPathNoExt . "`n"
  }
  Case 3:
  Loop,Parse,SelectedFiles,`n,`r
  {
    FileFullPath:=A_LoopField
    AllFileComponents:=AllFileComponents . FileFullPath . "`n"
  }
}
Clipboard:=AllFileComponents
ClipWait,2 ; wait for information to appear on clipboard
If (ErrorLevel=1)
  MsgBox,4144,Error,Information did not appear on clipboard after two seconds
Return

Open in new window

0
Hello experts,

The following AutoHotkey scripts allows me to remove extra lines and extra spaces:
;====================================
;Remove two consecutive extra lines
;====================================

^!Space::
Send ^c
ClipWait,1
If (ErrorLevel=1)
{
  MsgBox,4144,Error,No text appeared on clipboard after initial Ctrl+c and waiting for one second
  Return
}
PreviousLineBlank:=False
NewClipboard:=""
Loop,Parse,Clipboard,`n,`r
{
  CurrentLine:=A_LoopField
  CurrentLineWithoutBlanks:=StrReplace(CurrentLine,A_Space) ; remove all spaces
  CurrentLineWithoutBlanks:=StrReplace(CurrentLineWithoutBlanks,A_Tab) ; remove all tabs
  If (CurrentLineWithoutBlanks="") ; see if current line is blank
  {
    If (PreviousLineBlank) ; current line is blank - see if previous one is
      Continue ; a consecutive blank line, so do not include it
    Else
    {
      NewClipboard:=NewClipboard . CurrentLine . "`n" ; not a consecutive blank line, so include it
      PreviousLineBlank:=True
    }
  }
  Else
  {
    NewClipboard:=NewClipboard . CurrentLine . "`n" ; current line is not blank, so include it
    PreviousLineBlank:=False
  }
}
LastChar:=SubStr(NewClipboard,0,1) ; see if last char is CR or LF
If ((LastChar="`r") or (LastChar="`n"))
{
  StringTrimRight,NewClipboard,NewClipboard,1 ; last char is CR or LF - remove it
  LastChar:=SubStr(NewClipboard,0,1) ;  see if new last char is CR or LF
  If ((LastChar="`r") or (LastChar="`n")) ;
    

Open in new window

0
Hello experts,

The following AutoHotkey script allows me to add specific character at the beginning of each line:

;====================================
;Add specific character at the beginning of each line
;====================================

^+-::
Send, ^c
Sleep, 50
ClipWait,1
If (ErrorLevel=1)
{
  MsgBox,4144,Error, No text appearing after one second
  Return
}
ClipboardVar:=Clipboard
UpdatedLines:=""
Loop,Parse,ClipboardVar,`n,`r
  UpdatedLines:=UpdatedLines . "-" . A_LoopField . "`n"
Clipboard:=UpdatedLines
Sleep, 50
Send, ^v
Return

Open in new window



I was wondering if I can take as a reference to add line number for each line.

Example:

I have the following text block:

text text text text text text text text text text text text text
text text text text text text text text text text text text text text text text
text text text text text text text text text text text text text text text text text

-I select the text
-I launch the AutoHotkey script and I expect to have the following:

1.text text text text text text text text text text text text text
2.text text text text text text text text text text text text text text text text
3.text text text text text text text text text text text text text text text text text

If you have questions, please contact me.

Thank you for your help.
0
Hi:

Below is a snippet from my T-SQL code.  It is giving me the following error:

Conversion failed when converting the varchar value '12646–112521' to data type int.

Please let me know how to add syntax to fix this.

Thanks!

Software Engineer

CASE WHEN ORDERLN.ITEMID IS NOT NULL THEN 
Ltrim(rtrim(ORDERLN.ITEMID)) + '–' + ltrim(rtrim(ORDERLN.LINEID))
ELSE '1' + '–' + ltrim(rtrim(ORDERLN.LINEID)) END as ITEMID,

Open in new window

0

Programming

53K

Solutions

41K

Contributors

Programming includes both the specifics of the language you’re using, like Visual Basic, .NET, Java and others, but also the best practices in user experience and interfaces and the management of projects, version control and development. Other programming topics are related to web and cloud development and system and hardware programming.