Printable Version of Topic

Click here to view this topic in its original format

UtterAccess Forums _ Other Database Engines _ ICOMS Scripting

Posted by: cableguy Feb 28 2007, 02:26 PM

(not sure if this would go here)
My any chance is anyone here familiar with the billing and operations DB program called "ICOMS"?
if so... are you familiar with automating your work with scripting?
if so... would you happen to know what language their scripting is based off of?
and if you arent familiar with icoms or the scripting in icoms... can you tell me if this looks familiar... and if so what you think it is:
corrently I am thinking it is based on basic. the way that for-next loops works is just like basic so I am workin on figuring it out from there.

CODE
rem Recorded script
HostCursorPut(2,29)
HostScreenPutString( "  " )
HostCursorPut(2,29)
HostScreenSendKey( "Enter" )
HostScreenSendKey( "F23" )
HostScreenPutString( "022607" )
HostCursorPut(11,5)
HostCursorPut(11,10)
HostCursorPut(11,13)
HostScreenPutString( "  992" )
HostCursorPut(11,13)
HostCursorPut(11,16)
HostCursorPut(11,43)
HostScreenPutString( "MDUAUDT" )
HostCursorPut(11,43)
HostCursorPut(11,49)
HostCursorPut(11,62)
HostScreenPutString( "ACTVTHF" )
HostCursorPut(11,62)
HostCursorPut(11,66)
HostScreenSendKey( "Enter" )
HostScreenSendKey( "F3" )
HostScreenSendKey( "F3" )
HostCursorPut(4,2)
HostScreenPutString( "               " )
HostCursorPut(4,2)
HostCursorPut(4,18)
HostScreenPutString( "          " )
HostCursorPut(4,18)
HostCursorPut(4,29)
HostScreenPutString( " " )
HostCursorPut(4,29)
HostCursorPut(4,33)
HostScreenPutString( "                                " )
HostCursorPut(4,33)
HostCursorPut(5,2)
HostScreenSendKey( "Field Exit" )
HostCursorPut(5,2)
HostCursorPut(5,16)
HostScreenPutString( "   " )
HostCursorPut(5,16)
HostCursorPut(5,20)
HostScreenPutString( "  " )
HostCursorPut(5,20)
HostCursorPut(5,23)
HostScreenPutString( "                         " )
HostCursorPut(5,23)
HostCursorPut(5,49)
HostScreenPutString( "  " )
HostCursorPut(5,49)
HostCursorPut(5,57)
HostScreenSendKey( "Field Exit" )
HostCursorPut(5,57)
HostCursorPut(4,2)
HostScreenPutString( "               " )
HostCursorPut(4,2)
HostCursorPut(5,69)
HostScreenPutString( "    " )
HostCursorPut(5,69)
HostCursorPut(3,46)
HostScreenPutString( "N" )
HostCursorPut(3,46)
HostCursorPut(4,2)
HostCursorPut(2,21)
end

Posted by: nimzo May 19 2007, 08:44 AM

