I use and love Rolf's FFBackup app, but...
If I select the tool from the menu.. it works just fine, saving my project in the defined folder with a zip file for each version..
If I use the tool automatically for example pre-compile, the app doesn't seem to be able to get the proper project names and creates a zip file with only an extension...
I could have sworn this worked fine a while back ...
Am I missing a setting in FF ?
Strange somehow! I use all the time from the FF3 Tools menu and never had any problems with it.
Since the error happens when you use it automated befor compiling I assume it might be that at that particular time FF is not the ForeGround window. BkupFF3 reads the project name and folder from the FF3 caption.
RES = GetForegroundWindow()
getwindowtext(RES,winCaption,%MAX_PATH)
If another window is the foreground window BkupFF3 will not get the data, and the result a zip file without proper name.
Here ist the full source code of BkupFF3:
#COMPILE EXE
#INCLUDE "WIN32API.INC"
GLOBAL inifile AS STRING
FUNCTION PBMAIN()
LOCAL RES AS DWORD
LOCAL winCaption AS ASCIIZ * %MAX_PATH
LOCAL fName AS STRING
LOCAL fNum AS LONG
LOCAL fPath AS STRING
LOCAL prjfile AS STRING
LOCAL Rel AS STRING
LOCAL t AS STRING
LOCAL tgtdir AS STRING
LOCAL x AS LONG
LOCAL exestr AS STRING
inifile = EXE.PATH$ & "BkupFF3.ini"
tgtdir = IniGetKey(inifile,"Settings","backuppath","C:")
RES = GetForegroundWindow()
getwindowtext(RES,winCaption,%MAX_PATH)
fName = MID$(winCaption,INSTR(WinCaption,"-")+2)
fName = MID$(fName,1,INSTR(fName,"[")-2)
prjfile = fName & ".ffp"
fPath = MID$(winCaption,INSTR(winCaption,"]") + 4)
fPath = LEFT$(fPath,INSTR(-1,fPath,"\")-1)
'Collect version info from FF3 project file
fNum = FREEFILE
OPEN prjfile FOR INPUT AS #fNum
WHILE NOT EOF(fNum)
LINE INPUT #fNum, t
IF LEFT$(t,11) = "ProjectName" THEN
Rel += MID$(t,INSTR(t,"=")+1)
END IF
IF LEFT$(t,9) = "FileMajor" THEN
Rel += "_v" & MID$(t,INSTR(t,"=")+1)
END IF
IF LEFT$(t,9) = "FileMinor" THEN
Rel += "_" & MID$(t,INSTR(t,"=")+1)
END IF
IF LEFT$(t,12) = "FileRevision" THEN
Rel += "_" & MID$(t,INSTR(t,"=")+1)
END IF
IF LEFT$(t,9) = "FileBuild" THEN
Rel += "_" & MID$(t,INSTR(t,"=")+1)
END IF
WEND
CLOSE fNum
'Create Backup folder
MKDIR tgtdir
MKDIR tgtdir & "\" & fName
'Create backup file
exestr = "7za a -tzip " & tgtdir & "\" & fName & "\" & rel & " " & fPath & "\"
x = SHELL(exestr,0)
t = "Backup File: " & rel & $CRLF & _
"Backup Folder: " & tgtdir & "\" & fName & "\"
MSGBOX "Backup File created!" & $CRLF & $CRLF & t, _
%MB_ICONINFORMATION OR %MB_OK OR %MB_APPLMODAL, "BkupFF3"
SetForegroundWindow(RES)
END FUNCTION
The complete project can be found here:
http://www.planetsquires.com/protect/forum/index.php?topic=2811.msg21023#msg21023
Rolf
@James
How are you starting BkupFF3? With a batch file?
Rolf
BTW:
Rolf is my first name. Not to long ago somebody wrote in a form that he felt a little strange about this. He had in the beginning alwas read:
"ROFL" (Abbr for Roll On the Floor Laughing".
Running as a FireFly User Tool .. selecting the post compile option from the Firefly menu.
The dialog always shows an empty file..
I can run the tool from the menu with no problem.
It must be a firefly thing with how the user tool is getting called to run. Which is why I posted this here... I figured Paul would know the answer. :-)
I tried it also as pre- and post-compile.
I think the problem is that FF3's Compiler info window is the topmost window when BkupFF3 starts. Then BkupFF3 doesn't get the need information.
Rolf
The Compiler results can be suppressed with the checkbox in the Environment Options, on the Compiler page.
@David
But it does not suppress the Compile Progress window...
Rolf
Try this Rolf,
Put this in your startup code: Dim lResult As Long
Dim i As Long
ReDim ghFoundFFInstance(0)
lResult = EnumChildWindows(GetDesktopWindow, CodePtr(ParentCallback), 0&)
For i = 1 To UBound(ghFoundFFInstance)
ztrace "" & ghFoundFFInstance(i)
Next i
And put this someplace else:Global ghFoundFFInstance() As String
Function ParentCallback (ByVal hWndChild As Long, lRaram As Long) As Long
Dim szClass As Asciiz * %MAX_PATH
Dim szText As Asciiz * %MAX_PATH
Dim lRes As Long
Dim iPos As Long
lRes = GetClassName(hWndChild, szClass, SizeOf(szClass))
lRes = GetWindowText(hWndChild, szText, SizeOf(szText))
RegExpr "FireFly Visual Designer -" In szText To iPos
If iPos <>0 Then
ReDim Preserve ghFoundFFInstance(UBound(ghFoundFFInstance)+1)
ghFoundFFInstance(UBound(ghFoundFFInstance)) = szText
End If
lRes = EnumChildWindows(hWndChild, CodePtr(ChildCallback), 0&)
Function = 1
End Function
Function ChildCallback (ByVal hWndChild As Long, lRaram As Long) As Long
Dim szClass As Asciiz * %MAX_PATH
Dim szText As Asciiz * %MAX_PATH
Dim lRes As Long
lRes = GetClassName(hWndChild, szClass, SizeOf(szClass))
lRes = GetWindowText(hWndChild, szText, SizeOf(szText))
Function = 1
End Function
It will find all instances of FireFly that are running. No decision making needed if only one is running. ;)
Best Regards,
David
Good idea, David. Thanks.
Rolf
Glad to help Rolf. Sorry, I went to bed after posting. Can't keep up with you guys in Europe all night. :P