Normal Topic Need Mode to ID Designer from RunTime running (Read 1213 times)
obfusc88
Full Member
***
Offline


No personal text

Posts: 194
Joined: Dec 17th, 2005
Need Mode to ID Designer from RunTime running
Nov 25th, 2017 at 12:32am
Print Post Print Post  
I am struggling to make different destination paths for Export and Import files when running in designer mode and RunTime time in the application.

Tests are OK in Designer mode, but fail in RunTime.
If I change paths to work in Runtime, then I cannot test the routines in designer mode.

Design work is frequently done on my local PC.  Then reconciled to application on customer Server.  But sometimes Designer is used on a customer workstation.  Workstations are mapped to a Share on the server, but the Drive letters are not recognized by the Server when going to relative paths in Client-Server mode.

Server 2012 has a Share identified as Sesame2. On the server it is the C:\Sesame2\ folder.
Sesame is installed on the \\Server\Sesame2\ folder
Work stations are mapped so Drive S goes to the share Sesame2 with a subfolder \Sesame2\Exports\

Cannot find a common path for both modes.  Need to make something like this:

Code
Select All
// Set vDataPath based on environment
var vDataPath as String            // Destination path for exports
                                   // and Source path for imports

// Designer/Runtime mode on my local workstation
If @DirectoryExists("C:\Sesame2\CustName") Then {
     vDataPath = "C:\Sesame2\CustName\Exports"
     } ELSE {

     // On customer network, local station
     If @DirectoryExists("S:\Exports") Then {

          // Runtime mode on customer network, local station
          If @RuntimeMode Then {
               vDataPath = "Exports"
               } ELSE {

               // Designer mode on customer network, local station
               If @DesignerMode Then {
                    vDataPath = "S:\Sesame2\Exports"
                    } ELSE {

                    // None of above conditions exist
                    @MsgBox("Control folders not found.","","This may not be a valid setup.")
                   }
          }
     }
} 




Is there such a command somewhere that I have not been able to find?
  
Back to top
 
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Need Mode to ID Designer from RunTime running
Reply #1 - Nov 25th, 2017 at 1:51am
Print Post Print Post  
Just a few quick thoughts while I am here:

How about starting Designer with a batch file to create a file on the local workstation?  Or you could have a prompt pop up when the app is started, asking if you are in Development or Runtime mode?  Could default to RunTime after x seconds, or wait until answered.  That could create a file, or make a Global Variable or some other condition to check based on the answer to the prompt.

Now do an If File Exists or check the Global Variable to determine that you are in the Designer or RunTime Mode.

When you exit Designer, have the temp file deleted or renamed, or delete/change the Global Variable.

You could create an EXIT APP button to do those things before exiting.

Put one of those conditions in place of the @RuntimeMode/@DesignerMode statements in your sample desired code.

  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Need Mode to ID Designer from RunTime running
Reply #2 - Nov 25th, 2017 at 4:24am
Print Post Print Post  
Here is a small batch file I quickly created and tested it.  Seems to work OK.  Batch file named Sdesigner.bat.  Made a shortcut using Sdesigner icon.  Set to run in minimized mode to keep invisible.

Here is the code:
Code
Select All
ECHO OFF
ECHO Designer >> C:\Sesame2\Designer_ON.txt

:: Start from Sesame2 folder where the rootdirs.ini file is located.
C:
CD\Sesame2\
C:\Sesame2\Program\Sdesigner.exe

DEL C:\Sesame2\Designer_ON.txt

:: File Sdesigner.bat file created on 11/24/2017 by Bob Hansen, rmhansense@sensiblesolutions.org
:: Batch file to start Sesame Designer, create a status file, and delete it when closed.
:: Designed to be used to see if Designer is running by checking for a text file in the Sesame directory.

 



Hope it helps
  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2480
Joined: Aug 20th, 2003
Re: Need Mode to ID Designer from RunTime running
Reply #3 - Nov 27th, 2017 at 2:12pm
Print Post Print Post  
@PreviewMode() will give you what you want.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
obfusc88
Full Member
***
Offline


No personal text

Posts: 194
Joined: Dec 17th, 2005
Re: Need Mode to ID Designer from RunTime running
Reply #4 - Nov 29th, 2017 at 3:57am
Print Post Print Post  
Thanks Ray.   Now that you told me,  I recall hearing about that before.   Never used it yet, but will try it out tomorrow.

Thanks also to Bob for his quick batch file.   I did try that and it did work out.   But using @PreviewMode() will be easier.   Will work everywhere without having to remember to install a batch file.   

Appreciate the solutions.
  
Back to top
 
IP Logged