Yes, I am very familiar with this language, although I use it from an application called PMHS, for health insurance claims payment. It is very much like basic, although it is a bit of a dumbed down version. Here's the most commonly used commands:
ostcursorput(row,column) - places cursor - if your program runs from a gui, see if you have a "show emulator" option, look for coordinates which change when you move the cursor, alternatively you can record a script as above and find the coordinates from the "hostcursorput" it records.
hostscreenputstring("text" or varaiblename

Posted by: nimzo May 19 2007, 08:44 AM

Yes, I am very familiar with this language, although I use it from an application called PMHS, for health insurance claims payment. It is very much like basic, although it is a bit of a dumbed down version. Here's the most commonly used commands:
ostcursorput(row,column) - places cursor - if your program runs from a gui, see if you have a "show emulator" option, look for coordinates which change when you move the cursor, alternatively you can record a script as above and find the coordinates from the "hostcursorput" it records.
hostscreenputstring("text" or varaiblename)
hostscreensendkey("key")
dim variablename as **string for text, integer for whole numbers, double for currency or other numbers that may not be whole numbers
hostscreengetstring(row,column,length,variablename) gets a string variable. for my app all variables grabbed from the program must be strings (text format) which can then be converted into numbers.
doublevariablename=val(textvariablename) --- returns the value of textvariablename and puts it in doublevariablename, necessary for performing math operations on variables.
textvariablename=str(doublevariablename) --- exactly the opposite of the above
messagebox("title","Example : "+textvariablename,#foriconoption,#forbuttonsoption) for the last 2 parameters, play around to find what the options are- using 1,0 will give you a red stop icon and a single "enter" button
using
integervariablename=messagebox("title","example",3,3) **play around with these last 2 parameters
messagebox("button pressed equals",str(integervariablename,1,0)
will give you idea of how some very basic info can be collected from the user
clipboardcopy("text"+variablename)
loops:
gosub nameofsubroutine
subroutines are defined like this
nameofsubroutine:
blah blah blah
return
if ...... then
blah blah blah
end if
while ......
blah blah blah
wend
for x=0 to 100
blah blah blah
next x
scriptcall("name of other script case sensitive")
calls another script
urlopen("filepathandname")
this can also be used to send an email
there are also commands for connecting to and commanding excel, but I don't remember them all off the top of my head....
hope this helps!

Posted by: cableguy May 23 2007, 06:24 PM

wow! that is great info!
And now that you mention the excel thing...... ooooooh goodness! I mean the things I could do with that! but oh well... this is already enough info to get me started.
I had all but given up on anything that wasnt recorded... sad.gif
thankyou thankyou thankyou
also uarulez2.gif welcome to UA sad.gif
** goes off to print and play around with this stuff **

Posted by: nimzo May 26 2007, 02:48 PM

Just discovered something new that may be of use to you:
One problem I had was that I couldn't transfer info from one script to another. Found I was using the wrong syntax.
if you declare a variable as
global variablename as string (or integer or whatever)
then the variable is saved and useable by other scripts--- I needed to know this because there is a 64kb (ARGH) size limit for my macro files --- I suspect you might as well, we are using basically the same program but with different "shells"- mine is developed by Siebel, and I think your's is too. So to get around the size limit I use the scriptcall command a lot, but variables didn't transfer which was a pain. But now that's resolved!
I'll get you the excel commands soon, I have a report I work which is simply finding specific people and adding or deleting a 2 digit code - but there can be hundreds of people. With excel + macros, it does all of it on auto-pilot, and best of all it completely ties down my computer for 20 minutes or so of pure nothing for me to do time sad.gif
By the way, if no one else there is writing their own scripts, you should try to parlay your new skills into a promotion before showing others how to do this. Find a Six Sigma Business management book at the book store learn a few buzz words/phrases like "Picking the Dangling Fruit" and "Proactive", wear a tie, and get an office with a window, baby!

Posted by: cableguy Jun 4 2007, 12:36 PM

well... my cubicle is up against a wall and I have 2 windows that look out on the landscaping in front of the building so while it isnt an office it does have a window sad.gif
With promotions, unfortunately I cant really go up without changing departments and I love this department way too much to go anywhere sad.gif maybe some time in the future though.
most of the people whom would benifit from knowing how to do their own scripting have no experiance coding what-so-ever and would prolly be better off asking me to throw something together for them anyway laugh.gif they pretty much all do already as it is sad.gif
the good news is I am paid well and there is still plenty more money I can get and my job will stay as laid back as it is sad.gif
declareing global variables will help alot! I was wondering about file size limits so it's good to have that info up front sad.gif
ICOMS is made by Convergys... which might or might not be using something that either sibel developed or is using as well... either way so far what I have used from what you suggested has all worked so it's definately using something similar with the platform!
one thing I am curious... since they are similar platforms. do you guys use oracle discoverer as a reporting tool? it would be interesting if you were. I use access and just pull from the server via odbc anyway because discoverer is way too limited... but I was rather curious to find out if it is something that is side by side with this type of billing system or if it is something that my company just decided to use (or Convergys decided to use for that matter)
definately if you find more about those excel functions I am very interested!
thanks again for all the great info! sad.gif

Posted by: cableguy Jun 6 2007, 10:08 AM

I have some new and additional info.
irst I discovered the goto command works (ie "goto thatspot" then identify the spot later with "thatspot:")
and another thing is I put together a refrence list for the messagebox.
ok=1
cancel=3
abort=3
retry=4
ignore=5
yes=6
no=7
yes to all = 10
no to all = 11
(I am not sure why numbers 8 and 9 are missing but it is probably just so that the "to all" options stand seperate...
each option in the types of messagebox are listed as followed:
0 | ok=1 |
1 | ok=1 | cancel=2 |
2 | Abort=3 | Retry=4 | Ignore=5 |
3 | yes=6 | no=7 | cancel=2 |
4 | yes=6 | no=7 |
5 | Retry=4 | cancel=2 |
6 | yes=6 | yes to all=10 |
7 | yes=6 | yes to all=10 | no=7 | cancel=2 |
8 | yes=6 | no to all=11 | no=7 | cancel=2 |
9 | yes=6 | yes to all=10 | no=7 | no to all=11 | cancel=2
10 | no=7 | cancel=2 |
11 | no=7 | no to all=11 | cancel=2 |
12 | yes=6 | cancel=2 |
13 | exit=2 |
I am also attaching a spreadsheet that I put together for easy refrence for myself.

 ICOMSmessagebox.zip ( 2.09K ): 22
 

Posted by: cableguy Jun 6 2007, 03:37 PM

something else I have been wondering...
o you happen to know if you can assign a script to a hottkey?

Posted by: cableguy Jun 8 2007, 04:18 PM

more info:
lipboardpaste()
treat it like a variable that's value is equal to whatever is in the clipboard... useful with clipboardcopy

Posted by: suddenlink Mar 28 2008, 03:43 PM

Looks like its been nearly a year since this topice has been updated. I'm interested in doing some macros in our vendr's product (ICOMS) as well. I will read over the conversations and may have some questions later. Thanks in advance for the information.

Posted by: motleyjew Apr 8 2008, 08:48 PM

I do a lot of ICOMS scripting with green screen using vba in access. Here is a great link I found detailing how to use it.
http://www.itjungle.com/mpo/mpo061903-story02.html
It seems to be pretty similar to what this thread talks about using the emulator. I can't figure out how this is done. The commands seem similar to the method I use, but where is it written? VBscript?

Posted by: ru2cool Sep 15 2011, 07:02 PM

I work with ICOMS & have found all of the information in this thread to be most helpful.
However, I was wondering if anyone could confirm what the commands are to send data to excel?

Posted by: Rigest Sep 4 2012, 10:23 AM

Sorry for bumping such an old thread, but I really could use some help. So I want to write a script using this too, but I can't find where the system saves these scripts. How can I execute them? I want to transfer certain data from an access database to a J-walk client. I've wrote such scripts with AutoIT before, but I can't figure it out with this client.

Posted by: ru2cool Dec 10 2012, 01:46 PM

Rigest, my apologies for the late response but I was certain no one else was going to post so I stopped checking a while back. Regarding your questions, I'll answer them in list format:
. The scripts are saved in in the main program folder as ICOMS.JWU and/or JW9C.JWU (depending on whether you save them as application or global). Also, they only get saved to the hard drive after you close the last J-walk client window. So, if you're going to add/edit any scripts, I recommend closing all but one window and then closing it too as soon as you're finished. Then, any new client windows you open will contain the updated scripts.
2. In order to execute a script you must first unhide the main toolbar. To do that, right click the title bar on the J-walk client window and then click the 'Toolbars...' link. On the next window, highlight the first toolbar (there should only be one listed by default) and click the checkbox beside the word 'Hide'. Then, close that window and the toolbar should be accessible. To execute any scripts you first have to record one and save it as either global or application (I recommend application b/c they can be executed in dropdown list format). Any script can be edited from the toolbar edit button if you want to code it manually.
3. I've found that using a hidden IE window is the absolute best/quickest way to pass large amounts of data to the J-walk client. Unfortunately, the coding language it uses seems to be based on an older version of Visual Basic and is not very user friendly (I've never been able to find any official documentation so my assumption is that the language was custom made by the program designers). So, my approach is to code a separate VBScript file (i.e. C:\Myscript.vbs) and then call it up from the J-walk script using the wscript.shell object's run command. I use that b/c I can manually return numeric values back to the J-walk script which then triggers it to either abort or read the values from the hidden IE window. Your code to open/read the Access database and pass info to the IE window would need to be placed in the VBScript file. For the IE window, I simply tell it to navigate to about:blank and then dynamically write in the HTML which turns it into one or more textarea(s). The trick is to give the IE window a creative title which will most likely not be used anywhere else. That way, I can use the shell.application windows collection to re-acquire the IE window.
If you have any other questions please let me know and I'll do my best to answer them. Below are some of my code examples for reference -
This example shows how to execute one of your VBScript files from the J-walk client and return a numeric value

CODE
dim retValue as integer
dim wshell as variant
wshell = createobject("wscript.shell")
' If you wanted to return the value of 1 to the variable
' retValue, use this line in the vbscript file - wscript.quit 1
' Any number you use after the command wscript.quit will be passed
' to the J-walk script.
retValue = wshell.run(("C:\Myscript.vbs")), 0, 1)

This is the html I use in my IE window
CODE
<html>
<head>
<title>Custom Title Here</title>
<style type='text/CSS'>
html, body {
overflow:auto;
margin:0;
}
table {
width:100%;
height:100%;
border-collapse:collapse;
}
Hth, td {
padding:0;
}
textarea {
width:100%;
height:100%;
overflow:auto;
position:absolute;
}
</style>
</head>
<body>
    <table>
        <tr>
            <td>
                <textarea id='customid'></textarea>
            </td>
        </tr>
    </table>
</body>
</html>

This example shows how to acquire the IE window from the J-walk client and read the data
CODE
dim a as integer
dim accessData as string
dim doc, ie, shell, txtarea, win as variant
shell = createobject("shell.application")
for a = 0 to 100
    
    win = shell.windows((a))
    
    if isobject(win) then
        
        if not (win.busy) and (win.name = "Windows Internet Explorer") then
            
            doc = win.document
            
            if doc.title = "Custom Title Here" then
                
                ie = win
                exit for
                
            endif
            
        endif
        
    else
        
        exit for
        
    endif
    
next
if not isobject(ie) then
    
    messagebox("Error", "IE window was not found", 1, 0)
    
else
    
    txtarea = doc.getelementbyid("customid")
    
    ' My advice would be to post the data from Access as one very
    ' long string using a special delimeter(s) so it can be broken
    ' up into an array manually by the J-walk script
    
    accessData = txtarea.innerhtml
    
endif

On a side note, I too have used AutoIt and absolutely loved it.

Posted by: CableGuy931 Jan 4 2019, 12:43 PM

Sorry to revive an old thread. This thread gave me a lot of good information to start on some of this and wanted to add some things I have discovered to it in case anyone else is still looking for some of it.

Here is a tested and working example code to read and write to an excel file.

CODE
Dim objExcel,objRange,objSheet,objWB as Variant
Dim cellData,strExcel as String
Dim i,lastLine,xlUp as Integer

'Defining Contstants
xlUp = -4162

'Initializing Excel Object
objExcel = createobject("Excel.Application")

objExcel.Visible = 0 '0=hidden, 1=visible
objExcel.Application.DisplayAlerts = 0 '0=No Alerts, 1=Alerts

strExcel = "C:\myExcel.xlsx"

objWB = objExcel.Workbooks.Open(strExcel,1,0)
objSheet = objWB.Sheets(1)

objSheet.Activate
objWB.RefreshAll

lastLine = objSheet.Range("A" & str(objSheet.Rows.Count)).End(xlUp).Row 'counts all rows in the sheet and returns the last line as an integer

'ojSheets.Cells(Row,Cell)
For i = 1 to lastLine
    cellData = objSheet.Cells(i,1).text 'It can read from excel using Text,Value or Formula. I find Text usually works best
    
    If cellData = "" Then
        objSheet.Cells(i,1).Formula = Str(i) 'It will only write to excel using Formula
        cellData = objSheet.Cells(i,1).text
    End If
    
    MessageBox("Cell Data",cellData,4,0)
Next i

objWB.Save
objWB.Close
objExcel.Quit

Posted by: CableGuy931 Jan 4 2019, 01:14 PM

This code grabs the name of each field on the current screen and writes it to a file, for use with the "HostField" functions listed below.

CODE
Dim fieldNames,fileData,filePath as String
Dim Success as Integer

filePath = "C:\fieldNames.txt"
PanelNameGet(10,fieldNames)

If FileExists(filePath) Then
    Success = FileLoad(filePath,fileData,-1)
    fileData = fileData + chr(13) + chr(10) + fieldNames
    Success = FileSave(filePath,fileData,1,-1,1)
Else
    Success = FileSave(filePath,fieldNames,1,-1,1)
End If


HostFieldCursorSet(Name of Field,Line_Number)

HostFieldGetData(Name of Field,Variable)

HostFieldGetLineData(Name of Field,Line_Number,Variable)

HostFieldListGetData(Name of Field,Variable)

HostFieldPutData(Field_Name,Field_Line,String)

HostFieldSendKey(Field Name,Field_Line,Key_Name)

HostFieldGetProp(Field Name,Property_value,integer_Variable)

Property Values:
Name Value Description
DISABLED 1 The Disabled status of the field (0=No, 1=Yes)
HIDDEN 2 The Hidden status of the field (0=No, 1=Yes)
TYPE 3 The Type of the field
LENGTH 4 The Length of the field (number of characters)
COLOR 5 The Color of the field. Decimal value (0-31) representing the assigned emulator color combination mapped to the field. These mappings can be viewed from the Change colors panel by navigating to:




Here is my script that parses the data, sorts it by x,y coordinates and states whether it is disabled [ (D) ] or not.

CODE
' ==================================================
' Prints out all fields for the current screen
' Read only fields are marked with (D) for Disabled
' ==================================================

Dim SGB,char,strUser,tmp,tmpSGB,toClipboard,fldData,vbCrlf,genScreenData as String
Dim l,i,j,chrCnt,x,y,ubCounter,strLength,fieldLength,fieldDisabled as integer
Dim userProfile,wNet,WshShell as Variant

wNet = CreateObject("WScript.Network")
strUser = wNet.UserName

WshShell = CreateObject("WScript.Shell")
userProfile = WshShell.ExpandEnvironmentStrings("%USERPROFILE%")

vbCrlf = Chr(13) & chr(10)

genScreenData = "true" 'true: prints copy of screen for comparison. false: only prints the fields + location + contents

Dim icomsField(1) as String
Dim iFieldX(1) as String
Dim iFieldY(1) as String
Dim iFieldData(1) as String
Dim iFieldDisabled(1) as String

icomsField(0) = ""
iFieldX(0) = ""
iFieldY(0) = ""
iFieldData(0) = ""
iFieldDisabled(0) = ""

ubCounter = 0 'Upper Bound Counter for array

PanelNameGet(10,SGB) 'This pulls the Field names from the current window.takes values of 1-10

tmpSGB = SGB

For i = 1 to Len(SGB)
    char = Right(Left(SGB,i),1)
    chrCnt = chrCnt + 1
    
    If char = ";" Then
        tmp = Left(tmpSGB,chrCnt - 1)
        
        If Len(tmp) > strLength Then
            strLength = Len(tmp)
        End If
        
        j = j + 1
        
        ReDim Preserve icomsField(ubCounter + 1)
        ReDim Preserve iFieldX(ubCounter + 1)
        ReDim Preserve iFieldY(ubCounter + 1)
        ReDim Preserve iFieldData(ubCounter + 1)
        ReDim Preserve iFieldDisabled(ubCounter + 1)
        
        icomsField(ubCounter) = tmp
        
        chrCnt = 0
        HostFieldGetData(icomsField(ubCounter),fldData)

        HostFieldCursorSet(icomsField(ubCounter),0)
        HostCursorGet(x,y)
        
        iFieldX(ubCounter) = Str(x)
        iFieldY(ubCounter) = Str(y)
        iFieldData(ubCounter) = fldData
        
        HostFieldGetProp(icomsField(ubCounter),1,fieldDisabled)'0=No, 1=Yes
        
        If fieldDisabled = 0 Then
            iFieldDisabled(ubCounter) = "   "
        ElseIf fieldDisabled = 1 Then
            iFieldDisabled(ubCounter) = "(D)"
        End If

        tmpSGB = Right(SGB,Len(SGB) - i)
        ubCounter = ubCounter + 1
    ElseIf i = Len(SGB) Then
        j = j + 1
        
        tmp = Right(SGB,chrCnt)
        
        If Len(tmp) > strLength Then
            strLength = Len(tmp)
        End If
        
        ReDim Preserve icomsField(ubCounter + 1)
        ReDim Preserve iFieldX(ubCounter + 1)
        ReDim Preserve iFieldY(ubCounter + 1)
        ReDim Preserve iFieldData(ubCounter + 1)
        ReDim Preserve iFieldDisabled(ubCounter + 1)
        
        icomsField(ubCounter) = tmp
        
        HostFieldGetData(icomsField(ubCounter),fldData)

        HostFieldCursorSet(icomsField(ubCounter),0)
        HostCursorGet(x,y)
        
        iFieldX(ubCounter) = Str(x)
        iFieldY(ubCounter) = Str(y)
        iFieldData(ubCounter) = fldData
        
        HostFieldGetProp(icomsField(ubCounter),1,fieldDisabled)'0=No, 1=Yes
        
        If fieldDisabled = 0 Then
            iFieldDisabled(ubCounter) = "   "
        ElseIf fieldDisabled = 1 Then
            iFieldDisabled(ubCounter) = "(D)"
        End If

        ubCounter = ubCounter + 1
    End If
Next i

GoSub arraySort

For i = 0 to ubCounter - 1
    If Len(icomsField(i)) < strLength Then
        For j = 1 to strLength - Len(icomsField(i))
            icomsField(i) = icomsField(i) & " "
        Next
    End If
    
    SGB = ""
    
    l = Len("(" & iFieldX(i) & "," & iFieldY(i) & ")")
    
    If l < 7 Then
        For j = 1 to 7 - L
            SGB = " " & SGB
        Next
    End If
    
    toClipboard = toClipboard & icomsField(i) & " (" & iFieldX(i) & "," & iFieldY(i) & ")" & SGB & iFieldDisabled(i) & ": " & iFieldData(i) & vbCrlf
Next i

If LCase(genScreenData) = "true" Then
    GoSub GetScreenData
End If

GoSub LogEvent

End

GetScreenData:
    SGB = ""
    tmpSGB = ""
    
    For x = 1 to 24
        HostScreenGetString(x,1,80,SGB)
        If x = 24 Then
            tmpSGB = tmpSGB + SGB
        Else
            tmpSGB = tmpSGB + SGB + vbCrlf
        End If
    Next x
    
    toClipboard = toClipboard + vbCrlf + "--------------------------------------------------------------------------------"
    toClipboard = toClipboard + vbCrlf + tmpSGB
    toClipboard = toClipboard + vbCrlf + "--------------------------------------------------------------------------------" + vbCrlf
Return

LogEvent:
    Dim ForReading, ForWriting, ForAppending as Integer
    Dim shell, txtfile as variant
    
    ForReading = 1
    ForWriting = 2
    ForAppending = 8

    shell = createobject("Scripting.FileSystemObject")
    If Not shell.FileExists(userProfile & "\Desktop\iWrite.txt") Then
        txtfile = shell.CreateTextFile(userProfile & "\Desktop\iWrite.txt")
    Else
        txtfile = shell.OpenTextFile(userProfile & "\Desktop\iWrite.txt",ForAppending)
    End If

    txtfile.write(toClipboard + vbCrlf)
Return

arraySort:
    Dim tempD,tempDisabled,tempF,tempX,tempY,tempXY,tempXYP1 as String
    Dim a as Integer
    
    For a = ubCounter - 2 To 0 Step - 1
        For j = 0 to a
            If Len(iFieldY(j)) = 1 Then
                tempXY = iFieldX(j) & "0" & iFieldY(j)
            Else
                tempXY = iFieldX(j) & iFieldY(j)
            End If
            
            If Len(iFieldY(j + 1)) = 1 Then
                tempXYP1 = iFieldX(j + 1) & "0" & iFieldY(j + 1)
            Else
                tempXYP1 = iFieldX(j + 1) & iFieldY(j + 1)
            End If
            
            If val(tempXY) > val(tempXYP1) Then
                    tempF = icomsField(j + 1)
                    icomsField(j + 1) = icomsField(j)
                    icomsField(j) = tempF
                    
                    tempX = iFieldX(j + 1)
                    iFieldX(j + 1) = iFieldX(j)
                    iFieldX(j) = tempX
                    
                    tempY = iFieldY(j + 1)
                    iFieldY(j + 1) = iFieldY(j)
                    iFieldY(j) = tempY
                    
                    tempD = iFieldData(j + 1)
                    iFieldData(j + 1) = iFieldData(j)
                    iFieldData(j) = tempD
                    
                    tempDisabled = iFieldDisabled(j + 1)
                    iFieldDisabled(j + 1) = iFieldDisabled(j)
                    iFieldDisabled(j) = tempDisabled
            End If
        Next
    Next
Return


I have also attached a text file that contains the entire list of functions that was pulled from the .exe file of icoms. Unfortunately it only gives the function name. There are no descriptions or parameters.
I am working on putting together a file with all of the ones I have figured out by trial and error and will post it once i get it finished.

 IcomsFunctionList.txt ( 6.5K ): 11
 

Posted by: CableGuy931 Jan 15 2019, 01:19 PM

Here is the function reference sheet I made with the functions I currently know how to use. It provides, Descriptions, syntax, parameters and examples. I have also provided the file that got me started with scripting, the icoms scripting guide. Someone else in my company made the original, but I have added some things to it as I have discovered them. It is a bit thrown together as i've never taken the time to clean it up and organize it too much, but it should help you get started with the basic syntax for loops, statements and sub routines, etc.

 ICOMs_Scripting_Function_Reference.zip ( 71.54K ): 10
 Icoms_Scripting_Guide.zip ( 25.79K ): 10
 

Posted by: CableGuy931 Mar 4 2019, 12:25 AM

Here is a script I put together to convert a julian day number back into a readable calendar date. This really helps with scripts that use scheduling options. I can pull today's date with the CDate() function, convert it to julian day number using the JulianDayNumber() function and add lets say 7 days. Then use this code as a subroutine to convert it back into a calendar date so the script can schedule it. There is no built in function to convert it back from the julian day number.

CODE
' ===================================================
' julian day to calendar day converter
' ===================================================
' Adapted from the javascript code from http://www.onlineconversion.com/julian_date.htm
' ===================================================

Dim gregJD,tmp as Integer
Dim j1,j2,j3,j4,j5,julianDate as Double

' Call the sub routine to set julianDate to today's date
GoSub GetTodaysDate

' uncomment the following line to set the date manually
'julianDate = 2458500

' you can add/subtract any number of days to get a date
' that many days from the original date specified
'julianDate = julianDate + 10

' drops the decimals from the date
julianDate = Round(julianDate,0)

gregJD = 2299161

If JulianDate >= gregJD Then
    tmp = RoundDown(((julianDate - 1867216) - 0.25)/36524.25,0)
    j1 = julianDate + 1 + tmp - RoundDown(0.25*tmp,0)
Else
    j1 = julianDate
End If

j2 = j1 + 1524
j3 = RoundDown(6680.0 + ((j2 - 2439870) - 122.1)/365.25,0)
j4 = RoundDown(j3*365.25,0)
j5 = RoundDown((j2 - j4)/30.6001,0)

d = RoundDown(j2 - j4 - RoundDown(j5*30.6001,0),0)
    
m = RoundDown(j5 - 1,0)

If m > 12 Then
    m = m - 12
End If

y = RoundDown(j3 - 4715,0)

If m > 2 Then
    y = y - 1
End If

If y <= 0 Then
    y = y - 1
End If

If y < 0 Then
    y = -y
    'Era is AD
Else
    'Era is BC
End If

MessageBox("Calendar Date","Julian Day = " & Left(Str(julianDate),Len(Str(julianDate)) - 2) & chr(10) & Str(m) & "/" & Str(d) & "/" & Str(y),4,0)

End

GetTodaysDate:
    ' This sub Routine Sets julianDate to today's date
    Dim d,m,y as Integer
    Dim success as Double

    d = Val(Right(Str(CDate()),2))
    m = Val(Left(Right(Str(CDate()),4),2))
    y = Val(Left(Str(CDate()),4))

    success = JulianDayNumber(y,m,d,julianDate)
Return

Posted by: CableGuy931 May 14 2019, 08:24 AM

Here is an updated version of the Icoms Function Reference. I have updated the formatting, fixed a couple of typos, added a contents section and added usage information for these functions: ArrayElementDelete(), ArrayElementInsert(), CountGet(), CountInc(), CountSet(), SortArray(), and StrArray().

There are 2 attachments, a pdf and a docx. They are exactly the same, but I have found that the format can get messed up in the docx depending on the version of MSWord/libreoffice being used.

 ICOMs_Scripting_Function_Reference_UAF.2.docx.zip ( 80.3K ): 3
 ICOMs_Scripting_Function_Reference_UAF.2.pdf.zip ( 395.17K ): 2
 

Posted by: whiteshark29 Jul 27 2019, 10:57 AM

I cant get the Paste function to work. I want to paste from the windows clipboard. Any help would be appreciated!

Posted by: CableGuy931 Jul 27 2019, 11:16 AM

whiteshark29:

CODE
Dim clipData as String

clipData = ClipboardPaste()


this would add the current contents of the clipboard to the variable clipData. If this does not work, please provide more information about the error you get and what exactly you are trying to do with the data.

Posted by: whiteshark29 Jul 27 2019, 04:59 PM

Im still not getting it.
I tried all the lines below (this is just the tail end of my macro)

rem HostScreenPutString("@/@v")
rem HostScreenSendKey( "Paste")
rem HostScreenSendKey( "Ctrl+V")
Dim clipData as String
ClipData = ClipboardPaste()
ClipboardPaste()


I just want to copy an account# from another program (omse) to icoms.
I get this error when it runs "An error has occurred while processing the script. Line 60 - Functions returns a value,must be used in expression"

Posted by: CableGuy931 Jul 27 2019, 05:41 PM

You will need to know the location of the field you want to enter it into. The easiest way is probably to open the emulator and look there. All of the scripting is based off of the emulator, not the GUI. You can access the emulator by right clicking on the title bar at the very top of the icoms window and choosing "Show Emulator" form the drop down list. A new window will pop up with the emulator screen. It will mirror the data of the icoms window that you just opened it from.

if you click on the account number field in the emulator, you will see at the bottom left of the screen an x,y coordinate. it will look something like 2-18. The first number, 2, is the row. The second is the column. Icoms has 25 rows, top to bottom and 80 columns, left to right.

once you have the correct x,y coordinate you can use:

CODE
HostCursorPut(2,18)
HostScreenPutString(ClipboardPaste())


HostCursorPut(2,18) will move your cursor to row 2, column 18.
HostScreenPutString(ClipboardPaste()) will put the contents of the clipboard into the field at that location.

2 and 18 will need to be changed to the correct coordinates of your account field. Keep in mind that location can vary depending on the screen you are currently on.
Also, in icoms the account number field is split on some screens so you may need to do something like this.

CODE
Dim acct1,acct2 as String

rem grab all the characters the length of the characters
rem except the last 2 and stores them in the variable acct2
acct1 = Left(ClipboardPaste(),Len(ClipboardPaste())-2)

rem this will get the 2 characters on the right of the
rem string and put them in the variable acct2
acct2 = Right(ClipboardPaste(),2)

HostCursorPut(2,18)
HostScreenPutString(acct1)

HostCursorPut(2,25)
HostScreenPutString(acct2)


Again, i don't remember the locations, so the locations used in the HostCursorPut functions are just examples.