Skip to content

Instantly share code, notes, and snippets.

View fushnisoft's full-sized avatar

Brahn Partridge fushnisoft

View GitHub Profile
@fushnisoft
fushnisoft / gist:2225570
Created March 28, 2012 11:43
Determine which monitor form is on (Clarion.Net)
(I assume that you have your own Rectagle fom the .Net window, I have created one here as a test)
thisScreen OF Screen = Screen.FromControl(SELF) ! <-- screen this form is currently on
! Get a Rectangle to use in our test below.
rect OF Rectangle = NEW Rectangle(thisScreen.Bounds.X, thisScreen.Bounds.Y, thisScreen.Bounds.Width, thisScreen.Bounds.Height)
! Loop through all known screens and test to see if our rectangle is on one of them
s OF Screen &= NULL ! Not sure if there is an "inline" way to do this in clarion...
FOREACH s IN Screen.AllScreens
IF s.Bounds.IntersectsWith(rect)
@fushnisoft
fushnisoft / del.bat
Created April 19, 2012 10:48
Example pre-build script for cancelling build if exe file is already open
ECHO off
:delfile
del %1%
if exist %1% goto fail
goto end
:fail
ECHO Unable to delete %1%, you probably still have it open!
EXIT /B 1
:end
@fushnisoft
fushnisoft / gist:3276563
Created August 6, 2012 16:56
c# FromClarionColor (also now with ToClarionColor...)
// Update from skype discussion
// First, check to see if your input is a hex string or not
private static int GetClarionColorFromString(string line)
{
if (line.Contains("h") || line.Contains("H"))
{
char[] chars = { 'h', 'H' };
line = line.TrimEnd(chars);
@fushnisoft
fushnisoft / TestForRick.cs
Created August 11, 2012 18:29
Close app view and then delete the app file
using System;
using System.IO;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui;
using SoftVelocity.Generator.UI;
namespace ClarionAddins
{
public class TestForRick : AbstractMenuCommand
{
@fushnisoft
fushnisoft / gist:4753904
Created February 11, 2013 11:13
how to add an <All> or <Empty> item to a Clarion FileDrop
! Add the custom row in the reset method
FDBLocation.Reset PROCEDURE
CODE
! Add <All> entry to the queue
IF Records(SELF.Q) = 0
Clear(SELF.Q)
SELF.Q.PRE:DisplayFieldName = '<All>'
Add(SELF.Q)
END
@fushnisoft
fushnisoft / make_docs.ps1
Created February 15, 2013 16:01
Extract rst formatted documentation blocks from clarion inc/clw files and process using Sphinx
cls
if ($args[0])
{exit}
# NOTE: Make sure you have the PowerShell Community Extensions installed
# http://pscx.codeplex.com/
Import-Module pscx
function ProcessFile($pSourceFile, $pOutputFile) {
Write-Host "Processing" $pSourceFile
@fushnisoft
fushnisoft / gist:4976723
Last active December 13, 2015 21:19
Convert SQL server DateTime stored in UTC to system DateTime
DECLARE @offset int
SET @offset = DATEDIFF(hh, GetDate(), GETUTCDATE());
SELECT GetDate() AS 'System DateTime'
, GETUTCDATE() AS 'UTC DateTime'
, @offset AS 'OffSet'
, DateAdd(hh, @offset, GetDate()) AS 'System converted to UTC'
, DateAdd(hh, @offset*-1, GetUtcDate()) AS 'UTC Converted to System'
@fushnisoft
fushnisoft / gist:5361600
Created April 11, 2013 08:05
Copy Clarion record structures using file references
Convert PROCEDURE(*FILE pSourceFile, *FILE pTargetFile)
sourceRec &GROUP
targetRec &GROUP
CODE
sourceRec &= pSourceFile{PROP:Record}
targetRec &= pTargetFile{PROP:Record}
targetRec :=: sourceRec
@fushnisoft
fushnisoft / fileupload.ps1
Last active January 19, 2022 08:03
Upload a file using powershell and the WinSCP .NET library with upload progress feedback
# Using the beta version of WinSCP http://winscp.net/eng/download.php
# Call this script to upload a file via FTP with progress feedback
# e.g.
# .\fileupload.ps1 -username "myusername" -password "mypassword" -localfile "C:\files\MyFile.exe" -remotefile "/public_html/files/MyFile.exe"
# NOTE: This script assumes the WinSCP binaries are in a sub directory to the script. You can probably pass that as a parameter to be more flexible.
param (
[string]$username,
[string]$password,
[string]$localFile,
@fushnisoft
fushnisoft / msbuild example.md
Last active June 12, 2019 14:59
msbuild example for Clarion

msbuild example for Clarion

This is an example of how to build a Clarion multi dll project from the command line. This was useful to be able to correctly build a multi-dll project containing circular references.


The BAT file

There are two calls so everything gets compiled.